FreeBSD Updated nextcloud to 26, can't turn off maintenance mode

Bug description

After upgrading to 26.0.3.2, I’ve been stuck in maintenance mode. I tried different ways to remove the maintenance mode (occ, config.php, activate, deactivate), none worked. I tried to find an error, but it looks like the upgrade went fine, I haven’t found anything in logs.

Steps to reproduce

  1. Update 25 to 26 from browser

Expected behavior

To either be able to remove the maintenance mode or get an error message

Installation method

None

Nextcloud Server version

26

Operating system

FreeBSD 13.1

PHP engine version

PHP 8.1.16

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 22 to 23)

Nextcloud Logs

There’s nothing about the update. I only have lines before the update then lines after because I switched to log all.

I have many lines like this one but I suppose this is because it is in maintenance mode.
{"reqId":"TXc47RdoI247retVRIfO","level":1,"time":"2023-07-05T14:55:49+00:00","remoteAddr":"192.xxx","user":"--","app":"no app in context","method":"PROPFIND","url":"/remote.php/caldav/calendars/User/personal/","message":"Unable to generate a URL for the named route \"activity.Activities.showList\" as such route does not exist.","userAgent":"Evolution/3.44.4","version":"26.0.1.1","exception":{"Exception":"Symfony\\Component\\Routing\\Exception\\RouteNotFoundException","Message":"Unable to generate a URL for the named route \"activity.Activities.showList\" as such route does not exist.","Code":0,"Trace":[{"file":"/usr/local/www/nextcloud/lib/private/Route/Router.php","line":380,"function":"generate","class":"Symfony\\Component\\Routing\\Generator\\UrlGenerator","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/Route/CachingRouter.php","line":65,"function":"generate","class":"OC\\Route\\Router","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/URLGenerator.php","line":103,"function":"generate","class":"OC\\Route\\CachingRouter","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/NavigationManager.php","line":320,"function":"linkToRoute","class":"OC\\URLGenerator","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/NavigationManager.php","line":113,"function":"init","class":"OC\\NavigationManager","type":"->"},{"file":"/usr/local/www/nextcloud/apps/theming/lib/ThemingDefaults.php","line":188,"function":"getAll","class":"OC\\NavigationManager","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/legacy/OC_Defaults.php","line":280,"function":"getShortFooter","class":"OCA\\Theming\\ThemingDefaults","type":"->"},{"file":"/usr/local/www/nextcloud/lib/public/Defaults.php","line":176,"function":"getLongFooter","class":"OC_Defaults","type":"->"},{"file":"/usr/local/www/nextcloud/core/templates/layout.guest.php","line":52,"function":"getLongFooter","class":"OCP\\Defaults","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/Template/Base.php","line":180,"args":["/usr/local/www/nextcloud/core/templates/layout.guest.php"],"function":"include"},{"file":"/usr/local/www/nextcloud/lib/private/Template/Base.php","line":150,"function":"load","class":"OC\\Template\\Base","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/legacy/OC_Template.php","line":179,"function":"fetchPage","class":"OC\\Template\\Base","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/legacy/OC_Template.php","line":210,"function":"fetchPage","class":"OC_Template","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/Template/Base.php","line":132,"function":"fetchPage","class":"OC_Template","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/legacy/OC_Template.php","line":298,"function":"printPage","class":"OC\\Template\\Base","type":"->"},{"file":"/usr/local/www/nextcloud/remote.php","line":85,"function":"printErrorPage","class":"OC_Template","type":"::"},{"file":"/usr/local/www/nextcloud/remote.php","line":174,"function":"handleException"}],"File":"/usr/local/www/nextcloud/3rdparty/symfony/routing/Generator/UrlGenerator.php","Line":143,"message":"Unable to generate a URL for the named route \"activity.Activities.showList\" as such route does not exist.","exception":{},"CustomMessage":"Unable to generate a URL for the named route \"activity.Activities.showList\" as such route does not exist."}}

If you run the php occ upgrade command, it runs through and says everything is ok?

And try to update all apps as well:
php occ app:update --all

Can you update apps in maintenance mode?

Yes, I already tried that. No errors.

sudo -u www  php occ app:update --all      

The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php
Additionally the function 'pcntl_signal' and 'pcntl_signal_dispatch' need to be enabled in your php.ini.

➜  nextcloud sudo -u www  php occ upgrade         

The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php
Additionally the function 'pcntl_signal' and 'pcntl_signal_dispatch' need to be enabled in your php.ini.

Nextcloud is already latest version

➜  nextcloud sudo -u www  php occ maintenance:mode --off

The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php
Additionally the function 'pcntl_signal' and 'pcntl_signal_dispatch' need to be enabled in your php.ini.

Maintenance mode already disabled

Edit:

I also tried moving the apps folder elsewhere and put an empty apps folder. Nothing changed except the look of the maintenance page.

Ok it seems everything is fine now!

After I moved the apps folder elsewhere to replace with an empty apps folder (in the nextcloud folder), I’ve reboot. Then after reboot, website wasn’t accessible, but no more maintenance page (don’t know why). I’ve put back the apps folder and now it is working.

1 Like

Excellent, I’m glad you got it sorted :slight_smile:

Sorry I’m late replying, I only just saw your post, and I’m on FreeBSD with Apache, too.

I’ve been collecting handy commands that work on FreeBSD for times just like you had. For future reference, you can use some of the following commands (as root or using sudo):

cd /usr/local/www/nextcloud
su -m www -c “php ./occ maintenance:mode --off”

Also, instead of upgrading via the browser (which can cause issues):

su -m www -c “php ./occ upgrade”

Some other handy commands while you’re in there:

su -m www -c “php ./occ db:add-missing-indices”
su -m www -c “php ./occ db:add-missing-columns”
su -m www -c “php ./occ db:add-missing-primary-keys”
su -m www -c “php ./occ db:convert-filecache-bigint”

Save these, you’ll need them later! All the other guides show commands linux style!

1 Like

I would like to add that if you already has backup schedule in place, like rsync of the data folder, copy of config.php and mysql/pgsql dumps, I highly recommends the occ CLI way of upgrading - both server and apps.
Using the following occ commands in a script, has made it a fixed command for me:

PHPCOMMAND="sudo -u www-data php8.2"
commands[0]="/var/www/nextcloud/updater/updater.phar --no-backup --no-interaction"
commands[1]="/var/www/nextcloud/occ db:add-missing-indices"
commands[2]="/var/www/nextcloud/occ maintenance:mode --off"
commands[3]="/var/www/nextcloud/occ maintenance:data-fingerprint"
commands[4]="/var/www/nextcloud/occ app:update --all"
for i in "${commands[@]}"
do eval $PHPCOMMAND $i
done
systemctl restart php8.2-fpm
systemctl restart apache2

The following is significantly speeding up update process as well as minimizing the risk of updates stalling in one of the steps, which you see several cases of from this community. However I only have the nerves to do this, because I do snapshotting and RSYNC of data, config files, and pgsql dumps to other location before running upgrades.

sudo -u www-data php8.2 /var/www/nextcloud/updater/updater.phar --no-backup --no-interaction

I know your system is a BSD, however besides the paths, sudo flags and chosen user, it is native Nextcloud and should work on any system.

This is only after restoring a backup, where you go back in time, not for updates/upgrades.

True. I do it anyway inkmy own script. Just remove that one if it does not suit your own flavour. :slight_smile: