Skipped major version 21->23, did not run the updater yet

Okay, after much pain I figured out what was wrong so let me share it in case it will be useful to somebody else.

There is a file version.php mentioned in some answers to similar questions. That file is indeed the key but it is inside the container on the named volume (if you followed the default option mentioned on Github for NC Docker) and your broken NC image (in my case version 21) keeps restarting (shutting down) due to the version mismatch and thus prevents you from connecting to it and changing the file the easy way.

  1. So I had to stop the NC container and create another container that connected to the named volume.
    (I used blank ubuntu image which was not ideal as I had no text editor but worked well enough for rough test. Use what is best for your Docker installation.)

  2. Then I checked the file /var/www/html/version.php and there was the bad data version (23 in my case). Since I didn’t have a backup, I crafted a new file as follows:

version.php for v23

<?php 
$OC_Version = array(23,0,5,1);
$OC_VersionString = '23.0.5';
$OC_Edition = '';
$OC_Channel = 'stable';
$OC_VersionCanBeUpgradedFrom = array (
  'nextcloud' => 
  array (
    '22.2' => true,
    '23.0' => true,
  ),
  'owncloud' => 
  array (
    '10.5' => true,
  ),
);
$OC_Build = '2022-05-19T11:53:28+00:00 e86a773f6e144b07dca4685d905ab1caa5e6d439';
$vendor = 'nextcloud';

my handcrafted version.php for v21

<?php 
$OC_Version = array(21,0,4,1);
$OC_VersionString = '21.0.4';
$OC_Edition = '';
$OC_Channel = 'stable';
$OC_VersionCanBeUpgradedFrom = array (
  'nextcloud' => 
  array (
    '21.0' => true,
  ),
  'owncloud' => 
  array (
    '10.5' => true,
  ),
);
$OC_Build = '';
$vendor = 'nextcloud';
  1. Then I ran NC container with my version 21.0.4 which finally started. However, I was met with a version mismatch error on every app and the NC instance was unusable.
    (Possibly due to me leaving the OC_Build variable empty, others have reported success in this step already when recovering this file from backup.)

  2. Next step was to stop it again and pull a legit update for my version, e.g. 21.0.9. This triggered the update process correctly and after updating a few apps, it launched happily. NC is back on!

  3. I continued with iterative updates and now I am running NC 23 - success! A few things to note:

    • I never ran the update but based on what other people said and the app version mismatch error I got, there should be no difference. The damage is done, hard to recover (mostly because there is no official information) but possible.
    • Every update warned me that it disabled many of my apps but when I signed in, they were all enabled as I had them before.
2 Likes