Restore from backup after failed upgrade

While trying to upgrade from nextcloud 27.1.9 to 28.0.5 (as recommended in admin settings) I have crashed my nextcloud installation. I used the occ manual method and it failed because I was going from one major release to the next but I thought that was OK because it was the next recommended step. My mistake!
I made a backup on 29/4/24 of my data directory, my SQL database and my config file. At this point I was running nextcloud 26.0.13. I misunderstood the ‘backup’ section of the manual and I can see now that I ought to have backed up my ‘themes’ directory and my whole ‘config’ directory. In future I will backup my whole nextcloud directory, my database and my data directory!
Is it possible to ‘go back’ to 26.0.13 with the backup I have? I think it is from what the manual says but I don’t see how to retrieve themes and the rest of the config directory. I still have my nextcloud 27.1.9 directory. If so, what are the basic steps I need to take?
If possible I would like to get to nextcloud 28.0.5. For one thing, I have upgraded to php 8.2 from 8.0. I have php 8.3 ready to go but it is not compatible with nextcloud 27.1.9
Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

[/details]

Nextcloud version (eg, 20.0.5): 27.1.9 when last working correctly
Operating system and version: Ubuntu 22.04 server
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.59 (Ubuntu)
PHP version (eg, 7.4): 8.2 fpm

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N):

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:

PASTE HERE

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

<?php
$CONFIG = array (
  'instanceid' => xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx,
  'trusted_domains' =>
  array (
    0 => '192.168.xxx',
    1 => 'xxx',
    2 => 'xxx',
    3 => 'fxxx',
    4 => 'xxx',
    5 => 'xxx',
  ),
  'trusted_proxies' =>
  array (
    0 => '192.168.xxx',
    1 => 'xxx',
    2 => xxx',
  ),
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'default_phone_region' => 'xx',
  'filelocking.enabled' => true,
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => xx,
    'password' => '',
    'timeout' => 0.0,
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'datadirectory' => '/nextcloud',
  'dbtype' => 'mysql',
  'version' => '26.0.13.1',
  'overwrite.cli.url' => 'http://192.168.xxx/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxx',
  'dbpassword' => 'xxx',
  'installed' => true,
  'theme' => '',
  'loglevel' => 2,
  'maintenance' => false,
  'enable_previews' => true,
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
    2 => 'OC\\Preview\\TIF',
    3 => 'OC\\Preview\\TIFF',
    4 => 'OC\\Preview\\GIF',
    5 => 'OC\\Preview\\BMP',
    6 => 'OC\\Preview\\XBitmap',
    7 => 'OC\\Preview\\Movie',
    8 => 'OC\\Preview\\PDF',
    9 => 'OC\\Preview\\MP3',
    10 => 'OC\\Preview\\TXT',
    11 => 'OC\\Preview\\MarkDown',
    12 => 'OC\\Preview\\JPG',
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'xxx',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpport' => '587',
  'mail_from_address' => 'xx',
  'mail_domain' => 'xxx',
  'mail_smtpsecure' => 'tls',
  'mail_smtpauth' => 1,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpname' => 'xxx',
  'mail_smtppassword' => 'xxx',
  'app_install_overwrite' =>
  array (
    0 => 'gpxedit',
    1 => 'folderplayer',
  ),
);

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

PASTE HERE


Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

PASTE HERE

Why do you want go back to 26 - I assume your update to 27 was successful?

I don’t expect config to change dramatically - likely you can use your 27 config together with 26 backup (adopt versions inside the files).
Themes is AFAIK only visual - I don’t think you need this to bring the service back online.

Maybe this helps you to make the system work without extra step through nc26

  • Find your old version in config/config.php
  • Put that version everywhere in version.php
  • Roll back the docker image to that old version
  • Upgrade the image one major version at a time
  • Turn off maintenance mode

from: https://github.com/nextcloud/docker/issues/617#issuecomment-742750405

The usually correct call for the upgrade is

sudo -u www-data php /path/to/nextcoud/updater/updater.phar

Upgrade via built-in updater — Nextcloud latest Administration Manual latest documentation

Backup and Restore

1 Like

Thank you. That was very helpful. I am now back to my 27 config.
However, I am still a bit unsure to get to 28. My admin settings say:

Update

A new version is available: Nextcloud 28.0.5

That suggests 28.0.5 is the next step. Is this true, as I can’t find any minor updates between 27.1.9 (where I am now) and 28.0.5 (where I want to be). I guess I’m not looking in the right places?

Am I right in thinking 27.1.9 is the last release for Nextcloud 27 so, my next step is to go to 28.0.0 and then on to all minor releases to 28.0.5?

No. 28.0.5 is correct. Use my command above.

Thank you very much. The command worked perfectly and I’m now on 28.0.5 :grinning: