Mariadb

Hi all, I get this error (Failed)when i reboot my raspberry pi 4.

Dietpi v6.30 fresh install.
What to do.

[  OK  ] DietPi-Services | restart : proftpd
[  OK  ] DietPi-Services | restart : nmbd
[  OK  ] DietPi-Services | restart : smbd
[FAILED] DietPi-Services | restart : mariadb
[  OK  ] DietPi-Services | restart : php7.3-fpm
[  OK  ] DietPi-Services | restart : lighttpd
[  OK  ] DietPi-Services | restart : nzbget
[  OK  ] DietPi-Services | restart : rpimonitor
[  OK  ] DietPi-Services | restart : webmin
[  OK  ] DietPi-Services | restart : cron

p.s.my english is not so good. preference dutch :wink:

Hi,

bedankt voor je bericht. Well, I was working with people from Amsterdam for more than 6 years but still don’t speak dutch :smiley: Therefore let’s stick to English

pls can you check following

systemctl restart mariadb.service
journalctl -u mariadb
cat /var/log/mysql/error.log

Hi Joulinar,

Damm i thought you are dutch :wink: :slight_smile:

oke here are the results.

systemctl restart mariadb.service
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
root@DietPi:~#



journalctl -u mariadb
-- Logs begin at Mon 2020-06-22 17:16:45 BST, end at Mon 2020-06-22 18:55:01 BST. --
Jun 22 17:17:20 DietPi systemd[1]: Starting MariaDB 10.3.22 database server...
Jun 22 17:17:21 DietPi mysqld[601]: 2020-06-22 17:17:21 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 601 ...
Jun 22 17:17:22 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jun 22 17:17:22 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jun 22 17:17:22 DietPi systemd[1]: Failed to start MariaDB 10.3.22 database server.
Jun 22 17:44:22 DietPi systemd[1]: Starting MariaDB 10.3.22 database server...
Jun 22 17:44:23 DietPi mysqld[5897]: 2020-06-22 17:44:23 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 5897 ...
Jun 22 17:44:27 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jun 22 17:44:27 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jun 22 17:44:27 DietPi systemd[1]: Failed to start MariaDB 10.3.22 database server.
Jun 22 17:53:01 DietPi systemd[1]: Starting MariaDB 10.3.22 database server...
Jun 22 17:53:02 DietPi mysqld[6480]: 2020-06-22 17:53:02 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 6480 ...
Jun 22 17:53:06 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jun 22 17:53:06 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jun 22 17:53:06 DietPi systemd[1]: Failed to start MariaDB 10.3.22 database server.
Jun 22 17:54:07 DietPi systemd[1]: Starting MariaDB 10.3.22 database server...
Jun 22 17:54:07 DietPi mysqld[7498]: 2020-06-22 17:54:07 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 7498 ...
Jun 22 17:54:08 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jun 22 17:54:08 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jun 22 17:54:08 DietPi systemd[1]: Failed to start MariaDB 10.3.22 database server.
Jun 22 17:54:24 DietPi systemd[1]: Starting MariaDB 10.3.22 database server...
Jun 22 17:54:24 DietPi mysqld[7931]: 2020-06-22 17:54:24 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 7931 ...
Jun 22 17:54:25 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jun 22 17:54:25 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jun 22 17:54:25 DietPi systemd[1]: Failed to start MariaDB 10.3.22 database server.
Jun 22 18:54:56 DietPi systemd[1]: Starting MariaDB 10.3.22 database server...
Jun 22 18:54:56 DietPi mysqld[11718]: 2020-06-22 18:54:56 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 11718 ...
Jun 22 18:55:01 DietPi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jun 22 18:55:01 DietPi systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jun 22 18:55:01 DietPi systemd[1]: Failed to start MariaDB 10.3.22 database server.
root@DietPi:~#



cat /var/log/mysql/error.log
2020-06-22 18:54:56 0 [Note] InnoDB: Using Linux native AIO
2020-06-22 18:54:56 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-06-22 18:54:56 0 [Note] InnoDB: Uses event mutexes
2020-06-22 18:54:56 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-06-22 18:54:56 0 [Note] InnoDB: Number of pools: 1
2020-06-22 18:54:56 0 [Note] InnoDB: Using generic crc32 instructions
2020-06-22 18:54:56 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-06-22 18:54:56 0 [Note] InnoDB: Completed initialization of buffer pool
2020-06-22 18:54:56 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-06-22 18:55:00 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-22 18:55:00 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-22 18:55:00 0 [ERROR] InnoDB: Cannot open datafile for read-only: './mysql/gtid_slave_pos.ibd' OS error: 81
2020-06-22 18:55:00 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-22 18:55:00 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-22 18:55:00 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``mysql`.`gtid_slave_pos``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2020-06-22 18:55:00 0 [Warning] InnoDB: Ignoring tablespace for `mysql`.`gtid_slave_pos` because it could not be opened.
2020-06-22 18:55:00 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-22 18:55:00 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-22 18:55:00 0 [ERROR] InnoDB: Cannot open datafile for read-only: './mysql/innodb_index_stats.ibd' OS error: 81
2020-06-22 18:55:00 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-22 18:55:00 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-22 18:55:00 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``mysql`.`innodb_index_stats``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2020-06-22 18:55:00 0 [Warning] InnoDB: Ignoring tablespace for `mysql`.`innodb_index_stats` because it could not be opened.
2020-06-22 18:55:00 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-22 18:55:00 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-22 18:55:00 0 [ERROR] InnoDB: Cannot open datafile for read-only: './mysql/innodb_table_stats.ibd' OS error: 81
2020-06-22 18:55:00 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-22 18:55:00 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-22 18:55:00 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``mysql`.`innodb_table_stats``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2020-06-22 18:55:00 0 [Warning] InnoDB: Ignoring tablespace for `mysql`.`innodb_table_stats` because it could not be opened.
2020-06-22 18:55:00 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-22 18:55:00 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-22 18:55:00 0 [ERROR] InnoDB: Cannot open datafile for read-only: './mysql/transaction_registry.ibd' OS error: 81
2020-06-22 18:55:00 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-22 18:55:00 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-22 18:55:00 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``mysql`.`transaction_registry``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2020-06-22 18:55:00 0 [Warning] InnoDB: Ignoring tablespace for `mysql`.`transaction_registry` because it could not be opened.
2020-06-22 18:55:00 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-06-22 18:55:00 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-06-22 18:55:00 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-06-22 18:55:00 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-06-22 18:55:00 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-06-22 18:55:00 0 [Note] InnoDB: 10.3.22 started; log sequence number 1625502; transaction id 21
2020-06-22 18:55:00 2 [ERROR] InnoDB: Failed to find tablespace for table `mysql`.`innodb_index_stats` in the cache. Attempting to load the tablespace with space id 2
2020-06-22 18:55:00 2 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-22 18:55:00 2 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-22 18:55:00 2 [ERROR] InnoDB: Cannot open datafile for read-only: './mysql/innodb_index_stats.ibd' OS error: 81
2020-06-22 18:55:00 2 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-22 18:55:00 2 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-22 18:55:00 0 [Note] InnoDB: Loading buffer pool(s) from /mnt/hd500/dietpi_userdata/mysql/ib_buffer_pool
2020-06-22 18:55:00 2 [ERROR] InnoDB: Could not find a valid tablespace file for ``mysql`.`innodb_index_stats``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2020-06-22 18:55:00 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-06-22 18:55:00 3 [ERROR] InnoDB: Failed to find tablespace for table `mysql`.`innodb_table_stats` in the cache. Attempting to load the tablespace with space id 1
2020-06-22 18:55:00 3 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-22 18:55:00 3 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-22 18:55:00 3 [ERROR] InnoDB: Cannot open datafile for read-only: './mysql/innodb_table_stats.ibd' OS error: 81
2020-06-22 18:55:00 3 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-22 18:55:00 3 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-22 18:55:00 3 [ERROR] InnoDB: Could not find a valid tablespace file for ``mysql`.`innodb_table_stats``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2020-06-22 18:55:00 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2020-06-22 18:55:00 0 [Note] Recovering after a crash using tc.log
2020-06-22 18:55:00 0 [Note] Starting crash recovery...
2020-06-22 18:55:00 0 [Note] Crash recovery finished.
2020-06-22 18:55:00 0 [Note] InnoDB: Buffer pool(s) load completed at 200622 18:55:00
2020-06-22 18:55:00 0 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
2020-06-22 18:55:00 0 [Note] Server socket created on IP: '127.0.0.1'.
2020-06-22 18:55:00 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
root@DietPi:~#

Thats all.
Thnx for helping.

did you have done anything like moving to an external disk? Or similar? Can you do

df -h
lsblk -o name,label,size,ro,type,mountpoint,partuuid,uuid

Yes i have moved it.
rootfs to a ssd 120
dietpi_userdata to a hd 500

I works for month before.
Only i did a reboot and get that error.

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       110G  1.4G  109G   2% /
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           2.0G   11M  2.0G   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs            50M   20K   50M   1% /var/log
tmpfs           2.0G  4.0K  2.0G   1% /tmp
/dev/mmcblk0p1  253M   53M  200M  22% /boot
/dev/sdb5       458G  190G  268G  42% /mnt/hd500



lsblk -o name,label,size,ro,type,mountpoint,partuuid,uuid
NAME        LABEL    SIZE RO TYPE MOUNTPOINT PARTUUID                             UUID
sda                111.8G  0 disk
├─sda1                 1K  0 part            e96f2022-01
└─sda5             111.8G  0 part /          e96f2022-05                          d9472183-9cf2-4343-8996-c72cdcb6031b
sdb                465.8G  0 disk
├─sdb1                 1K  0 part            973f8e12-01
└─sdb5             465.8G  0 part /mnt/hd500 973f8e12-05                          70a6f2eb-71fc-488c-b67c-d7d61be0d1e7
mmcblk0             14.9G  0 disk
├─mmcblk0p1 boot     256M  0 part /boot      2fed7fee-01                          592B-C92C
└─mmcblk0p2 rootfs  14.6G  0 part            2fed7fee-02                          706944a6-7d0f-4a45-9f8c-7fb07375e9f7

ok let’s check if links are set correctly

readlink /var/lib/mysql
readlink -f /var/lib/mysql

oke the results are.

readlink /var/lib/mysql
/mnt/dietpi_userdata/mysql
root@DietPi:~#



readlink -f /var/lib/mysql
/mnt/hd500/dietpi_userdata/mysql
root@DietPi:~#

seems to be oke ?

yes links seems to be ok. Let’s check why you have permission issues like this

2020-06-22 18:55:00 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.

pls do

sudo -u mysql -g mysql touch /var/lib/mysql/demo.file
ls -la /mnt/hd500/dietpi_userdata/

oke.

sudo -u mysql -g mysql touch /var/lib/mysql/demo.file
root@DietPi:~#
root@DietPi:~# ls -la /mnt/hd500/dietpi_userdata/
total 36
drwxr-xr-x  9 root     root     4096 Jun 22 16:25 .
drwxrwxrwx 14      777 root     4096 Jun 21 20:49 ..
drwxrwxr-x  2 dietpi   dietpi   4096 Jun 22 16:25 Music
drwxrwxr-x  2 dietpi   dietpi   4096 Jun 22 16:25 Pictures
drwxrwxr-x  2 dietpi   dietpi   4096 Jun 22 16:25 Video
drwxrwxr-x  7 dietpi   dietpi   4096 Jun 22 17:54 downloads
drwxr-xr-x  7 mysql    mysql    4096 Jun 22 21:09 mysql
drwxrwx---  7 www-data www-data 4096 Jan 29 00:35 nextcloud_data
drwxr-xr-x  4 nzbget   dietpi   4096 Jun 22 17:09 nzbget

thats it.

and what about

ls -la /mnt/hd500/dietpi_userdata/mysql
ls -la /mnt/hd500/dietpi_userdata/mysql
total 122968
drwxr-xr-x 7 mysql   mysql     4096 Jun 22 21:09 .
drwxr-xr-x 9 root    root      4096 Jun 22 16:25 ..
-rw-rw---- 1 proftpd mysql    16384 Jun 22 16:35 aria_log.00000001
-rw-rw---- 1 proftpd mysql       52 Jun 22 16:35 aria_log_control
-rw-r--r-- 1 root    root         0 Jun 22 16:35 debian-10.3.flag
-rw-r--r-- 1 mysql   mysql        0 Jun 22 21:14 demo.file
-rw-rw---- 1 mysql   mysql      900 Jun 22 16:35 ib_buffer_pool
-rw-rw---- 1 proftpd mysql 50331648 Jun 22 18:54 ib_logfile0
-rw-rw---- 1 proftpd mysql 50331648 Jun 22 15:25 ib_logfile1
-rw-rw---- 1 proftpd mysql 12582912 Jun 22 16:35 ibdata1
-rw-rw---- 1 mysql   mysql 12582912 Jun 22 18:55 ibtmp1
-rw-rw---- 1 proftpd mysql        0 Jun 22 15:26 multi-master.info
drwx------ 2 proftpd mysql     4096 Jun 22 15:26 mysql
-rw-rw---- 1 root    mysql       16 Jun 22 15:26 mysql_upgrade_info
drwx------ 2     110 mysql    12288 Apr  2 17:11 nextcloud
drwx------ 2 proftpd mysql     4096 Jun 22 15:26 performance_schema
drwx------ 2     110 mysql     4096 Nov 28  2019 phpmyadmin
-rw-rw---- 1 mysql   mysql    24576 Jun 22 18:55 tc.log
drwx------ 2 proftpd mysql     4096 Jun 22 15:27 wordpress
root@DietPi:~#

there you go. Files and folders are owned by user proftpd. There are as well folders with unknown user ID 110. Did you have done anything with FTP and/or copied data??

You can do following to change owner back to user mysql

chown -R mysql:mysql /mnt/hd500/dietpi_userdata/mysql
systemctl restart mariadb.service
systemctl status mariadb.service

Did not move/copied anything with proftpd.

This solution works for me:

You can do following to change owner back to user mysql

chown -R mysql:mysql /mnt/hd500/dietpi_userdata/mysql
systemctl restart mariadb.service
systemctl status mariadb.service

Mariadb start after a reboot

Many tnks, Your great. :smiley: :smiley: :smiley: :smiley: :smiley:

Graag gedaan

Your kidding with me :wink: :wink:

Je spreek schrijf nederlands. hahaha

Tnx.

Greetings. Nick