How to easily fix “This Nextcloud instance is currently in maintenance mode”

This message usually appears when Nextcloud is updating or performing some maintenance tasks. It should disappear after a few minutes or hours, depending on the size and complexity of the update. However, sometimes the update may get stuck or encounter some errors, and the message will persist. In that case, you may need to manually disable the maintenance mode and fix the issue. Here are some possible steps you can try:

  • Connect to your Nextcloud server via SSH and navigate to the Nextcloud folder. For example, if your Nextcloud folder is located in /var/www/nextcloud, you can use the command cd /var/www/nextcloud.

  • Run the command sudo -u www-data php occ maintenance:mode --off to disable the maintenance mode. This command assumes that your web server user is www-data and your PHP executable is php. You may need to adjust these parameters according to your configuration.

  • Check if the web interface is working normally. If not, you may see an error message about some app or file not being replaced correctly. This means that the update process was interrupted or corrupted, and you need to resume or restart it.

  • Run the command sudo -u www-data php occ upgrade to resume or restart the update process. This command will try to fix any issues and complete the update. You may see some messages about the progress or the status of the update. Wait until the command finishes successfully.

  • If the command fails or returns some errors, you may need to manually replace or delete some files or folders that are causing the problem. For example, if the error message says that the app updatenotification was not replaced correctly, you can try to delete the folder /var/www/nextcloud/apps/updatenotification and run the upgrade command again.

  • After the upgrade command finishes successfully, you can check the web interface again. It should be working normally and show the latest version of Nextcloud. You can also run the command sudo -u www-data php occ maintenance:mode --on to enable the maintenance mode again, if you need to perform some other maintenance tasks.

Fix with cPanel

If you are using cPanel to manage your Nextcloud server, you can try the following steps to disable the maintenance mode and fix the issue:

  • Log in to your cPanel account and go to the File Manager section.

  • Navigate to the Nextcloud folder and open the config folder. For example, if your Nextcloud folder is located in /home/username/public_html/nextcloud, you can use the path /home/username/public_html/nextcloud/config.

  • Right-click on the config.php file and select Edit. You may see a pop-up window asking you to confirm the encoding. You can click Edit again to proceed.

  • Find the line that says 'maintenance' => true, and change it to 'maintenance' => false,. Save the file and close the editor.

  • Check if the web interface is working normally. If not, you may need to resume or restart the update process. You can do this by using the Terminal section in cPanel.

  • In the Terminal, navigate to the Nextcloud folder and run the command php occ upgrade. This command will try to fix any issues and complete the update. You may see some messages about the progress or the status of the update. Wait until the command finishes successfully.

  • If the command fails or returns some errors, you may need to manually replace or delete some files or folders that are causing the problem. For example, if the error message says that the app updatenotification was not replaced correctly, you can try to delete the folder /home/username/public_html/nextcloud/apps/updatenotification and run the upgrade command again.

  • After the upgrade command finishes successfully, you can check the web interface again. It should be working normally and show the latest version of Nextcloud.