Nextcloud Snap Stuck in Maintenance Mode: Safe Fix

Software

Terminal showing Nextcloud Snap maintenance checks

If Nextcloud Snap is stuck in maintenance mode, users may see a maintenance message instead of the login page after an upgrade or interrupted restart. The most common cause is an upgrade or maintenance task that did not finish cleanly, leaving Nextcloud’s maintenance flag enabled.

Why this happens

Maintenance mode blocks normal access while Nextcloud changes files or updates its database. The flag can remain on after an interrupted operation, but clearing it before the underlying task is safe can expose an incomplete upgrade.

  • A snap refresh or Nextcloud upgrade was interrupted, or its post-upgrade steps are still running.
  • The server ran out of disk space or had a database issue during the operation.
  • The maintenance flag remains enabled in Nextcloud configuration even though the task has ended.

1. Check whether an upgrade is still running

Connect to the server hosting the snap and run snap changes. Look for a change related to Nextcloud with a status such as “Doing.” Use snap tasks <change-id> with its ID to inspect progress and errors. If a task is active, let it finish; do not disable maintenance mode while the change is underway. A completed change with no active Nextcloud tasks means you can continue investigating.

2. Check the snap and service status

Run snap services nextcloud to see whether the Nextcloud services are enabled and active. Then check recent snap activity with snap changes and inspect system logs with sudo journalctl -u snap.nextcloud.* --since "1 hour ago". If your system does not accept the wildcard unit, list matching units with systemctl list-units 'snap.nextcloud*' and query the relevant service. Errors or inactive services point to a service problem to resolve before changing the maintenance flag.

3. Confirm there is enough disk space

Run df -h and review the filesystems that hold the snap data and database. Also check inode availability with df -i. A full filesystem or exhausted inodes can stop an upgrade or database write. Free space using your normal server maintenance process, then check the logs and services again; a successful task and healthy services are signs to proceed.

4. Check Nextcloud’s status and maintenance setting

Run sudo nextcloud.occ status to see whether Nextcloud reports maintenance mode and whether an upgrade is needed. If the command is unavailable, check the installed snap’s command options with snap info nextcloud and use the documented occ access method for your installation. Do not edit configuration files by hand yet. An upgrade-needed result or a failed database operation means the upgrade needs attention before you clear maintenance mode.

5. Review the relevant logs before changing anything

Check the Nextcloud log through the snap’s supported log command, if available, or inspect the log file under the snap’s data directory. Snap paths can vary, so identify the active data path with snap get nextcloud and check the installation’s documentation before assuming a location. Look for recent database, permission, or storage errors. Fix a specific underlying error first; repeated failure messages mean the maintenance flag is probably a symptom, not the cause.

CauseSymptomQuick test
Refresh still runningMaintenance page persists after an updatesnap changes
Storage exhaustedUpgrade or database writes faildf -h and df -i
Service or database issueNextcloud services are inactive or logs show errorssnap services nextcloud and recent logs
Flag left enabledServices are healthy but Nextcloud reports maintenance modesudo nextcloud.occ status

6. Take a backup before recovery

Before rerunning an upgrade or changing configuration, make a backup using your established Nextcloud Snap backup procedure. Include the database and user data, and confirm the backup completed. If you do not have a recent, restorable backup, make one before attempting recovery; this gives you a way back if the database or upgrade state is damaged.

7. Finish the upgrade, then clear maintenance mode if needed

If occ status says an upgrade is required, follow the Nextcloud Snap upgrade guidance for your installation and allow it to finish. When no upgrade or snap change is active, services are healthy, and the logs show no unresolved errors, check status again. If Nextcloud still reports maintenance mode, use sudo nextcloud.occ maintenance:mode --off. A status check showing maintenance mode disabled and a working login page confirm recovery. If the command fails, stop and use the error output to diagnose the underlying issue rather than editing configuration directly.

FAQ

How do I turn off maintenance mode in Nextcloud Snap?

After confirming no upgrade or snap change is running and services are healthy, run sudo nextcloud.occ maintenance:mode --off. Then check sudo nextcloud.occ status and load the login page.

Why does Nextcloud Snap keep returning to maintenance mode?

A failed upgrade, database error, or full filesystem can leave work incomplete and cause the problem to recur. Check snap changes, service status, disk space, and recent logs before turning maintenance mode off again.

Can I restart Nextcloud Snap to fix maintenance mode?

A restart may help if a service is stuck, but it will not complete a failed upgrade or fix a database or storage error. Check for active snap changes first and restart only after you understand the reported failure.

The safest fix is to complete or diagnose the interrupted operation before clearing the maintenance flag. If these checks do not restore access, preserve the logs and backup, then consult the Nextcloud Snap recovery guidance or a qualified administrator with the exact error output.

Photo: Trique303 / CC BY-SA 4.0 (Wikimedia Commons)

Leave a Comment