Maintenance mode updating Nextcloud 19 to 20 through docker

Nextcloud version (eg, 18.0.2): 20.0.0.9 (Official Docker Image)
Operating system and version (eg, Ubuntu 20.04): Centos 8. Docker version 19.03

The issue you are facing:

My Nextcloud is always in Maintenance Mode, even trying to recreate or restart my container.

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

I’ve downloaded Docker’s official image and I tried to update Nextcloud’s version like I always have done before. However, this time the upgrading turned in maintenance mode. If i take a look at container log I can see this error :

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.28.13. Set the 'ServerName' directive globally to suppress this message

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.28.13. Set the 'ServerName' directive globally to suppress this message

[Fri Oct 09 21:35:03.729874 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.11 configured -- resuming normal operations

[Fri Oct 09 21:35:03.729932 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

Below there is my config.php :

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'REMOVED',
  'passwordsalt' => 'REMOVED',
  'secret' => 'REMOVED',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.REMOVED.com',
    1 => '192.168.28.4',
    2 => '192.168.28.254',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '20.0.0.9',
  'overwritehost' => 'nextcloud.REMOVED.com:443',
  'overwrite.cli.url' => 'https://nextcloud.REMOVED.com',
  'overwriteprotocol' => '“https”',
  'dbname' => 'nextcloud',
  'dbhost' => 'REMOVED',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'REMOVED',
  'dbpassword' => 'REMOVED',
  'installed' => true,
  'maintenance' => 'false',
  'loglevel' => 0,
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' => 
  array (
    0 => 'user',
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
    0 => 'admin',
  ),
  'app_install_overwrite' => 
  array (
    0 => 'joplin',
  ),
);

If you need more information, please tell me what logs do you need. So, like I said at the beginning, previously I upgraded my Nextcloud docker instance a lot of times, even to 18 version to 19 without any problem.

I tried to force, like you can see at my config.php, maintenance option to false without success. I executed these commands with no result, too

sudo docker exec --user www-data nextcloud php occ upgrade

and

sudo docker exec -it -u www-data nextcloud bash -c './occ config:system:set overwriteprotocol --value=“https”'

Any solution that you can give me will be welcomed.

Thanks in advanced.

The update servers are extremely slow, if you attempt an upgrade, the download will take longer than php’s timeout, and leave your site in a broken state. The updater should not do that, but nevertheless, it does.

I’ve spent way too much time on broken installs because of this, and have had to restore from backup to get things back.

So, my only option is it restore a previous backup and try it again? is not there an option to force or reinstall the 20v upgrade over my actual state?.

Anyway, thanks for your answer.

Do you have Portainer? Just click on Nextcloud container Recreate and choose latest, and you will get the latest Nextcloud.

Hi @joselito11

Effectively, I manage my little Docker infrastructure with Portainer. I’ve already tried recreate the Nextcloud’s image & container with it without success.

If I am not capable to come up with a solution, I will restore a previous backup, It will be rather tricky because the DB tables has been already updated to the 20V.

Anyway, thanks for the suggestion.

I don’t believe this applies to Docker installations as they update through Docker, not the built-in updater.

I don’t think these are going to be related to your issue.

Have you tried running occ maintenance:mode --off from the container’s shell?

Hello @KarlF12!

I’ve just make
sudo docker exec -it -u www-data nextcloud bash -c './occ maintenance:mode --off
and now my mobile and desktop APP are synchronize with my Nextcloud’s server and other APPS hosted in it like my RSS server and notes are synchronizing too!. However, now I can’t connect through webrowser to my Nextcloud, appears this redirection error:

192.168.28.254 - - [11/Oct/2020:21:51:53 +0200] "GET /%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/%E2%80%9Chttp%E2%80%9D://nextcloud.MYDOMAIN.COM:443/login HTTP/1.1" 302 911 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0"

If I enter directly https://nextcloud.MYDOMAIN.COM/login, appears my login screen correctly.

I’ve tried to change again to my old configuration with this command with the same result:

sudo docker exec -it -u www-data nextcloud bash -c './occ config:system:set overwriteprotocol --value=“http”'

Some idea? I think we’re close!

Thanks for your help, @KarlF12 !

I don’t think overwriteprotocol has anything to do with your issue, and it should not be set to HTTP unless you are not using HTTPS (in other words never). This is probably the reason you are getting the redirect error if your web server is redirecting to HTTPS but then you’ve told Nextcloud to throw it back to HTTP. You should leave it HTTPS or unset the value.

Make sure you clear your browser cache since the cache may not be valid after the page code changes.

Hi @KarlF12

Finally I executed the command below leaving it empty and my Nextcloud instance loaded flawlessly!

sudo docker exec -it -u www-data nextcloud bash -c './occ config:system:set overwriteprotocol --value= ' 

Thanks very much to you and all the people who helped me!