Re: How to debug why a service doesn't want to start.
Lukas Beeler <[email protected]>
| Newsgroups | gmane.comp.misc.pape.general |
|---|---|
| Message-ID | <[email protected]> |
* Charles M. Gerungan <[email protected]>: > >>For completeness' sake. This can't be seen from the trace, right? > > > >Not from the trace you provided (because it didn't follow the > >execution of your runfile, because you haven't specified an > >option to follow forks). > > From my the message where I post the trace: > > # truss -faep 28244 > > The manpage says that -f does that (Trace decendants of the > original traced process created by fork(2), vfork(2), etc.). Yes, you are right. I wasn't fully awake yet, it seems ;) > That > it not what you meant? Or I have attached to the wrong process? > (See the grepped output of ps in that older message.) No, you did everything correctly. I've looked at your trace again, and you can see some parts of the problem when you look at it 33572: execve("/usr/bin/basename", [ "basename" ], [ "PATH=/command:/ usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/ X11R6/bin" ]) [ lots of stuff ] 33572: write(2,0x8048af0,78) = 78 (0x4e) 33572: exit(0x1) [ some more stuff ] 33570: break(0x8069000) = 0 (0x0) 33570: exit(0x1) Sadly, truss does not show what write() actually wrote (linux strace usually does that). But the 2 tells you that the message was written to stderr. Now, i we look at your runscript again: #!/bin/sh -e USER=`basename $PWD` <-- We are here! SVPATH=/home/$USER/service exec 2>&1 exec chpst -u$USER runsvdir $SVPATH So, basename tried to write something to stderr, which apparently got discarded somewhere. You also see that the shell running the scripts (33570) exited shortly after calling basename (33572). This doesn't tell you exactly what and where the problem is, but it tells you WHERE something is broken, and what is happening. This is quite a generic way to approach unix problems when you don't have enough output. The other way is to approach the problem using logic, like Laurent did. But this only works if you are already quite knowledgable on said topic. Hope this helps, Lukas