Nextcloud 29 upgrade corrupted tables

Nextcloud version (eg, 29.0.5): 30
Operating system and version (eg, Ubuntu 24.04): Fedora Server 40
Apache or nginx version (eg, Apache 2.4.25): nginx/1.26.2
PHP version (eg, 8.3): 8.3.12

Upgraded from 28 to 30 (28 → 29, 29 → 30) and nextcloud seems to have mutelated several of it’s tables.

The upgrade from 28 to 29 seems to have corrupted the tables as the logs show the errors after the upgrade.

{"reqId":"r9c551lpfUCXmcrKpc2x","level":1,"time":"2024-10-09T02:25:03+00:00","remoteAddr":"","user":"--","app":"updater","method":"GET","url":"/core/ajax/update.php?","message":"\\OC\\Updater::finishedCheckCodeIntegrity: Finished code integrity check","userAgent":"","version":"29.0.6.1","data":{"app":"updater"}}
{"reqId":"r9c551lpfUCXmcrKpc2x","level":1,"time":"2024-10-09T02:25:03+00:00","remoteAddr":"","user":"--","app":"updater","method":"GET","url":"/core/ajax/update.php?","message":"\\OC\\Updater::updateEnd: Update successful","userAgent":"","version":"29.0.7.1","data":{"app":"updater"}}
{"reqId":"r9c551lpfUCXmcrKpc2x","level":1,"time":"2024-10-09T02:25:03+00:00","remoteAddr":"","user":"--","app":"updater","method":"GET","url":"/core/ajax/update.php?","message":"\\OC\\Updater::maintenanceDisabled: Turned off maintenance mode","userAgent":"","version":"29.0.7.1","data":{"app":"updater"}}
{"reqId":"r9c551lpfUCXmcrKpc2x","level":1,"time":"2024-10-09T02:25:03+00:00","remoteAddr":"","user":"--","app":"updater","method":"GET","url":"/core/ajax/update.php?","message":"\\OC\\Updater::resetLogLevel: Reset log level to Warning(2)","userAgent":"","version":"29.0.7.1","data":{"app":"updater"}}
{"reqId":"wI8CKxakomwFu1ZeGpOB","level":3,"time":"2024-10-26T00:45:49+00:00","remoteAddr":"","user":"--","app":"index","method":"GET","url":"/apps/user_oidc/code?","message":"An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1030 Got error 194 \"Tablespace is missing for a table\" from storage engine InnoDB","userAgent":"removed","version":"29.0.7.1","exception":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1030 Got error 194 \"Tablespace is missing for a table\" from storage engine InnoDB","Code":1030, ...

The tables mariadb can’t read are as follows:

  • oc_textprocess_tasks
  • oc_accounts_data
  • oc_notifications

The tables are completely unreadable, can’t even see their schemas using SHOW CREATE TABLE. Other tables in nextcloud’s database & other databases seem to be fine.

All tables return the following from mariadb-check

Warning  : Tablespace is missing for table 'nextcloud/oc_notifications'
Error    : Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
error    : Corrupt

I am able to login as a local admin account, however all of my oidc-connected accounts fail to login.

I have tried using innodb recovery however that didn’t work, the tables seem to be completely dead.

Tried using occ maintenance:repair --include-expensive and occ db:add-missing-indices.

Currently considering either:

  • Dropping and trying to recreate the corrupt tables, since luckiy most of them seem to be noncritical.
  • Exporting the passwords from the Passwords app in an unencrypted form.
  • Converting my existing oidc users to local users so I can login and access application data that I can’t get just from the files. i.e: Passwords
  • Restoring from an old backup I have. Unsure of the version currently

The original GitHub issue is here.
if any posters have any advice or guidance I’d appreciate it :slight_smile:

Can you still read the tables or back them up? If the reason is the database, perhaps something to fix there:

perhaps check the logs. Not sure what might cause this. Strange why this spots up during the update, just because something is checked at this moment or some specific operation?

As mentioned, only three tables are unreadable. The rest of the tables seem to be fine. I’ve already backed up the readable tables. The nextcloud logs are a bit difficult to go through but I can’t see any clear sign of when things went wrong.

On the database side, the corrupted tables seem to be beyond recovery. Already tried using InnoDB recovery modes.

I do have my previous backup that I could use to replace just the corrupt tables but I’m not sure how to cherry pick them from the mariadb backup.

restore the whole thing into a separate database. Then you can more easily backup just single tables.

Update for anyone unfortunate enough to find themselves in a similar situation. Here are the steps I took which restored functionality:

  1. Restored a full database backup to a temporary vm so I could cherry-pick the tables that were corrupted. As the backup was taken before a database upgrade, I had to run mariadb-upgrade before I could access the databases.
  2. Used mariadb-dump to dump only the corrupted tables.
  3. Restored the corrupted tables using the source command in the mysql repl.

As my backup was recent, I didn’t have to perform any migrations.

The specific tables I had corrupted seem to be non-critical and could’ve been created from scratch. accounts_data does have an id row though, unsure if nextcloud uses that anywhere.

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