即使以 root 用户身份也无法在 Centos 7 中启动服务,并出现错误“授权不可用”

即使以 root 用户身份也无法在 Centos 7 中启动服务,并出现错误“授权不可用”

我无法启动以下 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.

我不知道对服务器做了任何更新。我认为这些问题是在意外重启后开始的,但我无法确定重启的原因。为什么启动授权管理器会超时?有人对进一步调查有什么建议吗?

答案1

记录我的情况,这可能会对某些人有所帮助

polkit 是一项策略服务,这意味着其他一些服务在执行操作之前需要它的授权

问题出现在 kvm 备份恢复 guest VM 使用 centos 7 之后,如果我尝试启动或重新启动任何服务(如网络或 sshd),系统会在显示此消息几秒钟后重新启动

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-service-error/

答案2

我发布了

[root@myserver home]# reboot

命令,它似乎有效。之前,当我遇到最初的问题时,我使用

[root@myserver home]# shutdown -r now

我很好奇为什么这两个命令的差异导致了我最初的问题......

相关内容