软件包更新失败后 mariadb 服务器崩溃

软件包更新失败后 mariadb 服务器崩溃

前几天我遇到了一个问题,mariadb 的服务器包无法正确更新并且无法再运行。

Log started: 2016-07-19  04:00:34
Setting up mariadb-server-10.1 (10.1.16+maria-1~jessie) ...
Job for mariadb.service failed. See 'systemctl status mariadb.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mariadb-server-10.1 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
mariadb-server-10.
Log ended: 2016-07-19  04:00:52

主要错误信息是。

root@box{~}:systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
       └─migrated-from-my.cnf-settings.conf
Active: failed (Result: exit-code) since Tue 2016-07-19 04:00:52 PDT; 17s ago
Process: 38259 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=227/NO_NEW_PRIVILEGES)
Process: 38256 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 38098 ExecStartPre=/bin/sh -c VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] &&   systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 38073 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 38259 (code=exited, status=227/NO_NEW_PRIVILEGES)

Jul 19 04:00:52 box.example.com systemd[38259]: Failed at step NO_NEW_PRIVILEGES spawning /usr/sbin/mysqld: Invalid argument
Jul 19 04:00:52 box.example.com systemd[1]: mariadb.service: main process exited, code=exited, status=227/NO_NEW_PRIVILEGES
Jul 19 04:00:52 box.example.com systemd[1]: Failed to start MariaDB database server.
Jul 19 04:00:52 box.example.com systemd[1]: Unit mariadb.service entered failed state.

尝试清除并重新安装该包并不能解决问题。

There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!

因此我尝试了一个小包管理器进行管理。

dpkg --configure -a    
apt-get clean
apt-get install -f

mariadb 故障排除指南特别有用。

mysqld --help --verbose | grep 'log-error' | tail -1
mysqld --help --verbose | grep 'datadir' | tail -1

https://mariadb.com/kb/en/mariadb/troubleshooting-installation-issues/

直到我尝试安装和卸载 perconadb 作为 mariadb 的替代品时,我才注意到一个有关有问题的符号链接的错误,我删除了该错误并似乎解决了该问题。

Preconfiguring packages ...
(Reading database ... 72430 files and directories currently installed.)
Removing percona-server-server-5.7 (5.7.13-6-1.jessie) ...
/usr/bin/deb-systemd-helper: error: unable to link /etc/systemd/system/mysql.service to /dev/null: File exists

答案1

该问题与当前内核的年代有关,内核更新可以修复该问题。例如,在使用 3.2 内核的 D​​ebian Stretch 上遇到该问题时,升级到 4.9(发行版默认设置)可以修复该问题。

相关内容