How to fix "This Nextcloud instance is currently in maintenance mode, which may take a while."

nc
Nextcloud installed at /www/wwwroot/nextcloud/
LNMP in use
Debian 9
Owner: www

I have try use:
cd /www/wwwroot/nextcloud
sudo -u www php occ maintenance:mode --off

return:
-bash: sudo: command not found

php occ maintenance:mode --off

return:
Console has to be executed with the user that owns the file config/config.php
Current user: root
Owner of config.php: www
Try adding 'sudo -u www ’ to the beginning of the command (without the single quotes)

How i can do?

2 Likes

nano /www/wwwroot/nextcloud/config/config.php
Try to edit the config.php:

change
'maintenance' => true,
to
'maintenance' => false,

strg + o
strg + x

service apache2 restart

3 Likes

Apache restart should not be needed, but that’s it.

Also the occ command should work.

Do the following to install sudo:
apt install -y sudo
Then the command you tried should work:
sudo -u www php /www/wwwroot/nextcloud/occ maintenance:mode --off

3 Likes

enmmmm…
very strange to install sudo

apt install -y sudo
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
sudo
0 upgraded, 1 newly installed, 0 to remove and 18 not upgraded.
Need to get 0 B/1055 kB of archives.
After this operation, 3108 kB of additional disk space will be used.
dpkg: unrecoverable fatal error, aborting:
unknown group ‘smmsp’ in statoverride file
E: Sub-process /usr/bin/dpkg returned an error code (2)

And I have try to edit the config.php change to FALSE
but when after I refresh the page, the config.php will be changed back to TRUE.

Very strange, was searching a bid and found that manually removing the offending entry is a workaround. But the question indeed is how this stage could have occurred: https://askubuntu.com/a/522241

  • Better do backup first, in case of errors: cp -a /var/lib/dpkg/statoverride ~/statoverride.bak
  • Fix in your case would be: sed -i '/smmsp/d' /var/lib/dpkg/statoverride

Then retry sudo install.

Strange as well. When did this occur the first time? Did you do some upgrade or just fresh NC install? Perhaps somehow NC thinks it’s still in update process or what and automatically re-enables maintenance for this reason. In that case I think it’s possible to reset the updater stage, but need to digging this out again.

I am try to upgrade NC from 14 to 14.0.1. NC has take one an half hour. and still in maintenance mode.

Ah okay, then the updater needs to be reset. There was a way to do so, but I couldn’t find the related post so far.
Annoying that it resets maintenance mode by itself :thinking:.

Anyway you should install sudo to allow occ and command line update.
Did you try the steps above to fix sudo install?

Yep, I think your solution is useful.

root@:~# cp -a /var/lib/dpkg/statoverride ~/statoverride.bak
root@:~# sed -i ‘/smmsp/d’ /var/lib/dpkg/statoverride
root@:~# apt install -y sudo
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
sudo
0 upgraded, 1 newly installed, 0 to remove and 18 not upgraded.
Need to get 0 B/1055 kB of archives.
After this operation, 3108 kB of additional disk space will be used.
Selecting previously unselected package sudo.
(Reading database … 70574 files and directories currently installed.)
Preparing to unpack …/sudo_1.8.19p1-2.1_amd64.deb …
Unpacking sudo (1.8.19p1-2.1) …
Setting up sudo (1.8.19p1-2.1) …
Processing triggers for systemd (232-25+deb9u4) …
Processing triggers for man-db (2.7.6.1-2) …

Thank you.

2 Likes

Perfect!!!

worked like a charm

excellent works perfectly

You can run these commands without installing sudo. I stopped posting my content on this forum because I can never find it. If you want some examples using su and docker exec, please check out my poorly maintained blog :slight_smile:

https://blog.lukebtaylor.com/posts/nextcloud-issuing-occ-commands-without-installing-sudo/

PLEASE HELP! I have looked all over this site trying to get my NC out of maintenance mode, with no luck. My config.php file has no option for ‘maintenance’ => true, and the rest of what you guys are talking about is like Russian to me. I have directadmin as my control panel, could someone please give me baby steps on exactly what to do to get it out of maintenance mode. Keep in mind that my knowlege on computers in mostly on Word, so I need baby steps. When I am in my directadmin, what do i click on, how to the occ works and what to do.