Stuck in Maintenance mode, though according to config file not

Nextcloud version 19.0.2 - same issue with
Operating system and version unknown Linux
Server version: Apache/2.4.46 (Unix)
PHP 7.3.21

I cannot get beyond the maintenance notification. Even though the config file, in the correct folder, defines maintenance as false.

I have tried to upgrade today to newer versions. I failed. I tried to restore - restore old sql database and reinstall Occ commands works in terms of setting maintenance true/false - it changes the config file correctly. However, it does not get me a running server.

I have been using nextcloud for years, this is the first time, this happens.

Happy to look for more information, but am not sure where or what to look for. I have no idea how to replicate; it does not make difference whether I upgrade or restore htdocs and sql database.

Is this the first time you’ve seen this error? yes

Not sure whether this matters:

on the web access getting to /updater/ provides me with


To login you need to provide the unhashed value of "updater.secret" in your config file.

If you don't know that value, you can access this updater directly via the Nextcloud admin screen or generate your own secret:
php -r '$password = trim(shell_exec("openssl rand -base64 48"));if(strlen($password) === 64) {$hash = password_hash($password, PASSWORD_DEFAULT) . "\n"; echo "Insert as \"updater.secret\": ".$hash; echo "The plaintext value is: ".$password."\n";}else{echo "Could not execute OpenSSL.\n";};'

but entering the secret does not get a login.

I also tested removing the config.php file. And, as expected, I am then asked to install a system. So, it is the correct file, I am handling.

Meanwhile, I have dropped the database, and restored it from scratch. No difference.

Question: might maintenance information be stored somewhere else?

The output of your Nextcloud log in Admin > Logging:
not accessible

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

  'dbtype' => 'mysql',
  'version' => '',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'logtimezone' => 'UTC',
  'installed' => true,
  'default_language' => 'de',
  'theme' => '',
 'filelocking.enabled' => true,
  "log_type" => "file",
  "logfile" => "nextcloud.log",
  "loglevel" => 3,
  "logdateformat" => "F d, Y H:i:s",
  'loglevel' => 0,
  'log.condition' => [
        'apps' => ['admin_audit'],
  'maintenance' => 'false',
  'loglevel' => 0,
  'maintenance' => 'false',
  'defaultapp' => 'calendar',
  'knowledgebaseenabled' => false,
  'trashbin_retention_obligation' => 'auto, 50',
  'log_rotate_size' => '10 MiB',
  'htaccess.RewriteBase' => '/',
  'appstore.experimental.enabled' => true,
  '' => 'stable',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_domain' => '',
  'mail_smtpauth' => 1,

  'app_install_overwrite' => 

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


Stupid question: did you try in private mode or by clearing cache? I do remember a similar situation after upgrade, but was something like that


Thanks, I like the question, had not thought about it. However, that was not the solution. I tried with a different browser - and no difference can be observed.

1 Like

AFAIR nextcloud can only have state stored in the db or files. There is just nothing else. So if you have restored your files (i guess this is what you call htdocs?) and your db it should work like before. Therefore i assume that you didn’t do one or the other properly.

Check the logfile in /path/to/nextcloud/data/nextcloud.log. it should provide you with more info to work on.


Hi ilippert,
please try this to get beyond the maintenance mode screen. Oddly this issue has been around since NextCloud 12 and we spent a fair amount of time to find the solution, too. Same issue occurs also in docker when installing a fresh instance or upgrading. This solution was found in the German NextCloud forum.

On a regular/local server enter these two commands:
chmod 700 occ
sudo -u www-data ./occ config:system:set overwriteprotocol --value="https"

If your NextCoud is runing on Docker it’s just one command:
docker exec -it -u www-data NAME_NEXTCLOUD_CONTAINER bash -c './occ config:system:set overwriteprotocol --value=“https”'

Reference to the original German post with solutions in last two posts of the thread: Zugriff gewähren lädt ohne Ende

Thanks for this pointer. It does not solve the issue. Hmm, should I now “unset” the command that you recommended?

1 Like

Thank you for your message. Your opening seems to imply that the database db might actually store maintenance information. Where/which table would it store that in the db? I would like to check up on that.

1 Like

No, what I meant is that if you restored the db and the files then Nextcloud should work as before, because nothing else has state (your browser excluded, which should not be a problem).

I am not sure but think that the db does not store whether Nextcloud is in maintenance mode or not, at least it does not contain the word “maintenance”.

Before you do anything else, I strongly suggest that you check the nextcloud log file. See my previous post for its location.

1 Like

Thank you for clarifying.

ok, I have now found an error in the log file

Base table or view not found: 1146 Table 'db.oc_appconfig' doesn't exist",{"errorInfo":["42S02",1146,"Table 'db.oc_appconfig' doesn't exist"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"}]}

might this cause the trouble? It may be the effect of a failed upgrade.

Actually a table oc_appconfig with content does exist in the db.

elsewhere I learn, Index oc_activity is corrupted.

1 Like

I note Table 'nextcloud.oc_appconfig' doesn't exist | Internal Server Error but I am not sure how this might help me.

1 Like

AFAICS this table is mandatory. You need to provide more of the log file. You are posting one line which makes it hard to see whether other things have gone wrong.

Since your table is missing, you have not restored the db properly. I suggest, to use your backups to return to a working state and try to update again from there.

1 Like

I pasted the log here

1 Like

I do see the table in phpMyAdmin. So it cannot be missing.

with respect to the index corrupted I get confused, because

> check table oc_activity;
| Table                    | Op    | Msg_type | Msg_text |
| db_name.oc_activity | check | status   | OK       |

Are you sure? Try to run:

SELECT * FROM oc_appconfig;
1 Like

the SELECT command works on oc_appconfig shows 262 rows in my db.

I note that in the table the core information is wrong

| core                      | lastupdateResult                       | {"version":"","versionstring":"Nextcloud 19.0.4","url":"https:\/\/\/server\/releases\/","web":"https:\/\/\/server\/19\/admin_manual\/maintenance\/upgrade.html","changes":"https:\/\/\/changelog_server\/?version=19.0.4","autoupdater":"1","eol":"0"}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

ok, so the database backup that I use was initiated after trying to install 19.04. but that install was aborted… Also, also, the maintenance stuck issue is still the case, even if I upgrade to 19.04. or even to 20.

Should I provide the details of the oc_appconfig table?

I am running in to the same issue with the MSQL upgraded issue. I am upgrading form 19.02 to 19.03. The error I am runinning in to see a Attachment. I really don want to delete my nextcloud where I am now just to keep up with a new up grade. Can some one look at the error attached and my be let me know what I should do next.


AFAICS you have changed the database backup version between your posts, so i don’t know the current state. As I have said, you need to restore the state of db that matches your files. I am assuming that you have backups of dbs for the different versions of NC.

Find out what NC version your current db belongs to. Find out which version of files you are using in config/config.php and compare them. I am not sure about config.php, maybe it was already changed although the update didn’t finish.

I just remembered this: Check /var/www/nextcloud/data/updater-…/ for backups of NC files.

If you can’t do that at this point its probably easier to reinstall Nextcloud and let it scan files again. I don’t know what other apps and data you have except files.

Also, it is hard to understand what you are writing. If English is not your native language, i suggest you post in one of the international channels here.

good luck

The above has worked on all previous instances on docker compose, sorry it seems not to work on your bare metal and for NextCloud v20.

With some help of a friend we have figured out that you need to turn off the maintenance mode in ~/config.php manually. It should reside in /var/www/html/config/config.php

Open with your favourite text editor.

You will find a line:

’maintenance’ => true,

this needs to be changed to

’maintenance’ => false,

Save and exit.

You can probably do it with a command like this, too:

sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off

But I suggest to change it manually.

For reference to those running NextCloud in a docker image (our setup is using nextcloud:fpm-alpine docker container) here it worked to do:

docker exec -it -u www-data YOUR_DOCKER-CONTAINER_ID sh -c ‘php ./occ maintenance:mode --off’

Hopefully this will also work on your end!

Final note: your config.php looks corrupted as the line ‘maintenance’ shows up twice. Maybe a clean install will help a lot and then move your backed up data in again.

1 Like