Docker upgrade from v15 to v18

Hi, i was trying upgrad my nextcloud installation from v15 to v18 in an docker container.

Until now i thought i can do this with my command:

docker stack deploy “stackname” -c /var/data/docker-compose/nextcloud/docker-compose.yml

In the compose file is only meantioned nextcloud:latest which should install me this:

  • [ 18.0.0-apache , 18.0-apache , 18-apache , apache , 18.0.0 , 18.0 , 18 , latest ]
  • My database is an mariadb:10 container.

The installation is showing me this now:

Internal Server Error
The server encountered an internal error and was unable to complete your request.

After this i tried to repair this in the command line with:

sudo -u www-data php occ upgrade

This is showing me:

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
Set log level to debug
Exception: Updates between multiple major versions and downgrades are unsupported.
Update failed
Maintenance mode is kept active
Reset log level

I found an repair option but this is not working because it seems some tables are missing:

root@xx:/var/www/html# sudo -u www-data php occ maintenance:repair
Output:

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

In AbstractMySQLDriver.php line 42:

An exception occurred while executing ‘SELECT filecache.fileid, storage, path, path_hash, filecache.parent, name, mimetype, mimepart, size, mtime, storage_mtime, encrypted, etag, permissions, checksum, metadata_etag, creation_time, upload_time FROM filecache filecache LEFT JOIN fi lecache_extended fe ON filecache.fileid = fe.fileid WHERE (storage = ?) AND (path_hash = ?)’ with params [2, “e13df7347672d0e202590220c2c48cbe”]:

SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextcloud.filecache_extended’ doesn’t exist

In PDOStatement.php line 119:

SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextcloud.filecache_extended’ doesn’t exist

In PDOStatement.php line 117:

SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextcloud.filecache_extended’ doesn’t exist

maintenance:repair [–include-expensive]

root@xx:/var/www/html# sudo -u www-data php occ -V
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
Nextcloud 18.0.0

Do you have a tip for me how i can fix my data?

Hallo @bud to my experience and informations, you should always upgrade from one major to the next, because the DB upgrades are to heavy to jump over 2 or more majors releases
Therefore you should
15 -> 16 (newest version)
16 -> 17 (newest version)
17 -> 18 (newest version)
cause else it would not work for sure(!)

He Hartmut,

thx for the answer. Yes that is true. Makes sense. Now after I did it wrong i remember that I read something like this. I tried to load the v15 container again to push it through the major versions. But the system told me the data are already to v18 and a downgrade is not supported.

What options do I have now?

Best Option - import the newest DB backup/dump.
Worst option/hack - change the version number in the database - but this can destroy the data! So this would be the best time to perform a new DB dump :wink:

:thinking: Never did an DB backup import. So I have to search for an instruction for this.

But one more question here. Are you suggesting to import the backup before upgrading and afterwards step through the major versions?

If the backup is done with version 15 (before the upgrade) this would be the best option. Then you can start again without any hacks.

I restored my database image with:

mysql -h db -u root -p < /dump/dump_09-02-2020_23_11_48.sql

My nextcloud container do not want to come up:

Can’t start Nextcloud because the version of the data (18.0.1.3) is higher than the docker image version (15.0.14.1) and downgrading is not supported. Are you sure you have pulled the newest image version?

Is there a table in the database showing which version of nextcloud this is? (Maybe my backup restore was not successful)

Was there a data structure change between 15 and 18? For example the config.php is stating that this is still nextcloud 15.

Okay it seems the database was not the problem. I had to delete all files from my html folder and copy a fresh version of v15 files to it to get the nextcloud container working again. thx for your input hartmut.
best regards bud