Mariadb Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
User avatar
DutchFlash
Posts: 22
Joined: Tue Jun 12, 2018 2:31 pm
Location: Netherlands(Rotterdam)

Mariadb

Post by DutchFlash »

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

Dietpi v6.30 fresh install.
What to do.

Code: Select all

[  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 ;)
User avatar
Joulinar
Posts: 2059
Joined: Sat Nov 16, 2019 12:49 am

Re: Mariadb

Post by Joulinar »

Hi,

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

pls can you check following

Code: Select all

systemctl restart mariadb.service
journalctl -u mariadb
cat /var/log/mysql/error.log
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
DutchFlash
Posts: 22
Joined: Tue Jun 12, 2018 2:31 pm
Location: Netherlands(Rotterdam)

Re: Mariadb

Post by DutchFlash »

Hi Joulinar,

Damm i thought you are dutch ;) :)

oke here are the results.

Code: Select all

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:~# 

Code: Select all

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:~#

Code: Select all

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.
User avatar
Joulinar
Posts: 2059
Joined: Sat Nov 16, 2019 12:49 am

Re: Mariadb

Post by Joulinar »

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

Code: Select all

df -h
lsblk -o name,label,size,ro,type,mountpoint,partuuid,uuid
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
DutchFlash
Posts: 22
Joined: Tue Jun 12, 2018 2:31 pm
Location: Netherlands(Rotterdam)

Re: Mariadb

Post by DutchFlash »

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.

Code: Select all

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

Code: Select all

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
User avatar
Joulinar
Posts: 2059
Joined: Sat Nov 16, 2019 12:49 am

Re: Mariadb

Post by Joulinar »

ok let's check if links are set correctly

Code: Select all

readlink /var/lib/mysql
readlink -f /var/lib/mysql
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
DutchFlash
Posts: 22
Joined: Tue Jun 12, 2018 2:31 pm
Location: Netherlands(Rotterdam)

Re: Mariadb

Post by DutchFlash »

oke the results are.

Code: Select all

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

Code: Select all

readlink -f /var/lib/mysql
/mnt/hd500/dietpi_userdata/mysql
root@DietPi:~#
seems to be oke ?
User avatar
Joulinar
Posts: 2059
Joined: Sat Nov 16, 2019 12:49 am

Re: Mariadb

Post by Joulinar »

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

Code: Select all

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

Code: Select all

sudo -u mysql -g mysql touch /var/lib/mysql/demo.file
ls -la /mnt/hd500/dietpi_userdata/
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
DutchFlash
Posts: 22
Joined: Tue Jun 12, 2018 2:31 pm
Location: Netherlands(Rotterdam)

Re: Mariadb

Post by DutchFlash »

oke.

Code: Select all

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.
User avatar
Joulinar
Posts: 2059
Joined: Sat Nov 16, 2019 12:49 am

Re: Mariadb

Post by Joulinar »

and what about

Code: Select all

ls -la /mnt/hd500/dietpi_userdata/mysql
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply