Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question
    
Could you try strace -f httpd 2>&1 | grep EACCES –  Andrew Smith Jun 21 '12 at 20:47
1  
Or just httpd on its own. It probably gives a useful error message that systemctl is throwing away. –  Ladadadada Jun 21 '12 at 21:52

2 Answers 2

up vote 2 down vote accepted

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!

share|improve this answer

On Fedora you can run the following command which should give you the full error message : /usr/sbin/httpd -t

The -t flag runs a syntax check on the configuration files so if there are any syntax errors there then this should help.

share|improve this answer
    
I'm actually looking for a more general solution. The whole point of something like service/systmectl is to standardize interaction with daemons. If I have to manually run each service just to get a real error message, then something is either broken or horribly designed. I've updated my question to reflect this. –  Cerin Jun 22 '12 at 15:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.