Unable to start httpd service on Centos 7 "GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject"

Unable to start httpd service on Centos 7 "GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject"

尝试(重新)启动 httpd 服务时出现以下错误:

** (pkttyagent:2574): WARNING **: 01:33:55.345: Unable to register authentication agent:
GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject Error registering authentication agent:
GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject (polkit-error-quark, 0) Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

然后

systemctl status httpd.service

没有说明问题:

httpd.service - Web server Apache
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2020-07-22 01:33:55 BST; 26min ago
  Process: 2578 ExecStart=/usr/local/apache/bin/apachectl start (code=exited, status=1/FAILURE)

Jul 22 01:33:55 server... systemd[1]: Starting Web server Apache...
Jul 22 01:33:55 server... systemd[1]: httpd.service: control process exited, code=exited status=1
Jul 22 01:33:55 server... systemd[1]: Failed to start Web server Apache.
Jul 22 01:33:55 server... systemd[1]: Unit httpd.service entered failed state.
Jul 22 01:33:55 server... systemd[1]: httpd.service failed.

这可能是什么原因造成的?我应该去哪里调试?

[7 月 23 日星期四 05:40:44.885963 2020] [ssl:emerg] [pid 2877:tid 140514669713280] AH02565:证书和私钥不匹配

看起来密钥和证书不匹配。请检查密钥和证书文件的 md5。

这通常发生在尝试重新启动 systemd 服务时。

解决方法如下:

运行 这作为 root

groupadd -g 23 nohidproc

usermod -a -G nohidproc polkitd

mount -o remount,rw,hidepid=2,gid=nohidproc /proc

systemctl 重启 polkit