Linuxserver.io: Stuck in Maintenance Mode after failed update

Nextcloud version (eg, 20.0.5): 27.1.4.1
Operating system and version (eg, Ubuntu 20.04): Unraid docker
Apache or nginx version (eg, Apache 2.4.25): ???
PHP version (eg, 7.4): ???

The issue you are facing:

I updated the dockers for Swag, MariaDB and Nextcloud and since then I’ve been stuck in maintenance mode with the below log:

I’ve tried to manually change the MaintenanceMode flag to false in the config.php file but on restarting Nextcloud it reverts back to true.

Restoring all three of the containers back to before the updates doesn’t help either.

Trying to run the “occ db:add-missing-indices” command produces the following:

Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Adding additional textstep_session index to the oc_text_steps table, this can take some time...

In ExceptionConverter.php line 117:                                                                                                                                                                
  An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1932 Table 'nextcloud.oc_external_config' doesn't exist in engine                                                                                                                                                             

In Exception.php line 28:                                                                                                                 
  SQLSTATE[42S02]: Base table or view not found: 1932 Table 'nextcloud.oc_external_config' doesn't exist in engine  
                                                                                                                    
In Connection.php line 71:                                                                        
  SQLSTATE[42S02]: Base table or view not found: 1932 Table 'nextcloud.oc_external_config' doesn't exist in engine  
                                                                                                                    
db:add-missing-indices [--dry-run]

Anyone have any suggestions?

Is this the first time you’ve seen this error? (Y/N): Y

The output of your Nextcloud log in Admin > Logging:

[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] 02-default-location: skipped
[migrations] done
usermod: no changes
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    99
User GID:    100
───────────────────────────────────────

using keys found in /config/keys
Initializing nextcloud 28.0.0.11 (this can take a while) ...
Upgrading nextcloud from 27.1.4.1 ...
Setting permissions
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Updating database schema
Exception: Database error when running migration 28000Date20231103104802 for app core
An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1932 Table 'nextcloud.oc_external_config' doesn't exist in engine
Update failed
Maintenance mode is kept active
Resetting log level
Initializing finished
[custom-init] No custom files found, skipping...
[ls.io-init] done.

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'datadirectory' => '/data',
  'instanceid' => '###############',
  'passwordsalt' => '################',
  'secret' => '####################',
  'trusted_domains' => 
  array (
    0 => '192.#############',
    1 => 'nextcloud.############',
  ),
  'trusted_proxies' => 
  array (
    0 => 'swag',
  ),
  'dbtype' => 'mysql',
  'version' => '27.1.4.1',
  'overwrite.cli.url' => 'https://nextcloud.######',
  'overwritehost' => 'nextcloud.###########',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => '192.######',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '#########',
  'installed' => true,
  'maintenance' => true,
  'default_phone_region' => 'GB',
  'app_install_overwrite' => 
  array (
    0 => 'files_external_gdrive',
    1 => 'files_external_onedrive',
    2 => 'files_clipboard',
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => '################',
  'mail_domain' => 'gmail.com',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpport' => '465',
  'mail_smtpname' => '############',
  'mail_smtppassword' => '##########',
  'theme' => '',
  'loglevel' => 0,
  'updater.release.channel' => 'stable',
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'filelocking.enabled' => 'true',
  'memcache.locking' => '\\OC\\Memcache\\APCu',
  'upgrade.disable-web' => true,
);

Sorry if this is a mess but I am very much a beginner with this. Any help would be hugely appreciated.

Restoring all three of the containers back to before the updates doesn’t help either.

Based on the above and the error message it sort of sounds like your database is missing. And an NC upgrade itself can’t mess up your restored containers so something is definitely not right. :thinking:

Hopefully your DB container has persistent storage configured!

Suggestions:

  • Check your database container log for errors/warnings/status (e.g. docker compose <container_name> logs)
  • Post your Docker Compose file
1 Like

as you you are using custom linuxserver image I would recommend you reach out to linuxserver.io Support and linuxserver.io Nextcloud docs

Thanks for the prompt, a good idea. I’ve just posted on there too.

The log from the MariaDB database docker is this:

[migrations] started
[migrations] no migrations found
usermod: no changes
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    99
User GID:    100
───────────────────────────────────────

[custom-init] No custom files found, skipping...
231219 03:11:28 mysqld_safe Logging to '/config/databases/766755551b14.err'.
231219 03:11:28 mysqld_safe Starting mariadbd daemon with databases from /config/databases
[ls.io-init] done.
Caught SIGTERM signal!

And your Docker Compose file?

From the looks of it, your database container isn’t functioning.

Maybe this: https://info.linuxserver.io/issues/2023-05-29-mariadb/

Tough to say though without more information.

1 Like

The MariaDB check and repair link was useful and showed the following:

Error    : Table 'nextcloud.oc_external_applicable' doesn't exist in engine
status   : Operation failed
nextcloud.oc_external_config
Error    : Table 'nextcloud.oc_external_config' doesn't exist in engine
status   : Operation failed
nextcloud.oc_external_mounts
Error    : Table 'nextcloud.oc_external_mounts' doesn't exist in engine
status   : Operation failed
nextcloud.oc_external_options
Error    : Table 'nextcloud.oc_external_options' doesn't exist in engine
status   : Operation failed
nextcloud.oc_files_metadata
Error    : Table 'nextcloud.oc_files_metadata' doesn't exist in engine
status   : Operation failed
nextcloud.oc_files_metadata_index
Error    : Table 'nextcloud.oc_files_metadata_index' doesn't exist in engine
status   : Operation failed
nextcloud.oc_onlyoffice_filekey
Error    : Table 'nextcloud.oc_onlyoffice_filekey' doesn't exist in engine
status   : Operation failed
nextcloud.oc_text2image_tasks
Error    : Table 'nextcloud.oc_text2image_tasks' doesn't exist in engine
status   : Operation failed

Sorry, I’m not familiar with Docker Compose. How do I produce the file?

There are two ways to establish (run) Docker containers:

  • Compose
  • command-line run command

Basically… however you started/created your containers. It will have the parameters of your volumes, environment variables, etc.

You were right with your first suggestion - it was an issue with the database. I’ve now sorted it. I really appreciate your help through, thanks.

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.