Centos

即使作為 root 使用者,也無法在 Centos 7 中啟動服務並出現錯誤“授權不可用”

  • August 21, 2021

我無法為以下 Centos 7 伺服器啟動服務

[root@myserver home]# uname -r
3.10.0-1160.11.1.el7.x86_64
[root@myserver home]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

當我觀察到 docker 宕機時,我第一次意識到有問題,所以我以 root 身份執行以下命令

[root@myserver home]# systemctl start docker
Authorization not available. Check if polkit service is running or see debug message for 
more information.
Failed to start docker.service: Connection timed out
See system logs and 'systemctl status docker.service' for details.
[root@myserver home]# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: https://docs.docker.com

然後我跑了

[root@myserver home]# systemctl | grep -i fail
● firewalld.service                          loaded failed     failed      firewalld - dynamic firewall daemon
● plymouth-start.service                     loaded failed     failed      Show Plymouth Boot Screen
● polkit.service                             loaded failed     failed      Authorization Manager
● systemd-machined.service                   loaded failed     failed      Virtual Machine and Container Registration Service
● tuned.service                              loaded failed     failed      Dynamic System Tuning Daemon

[root@myserver home]# systemctl status polkit.service
● polkit.service - Authorization Manager
   Loaded: loaded (/usr/lib/systemd/system/polkit.service; static; vendor preset: enabled)
   Active: failed (Result: timeout) since Thu 2021-02-04 11:14:54 GMT; 5h 45min ago
     Docs: man:polkit(8)
  Process: 7932 ExecStart=/usr/lib/polkit-1/polkitd --no-debug (code=killed, signal=TERM)
 Main PID: 7932 (code=killed, signal=TERM)

 Feb 04 11:13:23 myserver.com systemd[1]: Starting Authorization Manager...
 Feb 04 11:13:48 myserver.com polkitd[7932]: Started polkitd version 0.112
 Feb 04 11:14:54 myserver.com systemd[1]: polkit.service start operation timed out. Terminating.
 Feb 04 11:14:54 myserver.com systemd[1]: Failed to start Authorization Manager.
 Feb 04 11:14:54 myserver.com systemd[1]: Unit polkit.service entered failed state.
 Feb 04 11:14:54 myserver.com systemd[1]: polkit.service failed.

我不知道對伺服器進行的任何更新。我認為這些問題是在計劃外重啟後開始的,但我無法確定重啟的原因。為什麼啟動授權管理器會超時?有人對進一步調查有什麼建議嗎?

我發了一個

[root@myserver home]# reboot

命令,它似乎正在工作。之前,當我遇到最初的問題時,我使用過

[root@myserver home]# shutdown -r now

我很好奇為什麼這兩個命令的差異導致了我最初的問題……

只是記錄我的情況,這可以幫助一些人

polkit 是一種策略服務,這意味著其他一些服務在執行操作之前需要它的授權

如果我嘗試啟動或重新啟動網路或 sshd 等任何服務,則在 kvm 備份還原訪客 VM 使用 centos 7 後出現問題,系統在顯示此消息幾秒鐘後重新啟動

Authorization not available. Check if polkit service is running or see debug message for more information.

就我而言,polkit 抱怨 dbus 錯誤,例如

Failed to connect to system bus: Connection refused

journalctl -b -p 錯誤

我發現 dbus 缺少磁碟原因問題

解決方案很容易從 fstab 中刪除失去的磁碟

我也在這裡發現了類似的問題https://www.thegeekdiary.com/authorization-not-available-check-if-polkit-service-is-running-or-see-debug-message-for-more-information-centos- rhel-7-ssh-服務錯誤/

引用自:https://serverfault.com/questions/1052415