恢复 MariaDB 屏蔽服务

恢复 MariaDB 屏蔽服务

我遇到过 MariaDB 服务被屏蔽的情况。这是在一位同事试图从 Debian 11 服务器中删除软件包时发生的。显然,软件包管理员警告过他,但在当天匆忙之中他继续操作,现在 MariaDB 服务已停止并被屏蔽。

因此我们尝试恢复服务文件以使用

sudo systemctl enable mariadb

但之后当我尝试启动该服务时

sudo systemctl start mariadb

我们得到错误。这是 journalctl -xe 的摘录:

Nov 12 07:52:32 localhost kernel: [UFW BLOCK] IN=ens192 OUT= MAC=01:00:5e:00:00:01:4c:e1:75:dd:e0:a5:08:00 SRC=192.168.10.1 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=19831 PROTO=2 
Nov 12 07:53:05 localhost sudo[91874]: developer : TTY=pts/0 ; PWD=/etc/systemd/system ; USER=root ; COMMAND=/usr/bin/systemctl enable mariadb
Nov 12 07:53:05 localhost sudo[91874]: pam_unix(sudo:session): session opened for user root(uid=0) by developer(uid=1000)
Nov 12 07:53:05 localhost systemd[1]: Reloading.
Nov 12 07:53:05 localhost systemd[1]: Configuration file /lib/systemd/system/mariadb.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Nov 12 07:53:05 localhost systemd[1]: Configuration file /lib/systemd/system/mariadb.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. P>
Nov 12 07:53:05 localhost systemd[1]: /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf:2: Assignment outside of section. Ignoring.
Nov 12 07:53:05 localhost systemd[1]: /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf:3: Assignment outside of section. Ignoring.
Nov 12 07:53:05 localhost systemd[1]: Reloading.
Nov 12 07:53:05 localhost systemd[1]: Configuration file /lib/systemd/system/mariadb.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Nov 12 07:53:05 localhost systemd[1]: Configuration file /lib/systemd/system/mariadb.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. P>
Nov 12 07:53:05 localhost systemd[1]: /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf:2: Assignment outside of section. Ignoring.
Nov 12 07:53:05 localhost systemd[1]: /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf:3: Assignment outside of section. Ignoring.
Nov 12 07:53:05 localhost systemd[1]: Configuration file /lib/systemd/system/mariadb.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Nov 12 07:53:05 localhost systemd[1]: Configuration file /lib/systemd/system/mariadb.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. P>
Nov 12 07:53:05 localhost systemd[1]: /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf:2: Assignment outside of section. Ignoring.
Nov 12 07:53:05 localhost systemd[1]: /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf:3: Assignment outside of section. Ignoring.
Nov 12 07:53:05 localhost systemd[1]: Reloading.
Nov 12 07:53:05 localhost systemd[1]: Configuration file /lib/systemd/system/mariadb.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Nov 12 07:53:05 localhost systemd[1]: Configuration file /lib/systemd/system/mariadb.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. P>
Nov 12 07:53:05 localhost systemd[1]: /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf:2: Assignment outside of section. Ignoring.
Nov 12 07:53:05 localhost systemd[1]: /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf:3: Assignment outside of section. Ignoring.
Nov 12 07:53:06 localhost sudo[91874]: pam_unix(sudo:session): session closed for user root
Nov 12 07:53:22 localhost sudo[91949]: developer : TTY=pts/0 ; PWD=/etc/systemd/system ; USER=root ; COMMAND=/usr/bin/systemctl restart mariadb
Nov 12 07:53:22 localhost sudo[91949]: pam_unix(sudo:session): session opened for user root(uid=0) by developer(uid=1000)
Nov 12 07:53:22 localhost systemd[1]: Starting MariaDB 10.3.39 database server...
 Subject: A start job for unit mariadb.service has begun execution
 Defined-By: systemd
 Support: https://www.debian.org/support
 
 A start job for unit mariadb.service has begun execution.
 
 The job identifier is 97288.
Nov 12 07:53:22 localhost mysqld[91957]: /usr/sbin/mysqld: error while loading shared libraries: libsnappy.so.1: cannot open shared object file: No such file or directory
Nov 12 07:53:22 localhost systemd[1]: mariadb.service: Main process exited, code=exited, status=127/n/a
 Subject: Unit process exited
 Defined-By: systemd
 Support: https://www.debian.org/support
 
 An ExecStart= process belonging to unit mariadb.service has exited.
 
 The process' exit code is 'exited' and its exit status is 127.
Nov 12 07:53:22 localhost systemd[1]: mariadb.service: Failed with result 'exit-code'.


 

任何帮助都将受到赞赏。

谢谢你!

答案1

您的问题在于此错误消息:

Nov 12 07:53:22 localhost mysqld[91957]: /usr/sbin/mysqld: error while loading shared libraries: libsnappy.so.1: cannot open shared object file: No such file or directory

看起来你缺少了libsnappy.so.1。你可以通过以下方式安装它:

sudo apt install libsnappy1v5

相关内容