« More Correct English | Main | Insults »

May 19, 2005

My Application Won't Start

Q: I start my Unix application (apache2 in this case) but it exits straight away and there is no message or error. What's wrong?

A: Are you sure about the lack of an error message?

Q: Yes. The prompt comes back.

A: Are you really sure?

Q: Yes.

A: Are you really, really sure?

Q: Why?

A: Well a lot of Unix applications log their messages somewhere other than the screen where you launched them. They do this because it is unwise to assume that a terminal exists - the application could have been started from cron or another application. Instead they may write messages direct to a log file, to the system console or to the system log facility. You should check all of these.

To check the system console, use dmesg. This is available on most Unixes and will show you the last n messages written to the console (where n is an arbitrary number selected by your OS vendor). To check the system log facility, you need to find the log file. It might be something like /var/log/system.log (BSD, Mac) or /var/adm/messages (Solaris). You can check for sure by investigating the syslog configuration file /etc/syslog.conf which will contain a line something like:

*.notice;authpriv;kern.debug;mail.crit    var/log/system.log

Finally, the application may have it's own log (as it does in the case of apache2). You could try guessing where this is located or you can use the administrator's second best friend*: truss(1). You invoke this (assuming that your OS has the program) as truss -f myapplication. This will generate a *lot* of output so you need to make sure you can scroll back through it (or capture it to a file). Start at the beginning of the output and look for open(something) = n where n is the relevant filehandle. Write down n and the name of the file. Keep scrolling and recording the open entries and look for write(n,....). This indicates that the program has written a message to a file and the file number (n) will match one of the open calls. Now you go find the file and check the messages.

In this particular case, apache2 is failing because the group 'nobody' is not defined.

[* The administrator's best friend would probably be fuser.]

Posted by Ozguru at May 19, 2005 06:00 AM