MariaDB not starting

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
User avatar
johnvick
Legend
Posts: 589
Joined: Wed Jun 08, 2016 10:53 am
Location: New Zealand

MariaDB not starting

Post by johnvick » Thu Feb 14, 2019 4:11 am

This is the message - any ideas on how to fix? Uninstall/reinstall didn't help.

Feb 14 17:08:11 Z83 systemd[1]: Starting MariaDB 10.1.37 database server...
Feb 14 17:08:12 Z83 mysqld[1684]: 2019-02-14 17:08:12 140339973317056 [Note] /us
r/sbin/mysqld (mysqld 10.1.37-MariaDB-0+deb9u1) starting as process 1684 ...
Feb 14 17:08:12 Z83 mysqld[1684]: 2019-02-14 17:08:12 140339973317056 [Warning]
Can't create test file /var/lib/mysql/Z83.lower-test
Feb 14 17:08:12 Z83 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Feb 14 17:08:12 Z83 systemd[1]: Failed to start MariaDB 10.1.37 database server.
Feb 14 17:08:12 Z83 systemd[1]: mariadb.service: Unit entered failed state.
Feb 14 17:08:12 Z83 systemd[1]: mariadb.service: Failed with result 'exit-code'.
[email protected]:~# systemctl status mariadb.service
● mariadb.service - MariaDB 10.1.37 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-02-14 17:08:12 NZDT; 42s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 1684 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 1607 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environmen
t _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 1603 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 1600 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Main PID: 1684 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"

Feb 14 17:08:11 Z83 systemd[1]: Starting MariaDB 10.1.37 database server...
Feb 14 17:08:12 Z83 mysqld[1684]: 2019-02-14 17:08:12 140339973317056 [Note] /usr/sbin/mysqld (mysqld 10.1.37-MariaDB-0+deb9u1) starting as process 1684 ...
Feb 14 17:08:12 Z83 mysqld[1684]: 2019-02-14 17:08:12 140339973317056 [Warning] Can't create test file /var/lib/mysql/Z83.lower-test
Feb 14 17:08:12 Z83 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Feb 14 17:08:12 Z83 systemd[1]: Failed to start MariaDB 10.1.37 database server.
Feb 14 17:08:12 Z83 systemd[1]: mariadb.service: Unit entered failed state.
Feb 14 17:08:12 Z83 systemd[1]: mariadb.service: Failed with result 'exit-code'.

User avatar
MichaIng
Legend
Posts: 1134
Joined: Sat Nov 18, 2017 5:21 pm

Re: MariaDB not starting

Post by MichaIng » Sat Feb 16, 2019 5:38 pm

Can't create test file /var/lib/mysql/Z83.lower-test
Perhaps a permissions issue?
chown -R mysql:mysql /var/lib/mysql

User avatar
johnvick
Legend
Posts: 589
Joined: Wed Jun 08, 2016 10:53 am
Location: New Zealand

Re: MariaDB not starting

Post by johnvick » Sat Feb 16, 2019 6:35 pm

Thanks MichaIng but this is the result:

[email protected]:~# systemctl status mariadb.service
● mariadb.service - MariaDB 10.1.37 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2019-02-17 07:32:39 NZDT; 12s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 1082 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 1005 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _
WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 1000 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 997 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Main PID: 1082 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"

Feb 17 07:32:37 Z83 systemd[1]: Starting MariaDB 10.1.37 database server...
Feb 17 07:32:39 Z83 mysqld[1082]: 2019-02-17 7:32:39 140082421084608 [Note] /usr/sbin/mysqld (mysqld 10.1.37-MariaDB-0+deb9u1) starting as process 1082 ...
Feb 17 07:32:39 Z83 mysqld[1082]: 2019-02-17 7:32:39 140082421084608 [Warning] Can't create test file /var/lib/mysql/Z83.lower-test
Feb 17 07:32:39 Z83 mysqld[1082]: [90B blob data]
Feb 17 07:32:39 Z83 mysqld[1082]: 2019-02-17 7:32:39 140082421084608 [ERROR] Aborting
Feb 17 07:32:39 Z83 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Feb 17 07:32:39 Z83 systemd[1]: Failed to start MariaDB 10.1.37 database server.
Feb 17 07:32:39 Z83 systemd[1]: mariadb.service: Unit entered failed state.
Feb 17 07:32:39 Z83 systemd[1]: mariadb.service: Failed with result 'exit-code'.

User avatar
MichaIng
Legend
Posts: 1134
Joined: Sat Nov 18, 2017 5:21 pm

Re: MariaDB not starting

Post by MichaIng » Thu Feb 21, 2019 9:19 pm

@johnvick
Do you have apparmor installed? https://dba.stackexchange.com/questions ... lower-test

We place a symlink to /var/lib/mysql to link it to /mnt/dietpi_userdata/mysql to easily allow database files on external drive.
However in case of apparmor the actual mysql dir location needs to be added with write permissions to the related apparmor config and perhaps it does not allow the symlink at all. Note 100% sure currently based on the link above.
In case a bind mount seems to be the workaround, but I think we need to do some changes to the MariaDB installer then to not remove the database on reinstall.

In another case SELinux was the issue, so basically similar :D.

User avatar
johnvick
Legend
Posts: 589
Joined: Wed Jun 08, 2016 10:53 am
Location: New Zealand

Re: MariaDB not starting

Post by johnvick » Thu Feb 21, 2019 11:35 pm

I'm pretty sure I don't have apparmor installed. /etc/appmor.d containf a fil with a few comments only.

I don't think I need mariadb on this device anyway so I'll take it out, it must be a leftover some something I did before.

John

User avatar
MichaIng
Legend
Posts: 1134
Joined: Sat Nov 18, 2017 5:21 pm

Re: MariaDB not starting

Post by MichaIng » Fri Feb 22, 2019 12:01 am

:D Okay. Perhaps check out the content of /var/lib/mysql/, as the database names (directory names inside) could give you some hint which software uses/used it ;).

Post Reply