我无法在 CentOS 上以 root 身份重新启动服务。
Unable to register authentication agent: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.PolicyKit1 was not provided by any .service files
该polkit
服务未在启动时启动。
$> systemctl status polkit
● polkit.service - Authorization Manager
Loaded: loaded (/usr/lib/systemd/system/polkit.service; static; vendor preset: enabled)
Active: inactive (dead)
Docs: man:polkit(8)
如果我尝试手动启动它:
$> systemctl status polkit
● polkit.service - Authorization Manager
Loaded: loaded (/usr/lib/systemd/system/polkit.service; static; vendor preset: enabled)
Active: active (running) since Wed 2016-12-07 11:15:26 GMT; 2s ago
Docs: man:polkit(8)
Main PID: 2079 (polkitd)
CGroup: /system.slice/polkit.service
└─2079 /usr/lib/polkit-1/polkitd --no-debug
Dec 07 11:15:26 sk-generic systemd[1]: Starting Authorization Manager...
Dec 07 11:15:26 sk-generic polkitd[2079]: Started polkitd version 0.112
Dec 07 11:15:26 sk-generic polkitd[2079]: Loading rules from directory /etc/polkit-1/rules.d
Dec 07 11:15:26 sk-generic polkitd[2079]: Loading rules from directory /usr/share/polkit-1/rules.d
Dec 07 11:15:26 sk-generic polkitd[2079]: Error opening rules directory: Error opening directory '/usr/share/polkit-1/rules.d': Permission denied (g-file-error-quark, 2)
Dec 07 11:15:26 sk-generic polkitd[2079]: Finished loading, compiling and executing 2 rules
Dec 07 11:15:26 sk-generic systemd[1]: Started Authorization Manager.
Dec 07 11:15:26 sk-generic polkitd[2079]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
该permission denied
错误很可疑(尽管该服务似乎正在运行)。
$> ls -l /usr/share/ | grep polkit-1
lrwxrwxrwx. 1 root root 25 Dec 7 11:04 polkit-1 -> /usr/share.local/polkit-1
$> ls -l /usr/share.local/ | grep polkit-1
drwxr-xr-x. 4 root root 34 Jun 9 2014 polkit-1
$> ls -l /usr/share.local/polkit-1/
total 4
drwxr-xr-x. 2 root root 4096 Dec 7 10:53 actions
drwx------. 2 polkitd root 6 Jun 9 2014 rules.d
我已将/usr/share
一些其他初始安装后文件移至 NFS 共享。但上述权限似乎是正确的,并且/usr/share/polkit-1
是指向当地的文件系统。
现在如果做这样的事情:
$> service network restart
虚拟机网络图标闪烁片刻,但随后整个机器完全锁定。systemctl restart network
以同样的方式失败。
我的原始理论是因为 NFS 不支持 inotify,所以 dbus 出现故障。
$> systemctl status dbus -l
...
Cannot setup inotify for `/usr/share/dbus-1/...
然后我回到/usr/share/dbus-1
本地文件系统(通过软链接)并重新启动,systemctl status dbus -l
似乎一切都很好,直到我运行service network restart
时整个机器因 policykit 错误而锁定。我移动/usr/share/polkit-1
到本地文件系统,这让我们到了这里。
policykit 出了什么问题?或者说,为什么服务无法启动?