Skip to content

fix(update): wait for Nextcloud upgrade to end - #303

Draft
stephdl wants to merge 1 commit into
mainfrom
8159-wait-upgrade-end
Draft

stephdl wants to merge 1 commit into
mainfrom
8159-wait-upgrade-end

Conversation

@stephdl

@stephdl stephdl commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

When an instance is updated through several Nextcloud major versions in a row, it can end up stuck in maintenance mode with config.php two versions behind version.php. update-module returns while the container still runs occ upgrade in the background. The next update-module restarts the container first and kills that upgrade. The new version.php is already in place, so Nextcloud never runs the upgrade again, and the next major update is refused. NethServer/dev#8159

The update now waits for a running upgrade to end before it restarts anything. After the restart it checks that Nextcloud is really ready, with no maintenance mode and no pending database upgrade. If not, the update task fails with a clear message, so the next update is not started on a broken instance.

  • New update-module.d/05wait_init: wait on the entrypoint lock before any other update step.
  • update-module.d/20restart: after the restart, check occ status -e and fail the task if Nextcloud is not ready. Then apply the mail and LDAP settings again, because they could not apply while the upgrade held maintenance mode.

How to test

  • Install an old release (Nextcloud 29) and update one major at a time. Start the next update right after the previous one returns, while occ upgrade may still be running.
  • With the fixed release as target, the update waits for the running upgrade, and at the end occ status shows no maintenance and no pending upgrade, with config.php and version.php on the same version.
  • Update an instance that is already broken: the update task fails and the journal shows the Nextcloud status.
  • A normal update with no major version change works as before.

update-module returned while the entrypoint still ran occ upgrade.
The next update restarted nextcloud-app and killed it. version.php
was already new, so the upgrade never ran again and config.php
stayed behind.

Wait on the entrypoint lock before restarting. After the restart,
check occ status and fail the task if Nextcloud is not ready, then
apply mail and LDAP settings again.
@stephdl stephdl self-assigned this Dec 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant