centos8 snapd.service无法启动的问题处理
一、先说解决方案
这里说明,不一定都适用,如果还不行,可以参照下面的问题定位过程进行问题排查,找到适合自己的方案。
//更新包
dnf upgrade libmodulemd
yum update libseccomp
//启动服务
systemctl start snapd
systemctl status snapd
二、问题定位过程
1. 安装epel-release的问题
yum install epel-release
输出:
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
解决方法:
dnf upgrade libmodulemd
2. 安装core时候的报错
snap install core
输出:(这里添加了回车,方便看)
error: cannot communicate with server: Post "http://localhost/v2/snaps/core":
read unix @->/run/snapd.socket: read: connection reset by peer
3. 查看服务状态
systemctl status snapd
输出:
● snapd.service - Snap Daemon
Loaded: loaded (/usr/lib/systemd/system/snapd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2023-03-14 10:35:50 CST; 1min 20s ago
Process: 1256 ExecStart=/usr/libexec/snapd/snapd (code=exited, status=1/FAILURE)
Main PID: 1256 (code=exited, status=1/FAILURE)
3月 14 10:35:50 xvgate-prd-1 systemd[1]: snapd.service: Service RestartSec=100ms expired, scheduling restart.
3月 14 10:35:50 xvgate-prd-1 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 5.
3月 14 10:35:50 xvgate-prd-1 systemd[1]: Stopped Snap Daemon.
3月 14 10:35:50 xvgate-prd-1 systemd[1]: snapd.service: Start request repeated too quickly.
3月 14 10:35:50 xvgate-prd-1 systemd[1]: snapd.service: Failed with result 'exit-code'.
3月 14 10:35:50 xvgate-prd-1 systemd[1]: Failed to start Snap Daemon.
3月 14 10:35:50 xvgate-prd-1 systemd[1]: snapd.service: Triggering OnFailure= dependencies.
4. 尝试使用systemctl启动服务
systemctl start snapd
输出:
Job for snapd.service failed because the control process exited with error code.
See "systemctl status snapd.service" and "journalctl -xe" for details.
5. 尝试手动启动snapd服务查看报错
/usr/libexec/snapd/snapd
输出:
2023/03/14 10:47:24.005908 overlord.go:268: Acquiring state lock file
2023/03/14 10:47:24.005985 overlord.go:273: Acquired state lock file
2023/03/14 10:47:24.008997 daemon.go:247: started snapd/2.58.3-1.el8 (series 16; classic; devmode) centos/8 (amd64) linux/4.18.0-240.22.1.el8_3.x86.
2023/03/14 10:47:24.031423 daemon.go:340: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
2023/03/14 10:47:24.031749 backends.go:58: AppArmor status: apparmor not enabled
cannot run daemon: state startup errors: [cannot obtain snap-seccomp version information: /usr/libexec/snapd/snap-seccomp: symbol lookup error: /usr/libexec/snapd/snap-seccomp: undefined symbol: seccomp_notify_respond]
6. 更新libseccomp
通过undefined symbol: seccomp_notify_respond
的报错定位到是libseccomp版本太低,于是进行升级
yum update libseccomp
7. 再次启动snapd.service
systemctl start snapd
成功