Migrating from ownCloud to a NextCloud docker container: "Updates between multiple major versions and downgrades are unsupported"

I am trying to migrate an ownCloud 10.12.0.6 instance to NextCloud 25.0.6.1 - where the NextCloud instance uses the official nextcloud:25 docker image (Apache) using the official guide. However, the guide isn’t exactly clear on what to do when you use the docker image. In any case this is essentially what I tried:

  1. Started the appropriate docker containers.
  2. Copied the content of the data folder from the ownCloud instance to the data folder within the volume of the docker container of the NextCloud image.
  3. Copied the database of the ownCloud instance and imported it into the database within the mariadb docker container that runs alongside NextCloud.

Now, after copying the data, the official guide tells you to follow the steps as if you would update from a previous NextCloud version. Which at this point tells you to run occ upgrade. However, this will not work at this stage:

Nextcloud is not installed - only a limited number of commands are available


  Command "upgrade" is not defined.

Then I tried installing NextCloud regularly, i.e. without copying any data from the ownCloud instance - which works fine - and then reset the database to the state from the ownCloud and exchange the data folder once again with the one from ownCloud.

When I now open the web interface it tells me “App update required” and that I should run ./occ upgrade on the CLI. However this results in the following message:

$ ./occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Turned on maintenance mode
Exception: Updates between multiple major versions and downgrades are unsupported.
Update failed
Maintenance mode is kept active
Resetting log level

The documentation only mentions the following ownCloud versions regarding migration compatibility:

ownCloud NextCloud
10.11.x 25.0.x (but at least 25.0.2)
10.0.5 or later 20.0.x (but at least 20.0.5)

Is my ownCloud version too new?

I have run the command again with -vvv. Here is the content of the data/nextcloud.log:

{"reqId":"iN7r4AeRxT6iGNLgRJvr","level":1,"time":"2023-04-24T09:31:00+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::maintenanceEnabled: Turned on maintenance mode","userAgent":"--","version":"25.0.6.1","data":{"app":"updater"}}
{"reqId":"iN7r4AeRxT6iGNLgRJvr","level":0,"time":"2023-04-24T09:31:00+00:00","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"starting upgrade from 25.0.6.1 to 25.0.6.1","userAgent":"--","version":"25.0.6.1","data":{"app":"core"}}
{"reqId":"iN7r4AeRxT6iGNLgRJvr","level":3,"time":"2023-04-24T09:31:00+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Updates between multiple major versions and downgrades are unsupported.","userAgent":"--","version":"25.0.6.1","exception":{"Exception":"Exception","Message":"Updates between multiple major versions and downgrades are unsupported.","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Updater.php","line":141,"function":"doUpgrade","class":"OC\\Updater","type":"->","args":["25.0.6.1","25.0.6.1"]},{"file":"/var/www/html/core/Command/Upgrade.php","line":225,"function":"upgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/var/www/html/3rdparty/symfony/console/Command/Command.php","line":255,"function":"execute","class":"OC\\Core\\Command\\Upgrade","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":1009,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":273,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["OC\\Core\\Command\\Upgrade"],["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":149,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/lib/private/Console/Application.php","line":214,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/var/www/html/occ","line":11,"args":["/var/www/html/console.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Updater.php","Line":242,"message":"Updates between multiple major versions and downgrades are unsupported.","exception":{},"CustomMessage":"Updates between multiple major versions and downgrades are unsupported."}}
{"reqId":"iN7r4AeRxT6iGNLgRJvr","level":3,"time":"2023-04-24T09:31:00+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::failure: Exception: Updates between multiple major versions and downgrades are unsupported.","userAgent":"--","version":"25.0.6.1","data":{"app":"updater"}}
{"reqId":"iN7r4AeRxT6iGNLgRJvr","level":3,"time":"2023-04-24T09:31:00+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::updateEnd: Update failed","userAgent":"--","version":"25.0.6.1","data":{"app":"updater"}}
{"reqId":"iN7r4AeRxT6iGNLgRJvr","level":1,"time":"2023-04-24T09:31:00+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::maintenanceActive: Maintenance mode is kept active","userAgent":"--","version":"25.0.6.1","data":{"app":"updater"}}
{"reqId":"iN7r4AeRxT6iGNLgRJvr","level":1,"time":"2023-04-24T09:31:00+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::resetLogLevel: Reset log level to Warning(2)","userAgent":"--","version":"25.0.6.1","data":{"app":"updater"}}
{"reqId":"sqvO0FAq0uoWONJzgSdn","level":0,"time":"2023-04-24T11:50:12+00:00","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"starting upgrade from 25.0.6.1 to 25.0.6.1","userAgent":"--","version":"25.0.6.1","data":{"app":"core"}}
{"reqId":"sqvO0FAq0uoWONJzgSdn","level":3,"time":"2023-04-24T11:50:12+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Updates between multiple major versions and downgrades are unsupported.","userAgent":"--","version":"25.0.6.1","exception":{"Exception":"Exception","Message":"Updates between multiple major versions and downgrades are unsupported.","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Updater.php","line":141,"function":"doUpgrade","class":"OC\\Updater","type":"->","args":["25.0.6.1","25.0.6.1"]},{"file":"/var/www/html/core/Command/Upgrade.php","line":225,"function":"upgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/var/www/html/3rdparty/symfony/console/Command/Command.php","line":255,"function":"execute","class":"OC\\Core\\Command\\Upgrade","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":1009,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":273,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["OC\\Core\\Command\\Upgrade"],["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/3rdparty/symfony/console/Application.php","line":149,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/lib/private/Console/Application.php","line":214,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/var/www/html/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/var/www/html/occ","line":11,"args":["/var/www/html/console.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Updater.php","Line":242,"message":"Updates between multiple major versions and downgrades are unsupported.","exception":{},"CustomMessage":"Updates between multiple major versions and downgrades are unsupported."}}
{"reqId":"sqvO0FAq0uoWONJzgSdn","level":3,"time":"2023-04-24T11:50:12+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::failure: Exception: Updates between multiple major versions and downgrades are unsupported.","userAgent":"--","version":"25.0.6.1","data":{"app":"updater"}}
{"reqId":"sqvO0FAq0uoWONJzgSdn","level":3,"time":"2023-04-24T11:50:12+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::updateEnd: Update failed","userAgent":"--","version":"25.0.6.1","data":{"app":"updater"}}
{"reqId":"sqvO0FAq0uoWONJzgSdn","level":1,"time":"2023-04-24T11:50:12+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::maintenanceActive: Maintenance mode is kept active","userAgent":"--","version":"25.0.6.1","data":{"app":"updater"}}
{"reqId":"sqvO0FAq0uoWONJzgSdn","level":1,"time":"2023-04-24T11:50:12+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::resetLogLevel: Reset log level to Warning(2)","userAgent":"--","version":"25.0.6.1","data":{"app":"updater"}}

I suppose this is because the config/config.php now contains a

'version' => '25.0.6.1',

entry. However, simply deleting that won’t help, as this would just result in

$ ./occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug

In Config.php line 266:

  Configuration was not read or initialized correctly, not overwriting /var/www/html/config/config.php


upgrade

So it looks like first installing NextCloud before migrating from ownCloud is not the correct way to do it either. So how do I migrate from ownCloud to a fresh NextCloud instance?

yes.

cc @Andy and @jospoortvliet on that.

Oh darn. I updated our ownCloud instance specifically for the purpose of migrating to NextCloud, as it would have been too old otherwise. But the ownCloud updater of course always updates to the newest version :smile:

That is true. The check also has an upper bound version which then reflects the latest version that we tested an upgrade with to prevent newer versions to be migrated in case they have DB changes that the migration implementation wouldn’t take care of.

Makes sense of course.

Regardless of the issue that my ownCloud version is (currently) too new: what is the correct way of migrating to a new NextCloud instance? Since ./occ upgrade only works once you have “installed” NextCloud, is it correct to go through the regular installation process once and then reset the database and exchange the data folder with the one from ownCloud? The documentation doesn’t specifically mention that.

I personally can’t tell how it works or how that would actually work for containers specifically.

I think the fact that it’s a docker container is irrelevant anyway. Even if you do not use the container and just follow the migration guide while using a new NextCloud instance, the same issue will occur.

After updating the container to 26.0.1 I tried manually editing the version.php to

$OC_Version = array(26,0,1,1);
$OC_VersionString = '26.0.1';
$OC_Edition = '';
$OC_Channel = 'stable';
$OC_VersionCanBeUpgradedFrom = array (
  'nextcloud' => 
  array (
    '25.0' => true,
    '26.0' => true,
  ),
  'owncloud' => 
  array (
-   '10.11' => true,
+   '10.12' => true,
  ),
);

just to see if the migration would work. However I am still getting the same error message. How does NextCloud determine the ownCloud version of the underlying data anyway? (or that it’s from ownCloud at all)

Looking at the code I figured out that it actually uses the core.vendor config + the version config to determine whether the data is from an ownCloud instance (if core.vendor is empty, it is assumed to be owncloud). Hence what I was missing from the migration guide is that you are actually supposed to also use the config.php from your ownCloud instance in the NextCloud instance - i.e. the version in the config.php needs to reflect the version of the ownCloud instance.

Even though I was on ownCloud 10.12, I forced the update anyway by updating the version.php as shown above (conversely you could also just set the version in your config.php to 10.11). I executed

  • occ upgrade
  • occ db:convert-filecache-bigint
  • occ db:add-missing-columns
  • occ db:add-missing-indices
  • occ db:add-missing-primary-keys

and the only error that I encountered was

Updating <oauth2> ...
Repair error: token is not a valid attribute
Updated <oauth2> to 1.14.0

during occ upgrade (which I think I can ignore …).

2 Likes

Currently, ownCloud 10.13.1 is available which is also currently not a supported migration path. Maybe you could include that in your tests for a future nextcloud version.

I expect that soon a lot of people will want to upgrade from the latest owncloud version to nextcloud, because Debian 12 was recently released which has PHP 8.2 by default, and owncloud still insists on staying with PHP 7.4 and has (quote) “currently no planned ownCloud support for any PHP after 7.4”. I conclude that classic owncloud (for PHP) is dead, and I am very happy that I have now migrated to nextcloud :slight_smile: