Can't start Nextcloud because the version of the data is higher than the docker image version and downgrading is not supported

Nextcloud version (eg, 20.0.5): 19.0.3.1
Operating system and version (eg, Ubuntu 20.04): Docker Image 19.0.3.1
Apache or nginx version (eg, Apache 2.4.25): Docker Image 19.0.3.1
PHP version (eg, 7.4): Docker Image 19.0.3.1

The issue you are facing:
I accidentally pulled the v21 docker image while my NC installation was still 19.0.3.1. After noticing the error, I followed the advice from the linked how-to thread Updates between multiple major versions are unsupported - #27 and tried to upgrade to the latest 19.x first to upgrade to 20 and later 21.

Unfortunately I now get the error message Can't start Nextcloud because the version of the data (21.0.0.18) is higher than the docker image version (19.0.9.1) and downgrading is not supported. Are you sure you have pulled the newest image version? in the logs and doesn’t startup at all.

If I try the to go to the v21 Docker image - since the log claims that the data is already v21, the container starts and I get the upgrade to v21 browser page but when I start the upgrade, it fails with Exception: Updates between multiple major versions and downgrades are unsupported.

Is there a way to recover from this?

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => '<removed>',
  'passwordsalt' => '<removed>',
  'secret' => '<removed>',
  'trusted_domains' => 
  array (
    0 => '<removed>',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '19.0.3.1',
  'overwrite.cli.url' => '<removed>',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '<removed>',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'overwriteprotocol' => 'https',
  'mail_from_address' => 'nextcloud',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => '<removed>',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '<removed>',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpname' => '<removed>',
  'mail_smtppassword' => '<removed>',
  'mail_smtpport' => '465',
);

2 Likes

Find a solution for me (same but from version 18): just delete www folder before starting docker.

1 Like

I checked my whole docker volume but couldn’t find a folder named www anywhere.

I managed to get it fixed by restoring /version.php from backup into the container version 19 and then running a manual update via docker-compose exec --user www-data nextcloud php occ -vvv upgrade and then docker-compose exec --user www-data nextcloud php occ maintenance:mode --off.
That got me back to a running v19.
From there I could then pull the v20 docker image and run the upgrade to v20 using the same two commands.

3 Likes

Hey @reibuehl, I’m stuck in a similar situation than you (upgraded accidentally to version 22 from version 20).

Could you explain your fix in more detail?

As I understood you started the old image (version 19 in your case) and restored some version.php file from a backup. But which version.php file was that? The one from version 19? Because that leads to the Can't start Nextcloud because the version of the data is higher than the docker image version error in my case.