一、背景
安装chrony.rpm后启动chronyd发生“Job for chronyd.service failed because the control process exited with error code. See “systemctl status chronyd.service” and “journalctl -xe” for details.”的报错
二、研究报错原因
[root@localhost santi]# systemctl status chronyd.service
● chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2024-10-21 14:47:48 EDT; 1min 35s ago
Docs: man:chronyd(8)
man:chrony.conf(5)
Process: 6031 ExecStartPost=/usr/libexec/chrony-helper update-daemon (code=exited, status=0/SUCCESS)
Process: 6488 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exited, status=127)
Main PID: 6026 (code=exited, status=0/SUCCESS)
Oct 21 14:47:48 localhost systemd[1]: Starting NTP client/server...
Oct 21 14:47:48 localhost chronyd[6488]: /usr/sbin/chronyd: error while loading shared libraries: libsec...tory
Oct 21 14:47:48 localhost systemd[1]: chronyd.service: control process exited, code=exited status=127
Oct 21 14:47:48 localhost systemd[1]: Failed to start NTP client/server.
Oct 21 14:47:48 localhost systemd[1]: Unit chronyd.service entered failed state.
Oct 21 14:47:48 localhost systemd[1]: chronyd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
问题显示“error while loading shared libraries: libsec…tory”但没有显示完毕,最后一句,“Hint: Some lines were ellipsized, use -l to show in full.”
因此可以通过“systemctl status chronyd.service -l”查看;
[root@localhost santi]# systemctl status chronyd.service -l
● chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2024-10-21 14:58:02 EDT; 7s ago
Docs: man:chronyd(8)
man:chrony.conf(5)
Process: 6031 ExecStartPost=/usr/libexec/chrony-helper update-daemon (code=exited, status=0/SUCCESS)
Process: 6995 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exited, status=127)
Main PID: 6026 (code=exited, status=0/SUCCESS)
Oct 21 14:58:02 localhost systemd[1]: Starting NTP client/server...
Oct 21 14:58:02 localhost chronyd[6995]: /usr/sbin/chronyd: error while loading shared libraries: libseccomp.so.2: cannot open shared object file: No such file or directory
Oct 21 14:58:02 localhost systemd[1]: chronyd.service: control process exited, code=exited status=127
Oct 21 14:58:02 localhost systemd[1]: Failed to start NTP client/server.
Oct 21 14:58:02 localhost systemd[1]: Unit chronyd.service entered failed state.
Oct 21 14:58:02 localhost systemd[1]: chronyd.service failed.
显示“/usr/sbin/chronyd: error while loading shared libraries: libseccomp.so.2: cannot open shared object file: No such file or directory”,没有找到libseccomp.so.2这个库依赖文件。
也可以通过“journalctl -xe”查看问题。
三、解决方案
1)本主机没有libseccomp.so.2文件
当本主机没有该文件时,可从别的主机复制libseccomp.so.2文件,放置在/home/user/下;
并在在root下cp将文件传到/usr/lib64/目录下,这样属主和所在组为root,方法有效
2)本主机有libseccomp.so.2文件
当本主机有该文件时,也需要在root下cp将文件传到/usr/lib64/目录下,这样属主和所在组为root,方法有效
3)手动更改libseccomp.so.2文件属性
补充操作,但手动更改属主,所在组和操作权限结果测试会失败
[root@localhost santi]# mv libseccomp.so.2 /usr/lib64/
# 查看拥有者和所属组
[root@localhost lib64]# ll | grep libseccomp.so.2
-rw-rw-r--. 1 santi santi 266688 Oct 21 15:13 libseccomp.so.2
# 更改拥有者
[root@localhost lib64]# chown root libseccomp.so.2
[root@localhost lib64]#
[root@localhost lib64]# ll | grep libseccomp.so.2
-rw-rw-r--. 1 root santi 266688 Oct 21 15:13 libseccomp.so.2
[root@localhost lib64]#
# 更改所属组
[root@localhost lib64]# chgrp root libseccomp.so.2
[root@localhost lib64]#
# 查看现状
[root@localhost lib64]# ll | grep libseccomp.so.2
-rw-rw-r--. 1 root root 266688 Oct 21 15:13 libseccomp.so.2
# 更改操作权限
[root@localhost lib64]# ll | grep libSegFault.so
-rwxr-xr-x. 1 root root 21904 Sep 29 2020 libSegFault.so
[root@localhost lib64]#
[root@localhost lib64]# ll | grep libseccomp.so.2
-rw-rw-r--. 1 root root 266688 Oct 21 15:13 libseccomp.so.2
# 也修改成rwx rx x
# r 4
# w 2
# x 1
# 也就是需要chmod 751
[root@localhost lib64]# chmod 751 libseccomp.so.2
[root@localhost lib64]#
[root@localhost lib64]# ll | grep libseccomp.so.2
-rwxr-x--x. 1 root root 266688 Oct 21 15:13 libseccomp.so.2