大网数据广告活动
服务器运维问答

mariadb.service start stuck at activating

· 52CE 我爱测

I just installed the mariadb in my ubuntu 19.10 by sudo apt install mariadb-server mariadb-client after when I am trying to start the server by sudo systemctl start mariadb.service shell get freeze I have to use Ctl+c to get shel…

问题原文

原帖链接 · Sarthak Kumar · CC BY-SA 4.0

I just installed the mariadb in my ubuntu 19.10 by sudo apt install mariadb-server mariadb-client after when I am trying to start the server by sudo systemctl start mariadb.service shell get freeze I have to use Ctl+c to get shell running.
In the status it's showing activating(start)

  • Other services are working fine with systemctl start
~$ sudo systemctl status mariadb.service  


mariadb.service - MariaDB 10.3.22 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: activating (start) since Mon 2020-04-20 08:44:57 IST; 5min ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 10705 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
  Process: 10707 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 10711 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSRE
 Main PID: 10759 (mysqld)
    Tasks: 15 (limit: 4915)
   Memory: 64.6M
   CGroup: /system.slice/mariadb.service
           └─10759 /usr/sbin/mysqld

Apr 20 08:44:57 TheCybertron systemd[1]: Starting MariaDB 10.3.22 database server...
Apr 20 08:44:57 TheCybertron mysqld[10759]: 2020-04-20  8:44:57 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0ubuntu0.19.10.1) starting as process 10759 ...

已采纳解答

原帖链接 · Ale · CC BY-SA 4.0

You probably had MySQL installed beforehand. This 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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-04-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。