MariaDB database failing to start (Nextcloud, Jellyfin)

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version | cat /boot/dietpi/.version
    G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=4
    G_DIETPI_VERSION_RC=2
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’
    G_LIVE_PATCH_STATUS[0]=‘not applicable’
  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
    bookworm
  • Kernel version | uname --all
    Linux DietPi 6.6.32-current-meson64 #1 SMP PREEMPT Sat May 25 14:22:56 UTC 2024 aarch64 GNU/Linux
  • Architecture | dpkg --print-architecture
    arm64
  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)
    Odroid C4/HC4 (aarch64)
  • Power supply used | (EG: 5V 1A RAVpower)
    Official Odroid power supply
  • SD card used | (EG: SanDisk ultra)
    eMMC + External HDD (this is where the data sits)

Bug Report code: af802592-6869-4e95-8650-82e6abcf4e3a

After keeping my perfectly working home server offline for 2 weeks, upon reconnecting it to the electricity grid, Nextcloud and Jellyfin would not work any longer - the former with the message

"Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log."

Upon further digging, it appears to be a problem with the MariaDB process failing to start. This is the exact error

systemctl status mariadb.service
× mariadb.service - MariaDB 10.11.6 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; preset: enabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─dietpi.conf
     Active: failed (Result: exit-code) since Sun 2024-06-02 18:07:59 CEST; 2h 2min ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 3866 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 3867 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 3869 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
    Process: 3898 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
   Main PID: 3898 (code=exited, status=1/FAILURE)
     Status: "MariaDB server is down"
        CPU: 623ms

Jun 02 18:07:59 DietPi mariadbd[3898]: 2024-06-02 18:07:59 0 [Note] InnoDB: Set innodb_force_recovery=1 to ignore corrupted pages.
Jun 02 18:07:59 DietPi mariadbd[3898]: 2024-06-02 18:07:59 0 [ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
Jun 02 18:07:59 DietPi mariadbd[3898]: 2024-06-02 18:07:59 0 [Note] InnoDB: Starting shutdown...
Jun 02 18:07:59 DietPi mariadbd[3898]: 2024-06-02 18:07:59 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
Jun 02 18:07:59 DietPi mariadbd[3898]: 2024-06-02 18:07:59 0 [Note] Plugin 'FEEDBACK' is disabled.
Jun 02 18:07:59 DietPi mariadbd[3898]: 2024-06-02 18:07:59 0 [ERROR] Unknown/unsupported storage engine: InnoDB
Jun 02 18:07:59 DietPi mariadbd[3898]: 2024-06-02 18:07:59 0 [ERROR] Aborting
Jun 02 18:07:59 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jun 02 18:07:59 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jun 02 18:07:59 DietPi systemd[1]: Failed to start mariadb.service - MariaDB 10.11.6 database server.

Could you kindly help me fix this error?
Thank you ever so much

You can try following

  • Login to server via SSH with root access.
  • Navigate to /var/lib/mysql.
  • If you see files like, ib_logfile0 and ib_logfile1, rename or move them to some other folder
  • Restart MariaDB service

Thank you @Joulinar

I tried renaming the ib_logfile0 file

I now get the following, after restarting the MariaDB service.
It complains of not being able to find ib_logfile0

sudo systemctl status mariadb.service
× mariadb.service - MariaDB 10.11.6 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; preset: enabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─dietpi.conf
     Active: failed (Result: exit-code) since Mon 2024-06-03 15:05:29 CEST; 4min 41s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 1586 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 1594 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 1598 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
    Process: 1629 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
   Main PID: 1629 (code=exited, status=1/FAILURE)
     Status: "MariaDB server is down"
        CPU: 399ms

Jun 03 15:05:28 DietPi mariadbd[1629]: 2024-06-03 15:05:28 0 [ERROR] InnoDB: File ./ib_logfile0 was not found
Jun 03 15:05:28 DietPi mariadbd[1629]: 2024-06-03 15:05:28 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
Jun 03 15:05:28 DietPi mariadbd[1629]: 2024-06-03 15:05:28 0 [Note] InnoDB: Starting shutdown...
Jun 03 15:05:28 DietPi mariadbd[1629]: 2024-06-03 15:05:28 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
Jun 03 15:05:28 DietPi mariadbd[1629]: 2024-06-03 15:05:28 0 [Note] Plugin 'FEEDBACK' is disabled.
Jun 03 15:05:29 DietPi mariadbd[1629]: 2024-06-03 15:05:29 0 [ERROR] Unknown/unsupported storage engine: InnoDB
Jun 03 15:05:29 DietPi mariadbd[1629]: 2024-06-03 15:05:29 0 [ERROR] Aborting
Jun 03 15:05:29 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jun 03 15:05:29 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jun 03 15:05:29 DietPi systemd[1]: Failed to start mariadb.service - MariaDB 10.11.6 database server.

Not sure whether renaming (practically removing) the log files, which may contain recent changes to restore, is a good idea. I would instead follow the suggestion of the error log and apply the recovery option, until it starts, so you can do a database dump and try repairing defective tables. Move the two files back in place, then:

dietpi-services stop # stop all services which might use MariaDB
echo -e '[mysqld]\ninnodb_force_recovery=1' > /etc/mysql/mariadb.conf.d/99-recovery.cnf
systemctl restart mariadb
sleep 5
journalctl -u mariadb

Use the last command to check logs, systemctl status will show only a small number of the latest logs, often missing essential ones. If it still fails, try to increment the recovery option:

echo -e '[mysqld]\ninnodb_force_recovery=2' > /etc/mysql/mariadb.conf.d/99-recovery.cnf
systemctl restart mariadb
sleep 5
journalctl -u mariadb

Apply 3 max for now. See details about recovery modes here: InnoDB Recovery Modes - MariaDB Knowledge Base

Once it stops crashing, create a database dump:

mysqldump -A > /root/database_backup.sql

Then try to repair corrupted tables, and see whether this fixes restarts without recovery option:

mysqlcheck -A --auto-repair
rm /etc/mysql/mariadb.conf.d/99-recovery.cnf
systemctl restart mariadb
sleep 5
journalctl -u mariadb

If it still crashes, re-add it, let the database start, remove the corrupted database (I guess it is Nextcloud) and recover the dump:

# use whichever recovery mode was required for it to successfully start, in case replace the "1"
echo -e '[mysqld]\ninnodb_force_recovery=1' > /etc/mysql/mariadb.conf.d/99-recovery.cnf
systemctl restart mariadb
mysql -e 'drop database nextcloud'
mysql < /root/database_backup.sql
rm /etc/mysql/mariadb.conf.d/99-recovery.cnf
systemctl restart mariadb
sleep 5
journalctl -u mariadb

Recovering a database dump should fix things, since only non-corrupted tables/entries are dumped. Carefully check whether data is missing. The mysqlcheck should have given an indicator which tables were affected. If too much is missing, consider to restore a backup, if you have one. Else, consider to setup a cron job or something to generate a database dump regularly.

@MichaIng

Thank you very much for your advice!
It appears it is a problem with the proc table having suffered corruption.

journalctl -u mariadb
Jun 03 18:45:54 DietPi systemd[1]: Starting mariadb.service - MariaDB 10.11.6 database server...
Jun 03 18:45:57 DietPi mariadbd[1277]: 2024-06-03 18:45:57 0 [Note] Starting MariaDB 10.11.6-MariaDB-0+deb12u1 source revision  as process 1277
Jun 03 18:45:58 DietPi mariadbd[1277]: 2024-06-03 18:45:58 0 [Note] InnoDB: !!! innodb_force_recovery is set to 1 !!!
Jun 03 18:45:58 DietPi mariadbd[1277]: 2024-06-03 18:45:58 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
Jun 03 18:45:58 DietPi mariadbd[1277]: 2024-06-03 18:45:58 0 [Note] InnoDB: Number of transaction pools: 1
Jun 03 18:45:58 DietPi mariadbd[1277]: 2024-06-03 18:45:58 0 [Note] InnoDB: Using ARMv8 crc32 + pmull instructions
Jun 03 18:45:58 DietPi mariadbd[1277]: 2024-06-03 18:45:58 0 [Note] InnoDB: Using liburing
Jun 03 18:45:58 DietPi mariadbd[1277]: 2024-06-03 18:45:58 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
Jun 03 18:45:58 DietPi mariadbd[1277]: 2024-06-03 18:45:58 0 [Note] InnoDB: Completed initialization of buffer pool
Jun 03 18:45:58 DietPi mariadbd[1277]: 2024-06-03 18:45:58 0 [Note] InnoDB: File system buffers for log disabled (block size=4096 bytes)
Jun 03 18:46:00 DietPi mariadbd[1277]: 2024-06-03 18:46:00 0 [Note] InnoDB: End of log at LSN=46878
Jun 03 18:46:06 DietPi mariadbd[1277]: 2024-06-03 18:46:06 0 [Note] InnoDB: 128 rollback segments are active.
Jun 03 18:46:06 DietPi mariadbd[1277]: 2024-06-03 18:46:06 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
Jun 03 18:46:06 DietPi mariadbd[1277]: 2024-06-03 18:46:06 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
Jun 03 18:46:06 DietPi mariadbd[1277]: 2024-06-03 18:46:06 0 [Note] InnoDB: log sequence number 46878; transaction id 14
Jun 03 18:46:06 DietPi mariadbd[1277]: 2024-06-03 18:46:06 0 [Note] InnoDB: Loading buffer pool(s) from /mnt/00d331eb-f560-4535-812c-00904c8df69f/dietpi_userdata/mysql/ib_buffer_pool
Jun 03 18:46:06 DietPi mariadbd[1277]: 2024-06-03 18:46:06 0 [Note] Plugin 'FEEDBACK' is disabled.
Jun 03 18:46:06 DietPi mariadbd[1277]: 2024-06-03 18:46:06 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
Jun 03 18:46:07 DietPi mariadbd[1277]: 2024-06-03 18:46:07 0 [Note] Server socket created on IP: '127.0.0.1'.
Jun 03 18:46:07 DietPi mariadbd[1277]: 2024-06-03 18:46:07 0 [Note] InnoDB: Buffer pool(s) load completed at 240603 18:46:07
Jun 03 18:46:09 DietPi mariadbd[1277]: 2024-06-03 18:46:09 0 [Note] /usr/sbin/mariadbd: ready for connections.
Jun 03 18:46:09 DietPi mariadbd[1277]: Version: '10.11.6-MariaDB-0+deb12u1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Debian 12
Jun 03 18:46:10 DietPi systemd[1]: Started mariadb.service - MariaDB 10.11.6 database server.
Jun 03 18:46:10 DietPi /etc/mysql/debian-start[2509]: Upgrading MySQL tables if necessary.
Jun 03 18:46:10 DietPi /etc/mysql/debian-start[2522]: Checking for insecure root accounts.
Jun 03 18:46:11 DietPi /etc/mysql/debian-start[2526]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables
Jun 03 18:46:15 DietPi mariadbd[1277]: 2024-06-03 18:46:15 6 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
Jun 03 18:46:15 DietPi mariadbd[1277]: 2024-06-03 18:46:15 7 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
Jun 03 18:46:15 DietPi mariadbd[1277]: 2024-06-03 18:46:15 8 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
Jun 03 18:46:15 DietPi mariadbd[1277]: 2024-06-03 18:46:15 9 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
Jun 03 18:46:16 DietPi mariadbd[1277]: 2024-06-03 18:46:16 10 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
Jun 03 18:46:16 DietPi mariadbd[1277]: 2024-06-03 18:46:16 11 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
Jun 03 18:46:20 DietPi mariadbd[1277]: 2024-06-03 18:46:20 16 [Note] Zerofilling moved table:  './mysql/proc'
Jun 03 18:46:20 DietPi mariadbd[1277]: 2024-06-03 18:46:20 16 [Warning] Checking table:   './mysql/proc'
Jun 03 18:46:20 DietPi mariadbd[1277]: 2024-06-03 18:46:20 16 [Warning] Recovering table: './mysql/proc'
Jun 03 18:46:20 DietPi mariadbd[1277]: 2024-06-03 18:46:20 16 [ERROR] Couldn't repair table: mysql.proc
Jun 03 18:46:22 DietPi /etc/mysql/debian-start[2598]: WARNING: mysqlcheck has found corrupt tables
Jun 03 18:46:22 DietPi /etc/mysql/debian-start[2598]: ERROR 1034 (HY000) at line 1: Index for table 'proc' is corrupt; try to repair it
Jun 03 18:46:22 DietPi /etc/mysql/debian-start[2598]: 
Jun 03 18:46:22 DietPi /etc/mysql/debian-start[2598]:  Improperly closed tables are also reported if clients are accessing
Jun 03 18:46:22 DietPi /etc/mysql/debian-start[2598]:  the tables *now*. A list of current connections is below.
Jun 03 18:46:22 DietPi /etc/mysql/debian-start[2598]: 
Jun 03 18:46:22 DietPi /etc/mysql/debian-start[2598]: +----+------+-----------+----+---------+------+----------+------------------+----------+
Jun 03 18:46:22 DietPi /etc/mysql/debian-start[2598]: | Id | User | Host      | db | Command | Time | State    | Info             | Progress |
Jun 03 18:46:22 DietPi /etc/mysql/debian-start[2598]: +----+------+-----------+----+---------+------+----------+------------------+----------+
Jun 03 18:46:22 DietPi /etc/mysql/debian-start[2598]: | 37 | root | localhost |    | Query   | 0    | starting | show processlist | 0.000    |
Jun 03 18:46:22 DietPi /etc/mysql/debian-start[2598]: +----+------+-----------+----+---------+------+----------+------------------+----------+
Jun 03 18:46:22 DietPi /etc/mysql/debian-start[2598]: Uptime: 26  Threads: 2  Questions: 59  Slow queries: 0  Opens: 33  Open tables: 25  Queries per second avg: 2.269
Jun 03 18:47:13 DietPi mariadbd[1277]: 2024-06-03 18:47:13 38 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
Jun 03 18:47:13 DietPi mariadbd[1277]: 2024-06-03 18:47:13 39 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
Jun 03 18:47:13 DietPi mariadbd[1277]: 2024-06-03 18:47:13 40 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
Jun 03 18:47:13 DietPi mariadbd[1277]: 2024-06-03 18:47:13 41 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
Jun 03 18:47:13 DietPi mariadbd[1277]: 2024-06-03 18:47:13 42 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
Jun 03 18:47:13 DietPi mariadbd[1277]: 2024-06-03 18:47:13 43 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
Jun 03 18:47:40 DietPi mariadbd[1277]: 2024-06-03 18:47:40 0 [Note] /usr/sbin/mariadbd (initiated by: unknown): Normal shutdown
Jun 03 18:47:40 DietPi systemd[1]: Stopping mariadb.service - MariaDB 10.11.6 database server...
Jun 03 18:47:40 DietPi mariadbd[1277]: 2024-06-03 18:47:40 0 [Note] InnoDB: FTS optimize thread exiting.
Jun 03 18:47:40 DietPi mariadbd[1277]: 2024-06-03 18:47:40 0 [Note] InnoDB: Starting shutdown...
Jun 03 18:47:40 DietPi mariadbd[1277]: 2024-06-03 18:47:40 0 [Note] InnoDB: Dumping buffer pool(s) to /mnt/00d331eb-f560-4535-812c-00904c8df69f/dietpi_userdata/mysql/ib_buffer_pool
Jun 03 18:47:40 DietPi mariadbd[1277]: 2024-06-03 18:47:40 0 [Note] InnoDB: Buffer pool(s) dump completed at 240603 18:47:40
Jun 03 18:47:40 DietPi mariadbd[1277]: 2024-06-03 18:47:40 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
Jun 03 18:47:40 DietPi mariadbd[1277]: 2024-06-03 18:47:40 0 [Note] InnoDB: Shutdown completed; log sequence number 46878; transaction id 15
Jun 03 18:47:40 DietPi mariadbd[1277]: 2024-06-03 18:47:40 0 [Note] /usr/sbin/mariadbd: Shutdown complete
Jun 03 18:47:40 DietPi systemd[1]: mariadb.service: Deactivated successfully.
Jun 03 18:47:40 DietPi systemd[1]: Stopped mariadb.service - MariaDB 10.11.6 database server.
Jun 03 18:47:40 DietPi systemd[1]: mariadb.service: Consumed 1.752s CPU time.
Jun 03 18:47:49 DietPi systemd[1]: Starting mariadb.service - MariaDB 10.11.6 database server...
Jun 03 18:47:49 DietPi mariadbd[2927]: 2024-06-03 18:47:49 0 [Note] Starting MariaDB 10.11.6-MariaDB-0+deb12u1 source revision  as process 2927
Jun 03 18:47:49 DietPi mariadbd[2927]: 2024-06-03 18:47:49 0 [Note] InnoDB: !!! innodb_force_recovery is set to 1 !!!
Jun 03 18:47:49 DietPi mariadbd[2927]: 2024-06-03 18:47:49 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
Jun 03 18:47:49 DietPi mariadbd[2927]: 2024-06-03 18:47:49 0 [Note] InnoDB: Number of transaction pools: 1
Jun 03 18:47:49 DietPi mariadbd[2927]: 2024-06-03 18:47:49 0 [Note] InnoDB: Using ARMv8 crc32 + pmull instructions
Jun 03 18:47:49 DietPi mariadbd[2927]: 2024-06-03 18:47:49 0 [Note] InnoDB: Using liburing
Jun 03 18:47:49 DietPi mariadbd[2927]: 2024-06-03 18:47:49 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
Jun 03 18:47:49 DietPi mariadbd[2927]: 2024-06-03 18:47:49 0 [Note] InnoDB: Completed initialization of buffer pool
Jun 03 18:47:49 DietPi mariadbd[2927]: 2024-06-03 18:47:49 0 [Note] InnoDB: File system buffers for log disabled (block size=4096 bytes)
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 0 [Note] InnoDB: End of log at LSN=46878
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 0 [Note] InnoDB: 128 rollback segments are active.
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 0 [Note] InnoDB: log sequence number 46878; transaction id 14
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 0 [Note] InnoDB: Loading buffer pool(s) from /mnt/00d331eb-f560-4535-812c-00904c8df69f/dietpi_userdata/mysql/ib_buffer_pool
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 0 [Note] Plugin 'FEEDBACK' is disabled.
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 0 [Note] Server socket created on IP: '127.0.0.1'.
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 0 [Note] /usr/sbin/mariadbd: ready for connections.
Jun 03 18:47:50 DietPi mariadbd[2927]: Version: '10.11.6-MariaDB-0+deb12u1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Debian 12
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 0 [Note] InnoDB: Buffer pool(s) load completed at 240603 18:47:50
Jun 03 18:47:50 DietPi systemd[1]: Started mariadb.service - MariaDB 10.11.6 database server.
Jun 03 18:47:50 DietPi /etc/mysql/debian-start[2941]: Upgrading MySQL tables if necessary.
Jun 03 18:47:50 DietPi /etc/mysql/debian-start[2952]: Checking for insecure root accounts.
Jun 03 18:47:50 DietPi /etc/mysql/debian-start[2956]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 10 [Note] Zerofilling moved table:  './mysql/proc'
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 10 [Warning] Checking table:   './mysql/proc'
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 10 [Warning] Recovering table: './mysql/proc'
Jun 03 18:47:50 DietPi mariadbd[2927]: 2024-06-03 18:47:50 10 [ERROR] Couldn't repair table: mysql.proc
Jun 03 18:47:51 DietPi /etc/mysql/debian-start[2988]: WARNING: mysqlcheck has found corrupt tables
Jun 03 18:47:51 DietPi /etc/mysql/debian-start[2988]: ERROR 1034 (HY000) at line 1: Index for table 'proc' is corrupt; try to repair it
Jun 03 18:47:51 DietPi /etc/mysql/debian-start[2988]: 
Jun 03 18:47:51 DietPi /etc/mysql/debian-start[2988]:  Improperly closed tables are also reported if clients are accessing
Jun 03 18:47:51 DietPi /etc/mysql/debian-start[2988]:  the tables *now*. A list of current connections is below.
Jun 03 18:47:51 DietPi /etc/mysql/debian-start[2988]: 
Jun 03 18:47:51 DietPi /etc/mysql/debian-start[2988]: +----+------+-----------+----+---------+------+----------+------------------+----------+
Jun 03 18:47:51 DietPi /etc/mysql/debian-start[2988]: | Id | User | Host      | db | Command | Time | State    | Info             | Progress |
Jun 03 18:47:51 DietPi /etc/mysql/debian-start[2988]: +----+------+-----------+----+---------+------+----------+------------------+----------+
Jun 03 18:47:51 DietPi /etc/mysql/debian-start[2988]: | 31 | root | localhost |    | Query   | 0    | starting | show processlist | 0.000    |
Jun 03 18:47:51 DietPi /etc/mysql/debian-start[2988]: +----+------+-----------+----+---------+------+----------+------------------+----------+
Jun 03 18:47:51 DietPi /etc/mysql/debian-start[2988]: Uptime: 2  Threads: 1  Questions: 59  Slow queries: 0  Opens: 33  Open tables: 25  Queries per second avg: 29.500

Unfortunately, this seems to interfere also with attempts at performing a database dump.

root@DietPi:~# mysqldump -A > /root/database_backup.sql
mysqldump: Got error: 1034: "Index for table 'proc' is corrupt; try to repair it" when using LOCK TABLES
root@DietPi:~# 

Do you know of any best workaround in this situation?

you don’t have a backup of your system?

mysqlcheck cannot repair it?

mysqlcheck --auto-repair mysql proc

Mea culpa, unfortunately the backup I had for the database itself was too old (unlike the nightly system backup). On the flip side, I learnt my lesson, and no other important (user) data was compromised.

Not even mysqlcheck could repair the db, such was its state of corruption!

I have now proceeded to reinstall my Nextcloud instance.
Thank you very much for your help!!

don’t forget to perform regular database backups next to dietpi-backup

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