Httpd – Identifying Service Error in Fedora 16

apache-2.2fedorahttpd

How do you find the cause of a failed service start in Fedora 16? The new systemctl command in Fedora 16 seems to horribly obscure any useful logging info.

[root@host ~]# systemctl start httpd.service
Job failed. See system logs and 'systemctl status' for details.
[root@host ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server (prefork MPM)
      Loaded: loaded (/lib/systemd/system/httpd.service; enabled)
      Active: failed since Thu, 21 Jun 2012 16:26:56 -0400; 1min 23s ago
     Process: 2119 ExecStop=/usr/sbin/httpd $OPTIONS -k stop (code=exited, status=0/SUCCESS)
     Process: 2215 ExecStart=/usr/sbin/httpd $OPTIONS -k start (code=exited, status=1/FAILURE)
    Main PID: 1062 (code=exited, status=0/SUCCESS)
      CGroup: name=systemd:/system/httpd.service

So the first command fails…and it tells me to run another command…which simply tells me that the command returned an error code. Where's the actual error?

Even more frustrating is nothing seems to have been written to the logs:

[root@host ~]# ls -lah /var/log/httpd/
total 8.0K
drwx------.  2 root root 4.0K Jun 21 16:19 .
drwxr-xr-x. 21 root root 4.0K Jun 20 16:33 ..
-rw-r-----   1 root root    0 Jun 21 16:19 modsec_audit.log
-rw-r-----   1 root root    0 Jun 21 16:19 modsec_debug.log

Best Answer

OK - it looks like the problem you're having has been discussed and will be updated in the new version of Fedora but in the meantime you can do the following :

Modify the file /etc/systemd/system.conf - change the option DefaultStandardError to DefaultStandardError=syslog

When you now run this and the server has a syntax error it will tell you to check in the logs for the error :

[root@Acer-Laptop ~]# systemctl start httpd.service Job failed. See system logs and 'systemctl status' for details.

I can see this was written successfully as well :

[root@Acer-Laptop ~]# less /var/log/messages | grep httpd Jun 23 09:24:03 Acer-Laptop httpd[4896]: Syntax error on line 32 of /etc/httpd/conf/httpd.conf: Jun 23 09:24:03 Acer-Laptop httpd[4896]: Invalid command 'SyntaxError', perhaps misspelled or defined by a module not included in the server configuration Jun 23 09:24:03 Acer-Laptop systemd[1]: httpd.service: control process exited, code=exited status=1 Jun 23 09:24:03 Acer-Laptop systemd[1]: Unit httpd.service entered failed state.

Hope this helps!