Nextcloud 18.0.4 Maintenance mode

It may be possible, that missing indices may block the updates from appcenter.
My last three Nextcloud - updates ended with getting stuck in maintenance mode.
I always could finish the upgrade with the three instructions I posted above. After that procedure my Nextcloud started and ran properly. At every update new indices had been added.

I recommend to run the updates first and then finally turn off the maintenance mode to prevent from client logins, which may lead to inconsistency. - I believe, that there is a special reason, why these updates are done in Nextcloud while maintenance mode is on.

Hint:
Please also check the Nextcloud logfile:
If Nextcloud gets stuck in maintenance mode, the loglevel might be in the wrong mode and the logfile becomes flooded by messages (several GBytes per hour).

See Nextcloud 18.02 massive log flooding with LDAP Errors