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: Nextcloud - Migration guide, 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


Thanks a lot, migrating from 10.3 to 12.0.13 worked great using this guide - except for encryption. Leaving this comment for others that may be about to step into the same trap.

For me, after the migration I got “Invalid signature” exceptions when accessing files. I had server side encryption enabled, and apparently, the migration breaks it.

So better turn off server side encryption before migrating.

For those who already have their installation messed up: for me, it worked to disable signature checks by setting encryption_skip_signature_check => true in the config.php and executing update oc_filecache set encrypted = 1 where storage = '1' AND encrypted=0 AND mimetype != '2' and PATH LIKE "files/%" on the database to mark all files as encrypted (disabling encryption and having nextcloud decrypt files didn’t work otherwise - almost all encrypted files were actually not encrypted until I marked them as encrypted in the DB using the statement above).

Sources that helped me:


Good luck! And @Cloudy1 - thanks a bunch, saved my day despite the difficulties. In the end, I am now finally running nextcloud 18. =)

1 Like

Yeah, I successful migrated ownCloud 10.5 to Nextcloud. For more information have a look at this blog article:

[How-to] Migrate ownCloud 10.5.0 to Nextcloud

1 Like

hello, I want to migrate data from my owncloud 10.5 to nextcloud 20 on a share hosting.

I created a new site nextcloud on a new subdomain closed to the Owncloud one in my own domain
I’ve ssh acces.
i already migrate shedduler and contacts (by a simple export-import) and already run and use apps (deck, tasks
)
for migrate files (data folder) faster than a simple sync with new folder on my pc,
I want to run a ssh command like this
cp -r /owncloud/.XXXXXXX.data/YYYYYY/* /nextcloud/.XXXXXXX.data/YYYYYY
(where Y is my username)
am I right ?
Should I migrate something in the database too?
thanks

version francaise
bonjour,
je migre mon instance owncloud 10 vers une autre de nextcloud 20.
je suis sur un hebergement mutualisĂ© (infomaniak) ou j’ai deja un sous domaine avec owncloud et un nouveau sous domaine avec nextcloud.
j’ai un acces ssh
j’ai deja exportĂ©/importĂ© mon agenda et contacts et utilise nextcloud avec des applis (taches, deck
)
je voudrais transferer rapidement mon fichier de donnĂ©es (data folder) d’owncloud vers l’emplacement de nextcloud. (sans passer par la synchronisation des dossiers de l’ordi)
je voudrais le faire en ligne de commande :
cp -r /owncloud/.XXXXXXX.data/YYYYYY/* /nextcloud/.XXXXXXX.data/YYYYYY
(oĂč Y est mon nom d’utilisateur)
ai-je bon ?
faudra t-il que j’intervienne aussi sur la base de donnĂ©es ?
merci de vos réponses

after manually copying files to the data folder you have to run the scan command, so nextcloud knows the files exist: Using the occ command — Nextcloud latest Administration Manual latest documentation
I originally upgraded to nextcloud using the updater scripts, so I don’t know if there is anything else you have to consider. If you don’t miss any settings or shared links it’ll probably be fine though