Upgrading Nextcloud from legacy system with 15.0.14 to 15.0.14 shows major version error…

System before

I did have a system with Debian 9 (stretch), which according to information online onyl had PHP 7.0.

Nextcloud refused to upgrade, as it required a newer PHP version, which is fair enough.

As far as I could find out it’s version 15 Nextcloud is running, because the linked changelog states:

PHP 7.0 is end of life (server#12830)

Also, I checked the file version.php of the source code I was running and it shows:

<?php 
$OC_Version = array(15,0,14,1);
$OC_VersionString = '15.0.14';
$OC_Edition = '';
$OC_Channel = 'stable';
$OC_VersionCanBeUpgradedFrom = array (
  'nextcloud' => 
  array (
    '14.0' => true,
    '15.0' => true,
  ),
  'owncloud' => 
  array (
  ),
);
$OC_Build = '2019-12-19T08:25:02+00:00 dd0b38876d11d81776c9e12bdcc31142059a983e';
$vendor = 'nextcloud';

So, given I want a clean upgrade I switched to a containeraized version with Docker (in my case Podman) and to do an step-by-step upgrade afterwards.

New system

At least for the upgrade, I decided to containerize the systemn. This way, I could also easily use Nextcloud 15, where I have left of to upgrade stuff.

So here is the start of my docker-compose.yml:

version: '3.7'
services:
  nc:
    image: nextcloud:15.0.14-apache
    restart: always
    ports:
    # …
    volumes:
      - nc_data:/var/www/html
      - type: bind
        source: /var/mnt/[…]/nextcloud
        target: /var/mnt/[…]:Z # yes this is correctly adjusted in the settings
      - type: bind
        source: ${HOME}/nextcloud_config
        target: /var/www/html/config:Z

If you wonder about :z prefixes etc., it’s because I use SeLinux and Podman, does not matter here though.

Everything else is just default stuff.

I then restored the database (MySQL/MariaDB) and adjusted the config.

I also got the update log still there, which seems to bake my idea that this is v15.0.14:

updater.log
2020-05-06T15:35:30+0000 dckpZHvmew [info] updater cli is executed
2020-05-06T15:35:30+0000 dckpZHvmew [info] currentStep()
2020-05-06T15:35:30+0000 dckpZHvmew [info] current version: 15.0.14 build time: 2019-12-19T08:25:02+00:00 dd0b38876d11d81776c9e12bdcc31142059a983e
2020-05-06T15:35:30+0000 dckpZHvmew [info] getUpdateServerResponse()
2020-05-06T15:35:30+0000 dckpZHvmew [info] updaterServer: https://updates.nextcloud.com/updater_server/
2020-05-06T15:35:30+0000 dckpZHvmew [info] releaseChannel: stable
2020-05-06T15:35:30+0000 dckpZHvmew [info] internal version: 15.0.14.1
2020-05-06T15:35:30+0000 dckpZHvmew [info] updateURL: https://updates.nextcloud.com/updater_server/?version=15x0x14x1xxxstablexx2019-12-19T08%3A25%3A02%2B00%3A00+dd0b38876d11d81776c9e12bdcc31142059a983ex7x0x33
2020-05-06T15:35:30+0000 dckpZHvmew [info] getUpdateServerResponse response: Array
(
    [version] => 16.0.10.2
    [versionstring] => Nextcloud 16.0.10
    [url] => https://nextcloud.com/outdated-php-7-0/
    [web] => https://nextcloud.com/outdated-php-7-0/
    [changes] => https://updates.nextcloud.com/changelog_server/?version=16.0.10
    [autoupdater] => 0
    [eol] => 0
)

2020-05-06T15:35:30+0000 dckpZHvmew [info] checkForUpdate() Array
(
    [version] => 16.0.10.2
    [versionstring] => Nextcloud 16.0.10
    [url] => https://nextcloud.com/outdated-php-7-0/
    [web] => https://nextcloud.com/outdated-php-7-0/
    [changes] => https://updates.nextcloud.com/changelog_server/?version=16.0.10
    [autoupdater] => 0
    [eol] => 0
)

2020-05-06T15:35:30+0000 dckpZHvmew [info] end of checkForUpdate() Update to Nextcloud 16.0.10 available. (channel: "stable")<br /><span class="light">Following file will be downloaded automatically:</span> <code class="light">https://nextcloud.com/outdated-php-7-0/</code><br />The updater is disabled for this update - please update manually.

Upgrade

Surprisingly, it showed me the upgrade screen, when I accessed the system and I could not do the actual upgrade. After all, AFAIK/IIRC there should also be nothing to upgrade.

Also the occ command does not work:

[c-nextcloud@minipure nextcloud_config]$ podman exec --user www-data -it nextcloud_nc_1 php 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
Set 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
Reset log level

Though, it does tell me the Nextcloud version is already v15.0.14:

$ podman exec --user www-data -it nextcloud_nc_1 php occ --version
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 15.0.14
$ podman exec --user www-data -it nextcloud_nc_1 php occ check
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

What do i miss here and why does Nextcloud try to upgrade from it’s own version to the same version and even claims it is a major update, which it is not.

Is it the database?

Okay, maybe it was some outdated database backup?

Though the backup date is 2020-12-24, which is long after the upgrader tried the last upgrade and thus it has to be v14 already.
Or just to be sure, is there a way to find out which Nextcloud version a database backup used? Is there some table, where this is printed, e.g.?

Does anyone have any idea?

Okay, in the end I tried everything and could not make it work.

As I however knew nothing is there/needed to be updated I went the way of adjusting the source code (in /var/www/html/lib/private/Updater.php) to ignore that error message and it successfully did the “upgrade” (it changed nothing as far as I could see).

Only then I could do the actual upgrade dumps of bumping +1 version etc. etc.
Thanks for that idea to this older forum thread.