我只使用CentOS 7.2,CentOS 7.2使用的默认systemd版本(systemd 219);我刚刚找到我的物理主机,systemctl
命令无法使用。例如。如果我执行systemctl restart syslog-ng
它就会被卡住。
而只有重启才能解决这个问题。
[root@localhost /root]
#time systemctl restart syslog-ng
Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Timeout was reached (g-io-error-quark, 24)
Failed to restart syslog-ng.service: Connection timed out
real 0m25.031s
user 0m0.004s
sys 0m0.003s
所以,我只是发现 dbus 激活的 polkit 失败了。
[root@localhost /root]
#time systemctl restart polkit
Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Activation of org.freedesktop.PolicyKit1 timed out (g-dbus-error-quark, 20)
Job for polkit.service failed because a timeout was exceeded. See "systemctl status polkit.service" and "journalctl -xe" for details.
real 1m33.771s
user 0m0.003s
sys 0m0.005s
Busctl 看不到问题
[root@localhost /root]
#busctl
NAME PID PROCESS USER CONNECTION UNIT SESSION DESCRIPTION
:1.4 74375 polkitd polkitd :1.4 polkit.service - -
:1.7 75062 busctl root :1.7 sshd.service - -
net.reactivated.Fprint - - - (activatable) - -
org.freedesktop.DBus - - - - - - -
org.freedesktop.PolicyKit1 74375 polkitd polkitd :1.4 polkit.service - -
org.freedesktop.hostname1 - - - (activatable) - -
org.freedesktop.locale1 - - - (activatable) - -
org.freedesktop.login1 - - - (activatable) - -
org.freedesktop.machine1 - - - (activatable) - -
org.freedesktop.systemd1 - - - (activatable) - -
org.freedesktop.timedate1 - - - (activatable) - -
但是,如果我手动启动 polkit,everting 就可以了,systemctl 命令可以使用。
[root@localhost /root]
#/usr/lib/polkit-1/polkitd
而且,如果我使用busctl也无法激活polkit。所以我认为dbus有bug?
#busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StartUnit ss polkit.service replace
有人看到这个问题吗?我还检查了 /etc/passwd 是否存在 polkit 用户帐户。