Mode maintenance après mise à jour / Stuck in maintenance mode after upgrade

Nextcloud version (eg, 20.0.5): 19.0.13.1
Operating system and version (eg, Ubuntu 20.04): DSM 6.2.4 update 7 (synology)
Apache or nginx version (eg, Apache 2.4.25): 2.4
PHP version (eg, 7.4): 5.6.11

The issue you are facing:

I can’t no longer log into my nextcloud server, since I launch the upgrade.

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

Steps to replicate it:

  1. Update from web interface
  2. Block into “Maintenance Mode”
  3. I change the line ‘mantenance’ => false, # in config.php and fall into “server internal error”
  4. When i turn back the line ‘mainteance’ => true, # I keep the same error
  5. I reboot but still get the same error.

The output of your Nextcloud log in Admin > Logging:

{"reqId":"ZhoRBEy38I98uMYOjTdz","level":3,"time":"2020-01-09T12:03:43+00:00","remoteAddr":"192.168.1.29","user":"--","app":"PHP","method":"POST","url":"\/nextcloud\/index.php","message":"mkdir(): Permission denied at \/volume1\/web\/nextcloud\/lib\/private\/Setup.php#302","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko\/20100101 Firefox\/72.0","version":""}
{"reqId":"jVPugeP80cdbgopHkCbt","level":3,"time":"2023-06-02T07:28:58+00:00","remoteAddr":"192.168.1.254","user":"--","app":"PHP","method":"GET","url":"/status.php","message":{"Exception":"Error","Message":"touch(): Utime failed: Permission denied at /volume1/web/nextcloud/lib/private/Config.php#242","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"touch(): Utime failed: Permission denied","/volume1/web/nextcloud/lib/private/Config.php",242,{"content":"<?php\n$CONFIG = array (\n  'instanceid' => 'ocw5cc7isn17',\n);\n"}]},{"file":"/volume1/web/nextcloud/lib/private/Config.php","line":242,"function":"touch","args":["/volume1/web/nextcloud/config/config.php"]},{"file":"/volume1/web/nextcloud/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\Config","type":"->","args":[]},{"file":"/volume1/web/nextcloud/lib/private/SystemConfig.php","line":132,"function":"setValue","class":"OC\\Config","type":"->","args":["instanceid","ocw5cc7isn17"]},{"file":"/volume1/web/nextcloud/lib/private/legacy/OC_Util.php","line":1168,"function":"setValue","class":"OC\\SystemConfig","type":"->","args":["instanceid","ocw5cc7isn17"]},{"file":"/volume1/web/nextcloud/lib/base.php","line":420,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/volume1/web/nextcloud/lib/base.php","line":649,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/volume1/web/nextcloud/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/volume1/web/nextcloud/status.php","line":37,"args":["/volume1/web/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/volume1/web/nextcloud/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0","version":""}
{"reqId":"jVPugeP80cdbgopHkCbt","level":3,"time":"2023-06-02T07:28:58+00:00","remoteAddr":"192.168.1.254","user":"--","app":"PHP","method":"GET","url":"/status.php","message":{"Exception":"Error","Message":"fopen(/volume1/web/nextcloud/config/config.php): failed to open stream: Permission denied at /volume1/web/nextcloud/lib/private/Config.php#243","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"fopen(/volume1/web/nextcloud/config/config.php): failed to open stream: Permission denied","/volume1/web/nextcloud/lib/private/Config.php",243,{"content":"<?php\n$CONFIG = array (\n  'instanceid' => 'ocw5cc7isn17',\n);\n"}]},{"file":"/volume1/web/nextcloud/lib/private/Config.php","line":243,"function":"fopen","args":["/volume1/web/nextcloud/config/config.php","r+"]},{"file":"/volume1/web/nextcloud/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\Config","type":"->","args":[]},{"file":"/volume1/web/nextcloud/lib/private/SystemConfig.php","line":132,"function":"setValue","class":"OC\\Config","type":"->","args":["instanceid","ocw5cc7isn17"]},{"file":"/volume1/web/nextcloud/lib/private/legacy/OC_Util.php","line":1168,"function":"setValue","class":"OC\\SystemConfig","type":"->","args":["instanceid","ocw5cc7isn17"]},{"file":"/volume1/web/nextcloud/lib/base.php","line":420,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/volume1/web/nextcloud/lib/base.php","line":649,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/volume1/web/nextcloud/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/volume1/web/nextcloud/status.php","line":37,"args":["/volume1/web/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/volume1/web/nextcloud/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0","version":""}
{"reqId":"jVPugeP80cdbgopHkCbt","level":3,"time":"2023-06-02T07:28:58+00:00","remoteAddr":"192.168.1.254","user":"--","app":"PHP","method":"GET","url":"/status.php","message":{"Exception":"Error","Message":"chmod(): Operation not permitted at /volume1/web/nextcloud/lib/private/Config.php#246","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"chmod(): Operation not permitted","/volume1/web/nextcloud/lib/private/Config.php",246,{"content":"<?php\n$CONFIG = array (\n  'instanceid' => 'ocw5cc7isn17',\n);\n","filePointer":false}]},{"file":"/volume1/web/nextcloud/lib/private/Config.php","line":246,"function":"chmod","args":["/volume1/web/nextcloud/config/config.php",416]},{"file":"/volume1/web/nextcloud/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\Config","type":"->","args":[]},{"file":"/volume1/web/nextcloud/lib/private/SystemConfig.php","line":132,"function":"setValue","class":"OC\\Config","type":"->","args":["instanceid","ocw5cc7isn17"]},{"file":"/volume1/web/nextcloud/lib/private/legacy/OC_Util.php","line":1168,"function":"setValue","class":"OC\\SystemConfig","type":"->","args":["instanceid","ocw5cc7isn17"]},{"file":"/volume1/web/nextcloud/lib/base.php","line":420,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/volume1/web/nextcloud/lib/base.php","line":649,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/volume1/web/nextcloud/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/volume1/web/nextcloud/status.php","line":37,"args":["/volume1/web/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/volume1/web/nextcloud/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0","version":""}
{"reqId":"jVPugeP80cdbgopHkCbt","level":3,"time":"2023-06-02T07:28:58+00:00","remoteAddr":"192.168.1.254","user":"--","app":"remote","method":"GET","url":"/status.php","message":{"Exception":"OC\\HintException","Message":"Can't write into config directory!","Code":0,"Trace":[{"file":"/volume1/web/nextcloud/lib/private/Config.php","line":134,"function":"writeData","class":"OC\\Config","type":"->","args":[]},{"file":"/volume1/web/nextcloud/lib/private/SystemConfig.php","line":132,"function":"setValue","class":"OC\\Config","type":"->","args":["instanceid","ocw5cc7isn17"]},{"file":"/volume1/web/nextcloud/lib/private/legacy/OC_Util.php","line":1168,"function":"setValue","class":"OC\\SystemConfig","type":"->","args":["instanceid","ocw5cc7isn17"]},{"file":"/volume1/web/nextcloud/lib/base.php","line":420,"function":"getInstanceId","class":"OC_Util","type":"::","args":[]},{"file":"/volume1/web/nextcloud/lib/base.php","line":649,"function":"initSession","class":"OC","type":"::","args":[]},{"file":"/volume1/web/nextcloud/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/volume1/web/nextcloud/status.php","line":37,"args":["/volume1/web/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/volume1/web/nextcloud/lib/private/Config.php","Line":250,"Hint":"This can usually be fixed by giving the webserver write access to the config directory.","CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0","version":""}

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

<?php
$CONFIG = array (
  'instanceid' => 'oc3ljs69sbvb',
  'passwordsalt' => 'jdnFefZKk8uoQLKiXEZHoFJYGmfWR+',
  'secret' => 'qRiqRv12gSreL4bKsuwWSnuKZl4aIjHOFZr4TbSGFZFxeooA',
  'trusted_domains' =>
  array (
    0 => '192.168.XXX.XXX',
    1 => 'XXX.XXX.XXX.XXX',
    2 => '###########.online',
  ),
  'datadirectory' => '/volume1/NextCloud',
  'dbtype' => 'mysql',
  'version' => '19.0.13.1',
  'overwrite.cli.url' => 'https://192.168.XXX.XXX/nextcloud',
  'dbname' => '###########',
  'dbhost' => '127.0.0.1:3307',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_??????????????',
  'dbpassword' => 'oK4XBsWnhSHeCQ143fN67v6Z6dxlMj',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\ArrayCache',
  'maintenance' => true,
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' =>
  array (
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
  'mail_from_address' => '########',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => '########',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.live.com',
  'mail_smtpport' => '587',
  'mail_smtpname' => '###############',
  'mail_smtppassword' => '############',
  'mail_smtpsecure' => 'tls',
  'updater.secret' => '$2y$10$S4SYHz9fFpH7BpChHPPXAe1XYuagqaae9TGKHjZdFgpYG/TFCRieC',
  'theme' => '',
  'loglevel' => 0,
);

I don’t paste the other log from nginx because I don’t think there is relevant informations.

Could you give me a solution to revert back to a previous version or to exit this stuck state please ?
I can add that I can’t use the occ commands because of the version of php which is 5.6.11.
Best regards !

NC13 was the last version that supported php 5.6:
https://docs.nextcloud.com/server/13/admin_manual/installation/system_requirements.html

The errors in your log shows a permission error. Not sure, how this can happen when you use the updater app. However, how did you manage to get close to NC 19 with such an old php version, did you perhaps install a more recent version and that is running as well somewhere?

Use your backup? With some luck the code update was not run either and you can just put the old code again (keeping the configuration and data).

It’s not a good idea to run such old code on your machine. I don’t know your hardware to tell you if it is possible to run newer systems on them.

Hi @tflidd ,

Thanks for your interest.

This is the answer i get when I try to launch an occ command :
“You are currently running 5.6.11. Please update your PHP version”

And I 've made an installation of Nextcloud in 2019 or 2020 with the version nextcloud-16.0.0.zip in my memory. The installation is made on a synology nas and there was some uncompatibility as I remember with the version 17.0.0.2 .

Unfortunately, I haven’t got any backup.

Yes my hardware could support a newer installation. It’s a lack of knowledge and time, that made me look away.

I’ve Php 7.4 on my machine but I don’t succeed in setting this version. It’s what I 've to do as soon as I get out of this issue.

Is there a way to reinstall nexcloud without lost of my data ?

You can go through the requirements and then use a system with php 5.6 and update as far as possible from one major release to the next one. For the NC22 and later, I have done a small table with the compatibilities:

Would be important to know so you can chose a system where it works. If you are so far behind this can become a bit tricky.