Apache2 无法重新加载/重新启动(org.freedesktop.PolicyKit1 错误)

Apache2 无法重新加载/重新启动(org.freedesktop.PolicyKit1 错误)

显示的错误是:

Failed to reload apache2.service: The name org.freedesktop.PolicyKit1 was not provided by 
any .service files See system logs and 'systemctl status apache2.service' for details.

我运行了以下两个命令,返回的日志分别是:

systemctl status apache2.service
journalctl -xe

日志:

systemctl status apache2.service

● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2017-02-21 18:41:29 IST; 33min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 14374 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS
  Process: 14396 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCE
   CGroup: /system.slice/apache2.service
           ├─14414 /usr/sbin/apache2 -k start
           ├─14417 /usr/sbin/apache2 -k start
           └─14418 /usr/sbin/apache2 -k start

journalctl -xe

-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit apache2.service has begun starting up.
Feb 21 18:41:28 oxygen apache2[14396]:  * Starting Apache httpd web server apache2
Feb 21 18:41:28 oxygen apache2[14396]: [Tue Feb 21 18:41:28.950705 2017] [core:error] [pid 14413:tid 140406115329920] (EAI 2)Name or service not known: AH00547: Could n
Feb 21 18:41:28 oxygen apache2[14396]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 45.56.70.225. Set the 'ServerName'
Feb 21 18:41:29 oxygen apache2[14396]:  *
Feb 21 18:41:29 oxygen systemd[1]: Started LSB: Apache2 web server.
-- Subject: Unit apache2.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit apache2.service has finished starting up.
--
-- The start-up result is done.
Feb 21 18:41:48 oxygen sudo[14475]:     root : TTY=pts/1 ; PWD=/root ; USER=root ; COMMAND=/usr/sbin/a2ensite indiairapp.com.cong
Feb 21 18:41:48 oxygen sudo[14475]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Feb 21 18:41:48 oxygen sudo[14475]: pam_unix(sudo:session): session closed for user root
Feb 21 18:41:51 oxygen sudo[14480]:     root : TTY=pts/1 ; PWD=/root ; USER=root ; COMMAND=/usr/sbin/a2ensite indiairapp.com.conf
Feb 21 18:41:51 oxygen sudo[14480]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Feb 21 18:41:51 oxygen sudo[14480]: pam_unix(sudo:session): session closed for user root
Feb 21 18:45:01 oxygen CRON[14492]: pam_unix(cron:session): session opened for user root by (uid=0)
Feb 21 18:45:01 oxygen CRON[14493]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Feb 21 18:45:01 oxygen CRON[14492]: pam_unix(cron:session): session closed for user root
Feb 21 18:47:01 oxygen CRON[14495]: pam_unix(cron:session): session opened for user root by (uid=0)
Feb 21 18:47:01 oxygen CRON[14496]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 21 18:47:01 oxygen CRON[14495]: pam_unix(cron:session): session closed for user root
Feb 21 18:55:01 oxygen CRON[14498]: pam_unix(cron:session): session opened for user root by (uid=0)
Feb 21 18:55:01 oxygen CRON[14499]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Feb 21 18:55:01 oxygen CRON[14498]: pam_unix(cron:session): session closed for user root
Feb 21 18:58:59 oxygen sudo[14518]:  nauman3 : TTY=pts/3 ; PWD=/etc/apache2/sites-available ; USER=root ; COMMAND=/bin/nano /etc/apache2/sites-available/indiairapp.conf
Feb 21 18:58:59 oxygen sudo[14518]: pam_unix(sudo:session): session opened for user root by nauman3(uid=0)
Feb 21 19:00:45 oxygen sudo[14518]: pam_unix(sudo:session): session closed for user root
Feb 21 19:00:49 oxygen sudo[14520]:  nauman3 : TTY=pts/3 ; PWD=/etc/apache2/sites-available ; USER=root ; COMMAND=/usr/sbin/a2ensite indiairapp.conf
Feb 21 19:00:49 oxygen sudo[14520]: pam_unix(sudo:session): session opened for user root by nauman3(uid=0)
Feb 21 19:00:49 oxygen sudo[14520]: pam_unix(sudo:session): session closed for user root
Feb 21 19:05:01 oxygen CRON[14534]: pam_unix(cron:session): session opened for user root by (uid=0)
Feb 21 19:05:01 oxygen CRON[14535]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Feb 21 19:05:01 oxygen CRON[14534]: pam_unix(cron:session): session closed for user root
Feb 21 19:15:01 oxygen CRON[14547]: pam_unix(cron:session): session opened for user root by (uid=0)
Feb 21 19:15:01 oxygen CRON[14548]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Feb 21 19:15:01 oxygen CRON[14547]: pam_unix(cron:session): session closed for user root

答案1

这是一个权限问题,apache serversystemctl命令应以特权运行root

sudo systemctl reload apache2

答案2

尝试

sudo apache2ctl 配置测试

这应该能让您更好地了解当前的问题。

(可能相关:Apache 无法重新启动

相关内容