24 April 2022

NextCloud stuck in Maintenance Mode

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”.

23 April 2022

Reset NextCloud administrator password

If you ever forget your admin password, hopefully, you have someone else who is an administrator that can reset it for you. If that is not an option, then the worst-case scenario is that you can log into the server that is hosting your NextCloud and reset the password via the command line with the occ command.

sudo -u www-data php /var/www/nextcloud/occ user:resetpassword admin
Enter a new password:
Confirm the new password:
Successfully reset password for admin
The "www-data" user is going to be the user you have setup as your web service that run NextCloud. If you followed my post about setting up NextCloud, or if you are running on RHEL/CentOS/Fedora, that that user is going to be "apache". 

If your Nextcloud username is not "admin", then substitute the username that you setup as your Nextcloud admin.