Docker: Accidently upgraded two major versions now cant get the rolled back version to work

I accidently pulled the wrong image when I wanted to upgrade from 22.2.5.1 to 23.0.4. I used the image of 24.0.0. When I tried to roll back I got the following message

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

I found a lot of similar post here and the following walkthrough for a roll-back:

I followed the instructions step by step and also restored the database from a backup. I edited the version.php to look like this:

<?php
$OC_Version = array(22,2,5,1);
$OC_VersionString = '22.2.5.1';
$OC_Edition = '';
$OC_Channel = 'stable';
$OC_VersionCanBeUpgradedFrom = array (
  'nextcloud' =>
  array (
    '21.0' => true,
    '22.0' => true,
  ),
  'owncloud' =>
  array (
    '10.5' => true,
  ),
);
$OC_Build = '2022-05-02T14:34:20+00:00 5f37aacb3194d51503aaa3529ae8f676b32a25d7';
$vendor = 'nextcloud';

I was then able to start up a container on the old image (22.2.5.2). I then tried to upgrade to 22.2.7 or 23.0.4 but was not able to get the upgrade to work:

Timeout while waiting for an ongoing initialization
Initializing nextcloud 23.0.4.1 ...
Upgrading nextcloud from 22.2.5.1 ...
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
Another process is initializing Nextcloud. Waiting 10 seconds...
Another process is initializing Nextcloud. Waiting 20 seconds...
Another process is initializing Nextcloud. Waiting 30 seconds...

Launching the upgrade manually via docker exec -u www-data nextcloud_app_1 php occ upgrade leads to:

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

Any help is greatly appreciated!

When I run docker exec -u www-data nextcloud_app_1 php occ status it says that the DB needs 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
  - installed: true
  - version: 22.2.5.1
  - versionstring: 22.2.5.1
  - edition:
  - maintenance: false
  - needsDbUpgrade: true
  - productname: Nextcloud
  - extendedSupport: false

When switching off maintenance mode the webinterface reports:


Error

    The files of the app Accessibility (accessibility), Activity (activity), Auditing / Logging (admin_audit), Circles (circles), Cloud Federation API (cloud_federation_api), Comments (comments), Contacts Interaction (contactsinteraction), Dashboard (dashboard), WebDAV (dav), Federated file sharing (federatedfilesharing), Federation (federation), Files (files), PDF viewer (files_pdfviewer), Right click (files_rightclick), File sharing (files_sharing), Deleted files (files_trashbin), Versions (files_versions), Video player (files_videoplayer), First run wizard (firstrunwizard), Log Reader (logreader), Lookup Server Connector (lookup_server_connector), Nextcloud announcements (nextcloud_announcements), Notifications (notifications), OAuth 2.0 (oauth2), Password policy (password_policy), Photos (photos), Privacy (privacy), Provisioning API (provisioning_api), Recommendations (recommendations), Monitoring (serverinfo), Nextcloud settings (settings), Share by mail (sharebymail), Support (support), Usage survey (survey_client), Collaborative tags (systemtags), Text (text), Two factor backup codes (twofactor_backupcodes), Update notification (updatenotification), User status (user_status), Viewer (viewer), Weather status (weather_status), Nextcloud workflow engine (workflowengine) were not replaced correctly. Make sure it is a version compatible with the server.

I found the solution: I had the folder /var/www/html mounted in a volume. Deleting that volume, launching nextcloudn 22.2.5.1 and restoring the database did the trick.

1 Like