mariadb.service start stuck at activating

You probably had MySQL installed beforehand. Is a known bug: MySQL installs an AppArmor profile, and the MariaDB package fails to properly uninstall it (see details on Launchpad).

You can use these commands to solve the problem (adapted from the bug mentioned above):

sudo systemctl stop mariadb
echo "/usr/sbin/mysqld { }" | sudo tee /etc/apparmor.d/usr.sbin.mysqld
sudo apparmor_parser -v -R /etc/apparmor.d/usr.sbin.mysqld

This should display Removal succeeded for "/usr/sbin/mysqld".

Then, very important:

sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/usr.sbin.mysqld

Without this, some AppArmor profile comes back after reboot (not sure from where), preventing MariaDB from loading at all (unable to load libaio).

You can then start MariaDB with sudo systemctl start mariadb

Leave a Comment