I recently updated my home install of NextCloud right before I went to bed, and when I checked it the next day it was stuck in maintenance mode. Ugh… Thankfully it is easy enough to fix, but you will have to log onto the server to run an occ command from the command line.
The first thing you should try is completing the upgrade with this command.
sudo -u www-data php /var/www/html/nextcloud/occ upgrade
If the upgrade is completed and you are still in maintenance mode, then here is how to turn maintenance mode off.
sudo -u www-data php /var/www/html/nextcloud/occ maintenance:mode --off
Note: If you are on RHEL/CentOS/Fedora you will need to update the “www-data” user to your HTTP user, which should be “apache”.