MariaDB won't start after reboot, Ubuntu 20.04.6, exit status 127
I had MariaDB running smoothly for over a year, then my server rebooted and now it won't start. I have searched for answers and tried several things to no avail.
my OS is Ubuntu 20.04.6 LTS
I ran apt update and apt upgrade, but still get the same error, which is as follows:
root@nrh-azu-lnx-001:/home/steve# systemctl status mariadb â mariadb.service - MariaDB 10.3.38 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2023-11-15 10:32:56 PST; 2min 35s ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Main PID: 817 (code=exited, status=127)
Nov 15 10:32:56 nrh-azu-lnx-001 systemd[1]: Starting MariaDB 10.3.38 database server... Nov 15 10:32:56 nrh-azu-lnx-001 mysqld[817]: /usr/sbin/mysqld: error while loading shared libraries: liblz4.so.1: cannot open shared object file: No such file or directory Nov 15 10:32:56 nrh-azu-lnx-001 systemd[1]: mariadb.service: Main process exited, code=exited, status=127/n/a Nov 15 10:32:56 nrh-azu-lnx-001 systemd[1]: mariadb.service: Failed with result 'exit-code'. Nov 15 10:32:56 nrh-azu-lnx-001 systemd[1]: Failed to start MariaDB 10.3.38 database server. root@nrh-azu-lnx-001:/home/steve# systemctl start mariadb Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.
root@nrh-azu-lnx-001:/home/steve# journalctl -xe -u mariadb.service -- An ExecStart= process belonging to unit mariadb.service has exited. -- -- The process' exit code is 'exited' and its exit status is 127. Nov 15 10:32:56 nrh-azu-lnx-001 systemd[1]: mariadb.service: Failed with result 'exit-code'. -- Subject: Unit failed -- Defined-By: systemd -- Support: http://www.ubuntu.com/support -- -- The unit mariadb.service has entered the 'failed' state with result 'exit-code'. Nov 15 10:32:56 nrh-azu-lnx-001 systemd[1]: Failed to start MariaDB 10.3.38 database server. -- Subject: A start job for unit mariadb.service has failed -- Defined-By: systemd -- Support: http://www.ubuntu.com/support -- -- A start job for unit mariadb.service has finished with a failure. -- -- The job identifier is 176 and the job result is failed. Nov 15 10:36:03 nrh-azu-lnx-001 systemd[1]: Starting MariaDB 10.3.38 database server... -- Subject: A start job for unit mariadb.service has begun execution -- Defined-By: systemd -- Support: http://www.ubuntu.com/support -- -- A start job for unit mariadb.service has begun execution. -- -- The job identifier is 629. Nov 15 10:36:03 nrh-azu-lnx-001 mysqld[2274]: /usr/sbin/mysqld: error while loading shared libraries: liblz4.so.1: cannot open shared object file: No such file or directory Nov 15 10:36:03 nrh-azu-lnx-001 systemd[1]: mariadb.service: Main process exited, code=exited, status=127/n/a -- Subject: Unit process exited -- Defined-By: systemd -- Support: http://www.ubuntu.com/support -- -- An ExecStart= process belonging to unit mariadb.service has exited. -- -- The process' exit code is 'exited' and its exit status is 127. Nov 15 10:36:03 nrh-azu-lnx-001 systemd[1]: mariadb.service: Failed with result 'exit-code'. -- Subject: Unit failed -- Defined-By: systemd -- Support: http://www.ubuntu.com/support -- -- The unit mariadb.service has entered the 'failed' state with result 'exit-code'. Nov 15 10:36:03 nrh-azu-lnx-001 systemd[1]: Failed to start MariaDB 10.3.38 database server. -- Subject: A start job for unit mariadb.service has failed -- Defined-By: systemd -- Support: http://www.ubuntu.com/support -- -- A start job for unit mariadb.service has finished with a failure. -- -- The job identifier is 629 and the job result is failed.
Answer Answered by Steve Healy in this comment.
I found the solution - it's a conflict with apparmor.
These commands fixed it for me, although it also disables apparmor for mariadb:
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld sudo systemctl restart mariadb