Migration from owncloud 10.3.0 to Nextcloud

Hello, I have a few problems with migrating from owncloud 10.3.0:
I tried to follow this guide: https://nextcloud.com/migration/, but got this error message after running the updater and going to the main site:

Exception: Updates between multiple major versions and downgrades are unsupported

The updater tried to install nextcloud 12.0.12. This also has the problem that nextcloud 12 does not support php 7.3, although I could move it to a lower php version temporary for the upgrade.

Is there a different way to migrate from owncloud 10.3.0 to nextcloud?

Unfortunately the direct migration from the latest ownCloud 10.3 version to Nextcloud isn’t supported yet, because it couldn’t been tested. The tried migration wouldn’t most likely also not work, because your on ownCloud 10.3 and not 10.0.
This information might help you doing manual migration:

https://docs.nextcloud.com/server/17/admin_manual/maintenance/migrating_owncloud.html

Thanks for your pointers! I finally managed to migrate to nextcloud using these steps:
This is pretty sketchy, because I disabled several safety checks, but in case someone wants to do it:

  1. Manual upgrade according to https://docs.nextcloud.com/server/17/admin_manual/maintenance/migrating_owncloud.html
  2. Manually allow php 7.3 (index.php and lib/versioncheck.php) in nextcloud 12.0.13
  3. Force upgrade between major versions (my initial issue) in lib/private/Updater.php by removing the line throw new \Exception('Updates between multiple major…
  4. Follow https://github.com/nextcloud/server/issues/14549 to fix the error that occurs
  5. UPDATE oc_filecache set mtime=0
  6. UPDATE oc_filecache set storage_mtime=0
  7. /3rdparty/pear/archive_tar/Archive/Tar.php:639 remove “&” in front of func_get_args() (https://www.dotkernel.com/php-troubleshooting/fix-installing-pear-packages-with-php-7-2/)
  8. run updater from settings (remove php check again (only until nexcloud 14 is installed)) until newest version is installed

After doing this I noticed that some files have last edited dates in the future. This is probably due to setting mtime to 0.

6 Likes

I was brave (and careless) enough to try your steps mentioned above to migrate my OC 10.3.x to NC 12.0.13. Most of the steps worked well but the last step still throws this error:

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'ALTER TABLE oc_filecache CHANGE `fileid` `fileid` INT AUTO_INCREMENT NOT NULL, CHANGE `parent` `parent` INT DEFAULT 0 NOT NULL, CHANGE `mtime` `mtime` INT DEFAULT 0 NOT NULL, CHANGE `storage_mtime` `storage_mtime` INT DEFAULT 0 NOT NULL':

SQLSTATE[HY000]: General error: 3780 Referencing column 'file_id' and referenced column 'fileid' in foreign key constraint 'FK_F0C3D55B93CB796C' are incompatible.

Any clue what to do? Thank you.

This might give you an idea what need to be done:

Deleting all CONSTRAINTS helped me. Thank you. I wasnt so sure about doing this since I was using OC 10.3. In all the other posts there was the talk of OC 10.1.

1 Like

I’m glad to hear it worked for you! For step 4 I also deleted all (I think 2) foreign keys. Since I migrated everything works fine, so I think this isn’t as bad as I initially thought :slight_smile:

Thank you for this guide on how you managed to migrate.
I was able to do the same following your method and can confirm this works for Owncloud 10.3.2.2 to Nextcloud 12.0.13.

I skipped points 5 and 6 however as they did not seem to cause any issues in the upgrade. I did test with those the first time around following your method and setting mtime and storage_mtime to 0 changed all file last change dates to always display “seconds ago”. So the 2nd test run I skipped those steps and had no issues plus the file change history was kept(I imagine setting them to 0 will just default to “now” for NC).

I had to also drop foreign keys from oc_persistent_locks
The following commands were enough in my case to find and remove the FK’s:

SELECT TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = ‘owncloud’ AND REFERENCED_TABLE_NAME = ‘oc_filecache’;
SELECT TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = ‘owncloud’ AND REFERENCED_TABLE_NAME = ‘oc_accounts’;
use owncloud;
alter table oc_persistent_locks drop foreign key FK_F0C3D55B93CB796C;
alter table oc_persistent_locks drop foreign key FK_F0C3D55BC901C6FF;

As an extra note, I was running PHP 7.2 and the PHP check disable steps were not required(I did do them for the initial move from OC to NC but not from NC 12 to NC 13 and further).

You are a supreme genius @Cloudy1 thank you so much for sharing these steps!! I have successfully migrated from owncloud 10.3.3 to 12.0.13 thanks to you. And then incrementally upgrading to each major version until landing on final 18.0.3. Your steps should be an official procedure!

The only notes I would add, is that I did not perform your step #5 and #6 altering mtime and storage_mtime. I skipped these steps and did not encounter any errors.

Additionally, there should be a step 9. that says after each major version upgrade, to login as admin and proceed to the Settings -> Overview page and resolve the items under " Security & setup warnings". I found that after each major version upgrade, there were new configuration items identified here that needed to be implemented.

FWIW my owncloud 10.3.3 instance was running on CentOS 7 with PHP 7.3 remi repo.

Thank you again kind sir!!

1 Like

nice tutorial! Thanks for that.
Did anyone successfully migrate an owncloud 10.4 to nextcloud?

During my attempt, my NC shows me the update screen after I have deactivated the maintenance mode. after it has run through, the same screen appears again…