centos7.2中启动polkit服务启动失败

1. 错误表现
在centos7.2系统中重启服务的时候报错:

Error getting authority:Eroor initializing authority:Error calling StartServiceByName for org.freedesktop.PolicyKit1:Timeout was readhed(g-io-error-quark, 24)  

Failed to restart network.service: Connection timed out

使用journalctl查看详细信息的时候会报如下错误:

[system] Failed to activate service ‘org.freedesktop.PolicyKit1’: timed out

2. 错误原因
这个是一个和polkit.service相关问题。检查polkit服务的时候发现服务停止而且同样的,尝试开启这个服务的时候报错:
当使用daemon-reload或者使用restart指令来重新加载启动polkit服务的时候,竞态条件会优先序列将会发生改变,与此同时systemctl status将会立马报告polkit卡在了启动状态。但是polkit进程实际上是在运行的,系统只是简单地忽略掉了bus属主的改变。($busctl 查看)。

3. 解决办法:

  1. 确认是否由polkitd的用户存在.
  2. 可以使用polkitd来调试错误,直接运行:
    /usr/lib/plokit-1/plokitd
  3. 重新安装polkit的包然后重启服务.
    在使用systemd 225的时候会有这类错误异常bug,但是到systemd 229的时候修复了。错误原因是当systemd 启动了这个服务的时候policykit-1的postinst杀掉了polkit的守护进程。在RHEL,CentOS,ubuntu,debain系统上均可以看到相关bug报告反馈。

4.相关链接

1.可观察到bug反馈:
https://bugs.launchpad.net/ubuntu/+source/policykit-1/+bug/1447654
https://github.com/coreos/bugs/issues/462

2.redhat对此问题的解决方案
https://access.redhat.com/solutions/1543343

3.国外stackexchange问答网站上给出的一些解释
http://unix.stackexchange.com/questions/249575/systemctl-keeps-timing-out-on-service-restart

原文地址:https://www.cnblogs.com/johnsonjie/p/11279908.html