Fixing Broken Nextcloud – MariaDB 10.X Upgrade

As a classic HomeLab enjoyer I self-host most of the stuff I use daily. But few days ago while maintaining my Nextcloud instance, I updated Nextcloud & MariaDB to catch up on the latest patches. Unfortunately, my docker install was unable to start properly again and I was greeted by the following error :

Nextcloud_Error
The Nextcloud error I encountered

So I went to check the Nextcloud logs on my docker container with the following command :

docker logs nextcloud

I immediately realized that was a database error and not a Nextcloud one, the following messages where present :

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. Update failed

From my small knowledge in programming I know one thing, Doctrine is like a link between operations that are queued in the app (Nextcloud in this case) waiting for being written to the database.

InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED

If you want a quick fix you can just rollback to a previous version of mariadb (10.5.11) but if you want to know more about this issue, just stick with me for a bit.

From MariaDB 10.6.0, tables that are of the COMPRESSED row format are read-only by default, the goal here is to deprecate the feature in the future. By setting the innodb_read_only_compressed 3 variable to OFF it make the tables writable.

read_only_compressed
read_only_compressed

However, this is a workaround rather that a solution. Tables must be migrated. Hopefully they should be migrated automatically by Nextcloud in an incoming update soon. It is wise not to touch the table’s definition in order to not break the (hopefully) incoming Nextcloud migration.


How to fix it ?

Standard Install

  • Access you MariaDB server
  • Edit the /etc/my.cnf.d/server.cnf file
  • Find the [mysqld] section
  • Add the following statement « innodb_read_only_compressed=OFF »
  • Restart your SQL service

Docker Install

If you are running your app in docker container you can add the command in your docker-compose script to be executed at every startup :

command: # CLI arguments  - "--innodb_read_only_compressed=OFF"

Commentaires

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *