quite often i have a bug with start-stop-daemon depended daemons (sshd, apache, nscd, xdm and many others...) similar to this: /sbin/start-stop-daemon: /usr/sbin/apache2 died ERROR: apache2 failed to start ... but it doesn't mean that apache for example doesn't work. I can say more, these daemons always work properly, even the script has failed. I've discovered that when I remove a piece of code: if (retestpid) { if (do_stop (NULL, NULL, pidfile, uid, 0, true, false, true) < 1) eerrorx ("%s: %s died", progname, exec); } in start-stop-daemon.c(1032) the problem disappeared and everything works fine. I know that this dirty hack is does not solve this problem. That's why I'm writing about this bug here. Reproducible: Sometimes Steps to Reproduce: This bug appears mostly during booting sequence. Probablility increases when RC_PARALLEL_STARTUP is set to "yes". Manually it's hard to reproduce.
Daemons should not return until a valid and working pidfile is available and working. Otherwise races can happen - and this bug too. apache2 and ntpd are good example of this. We have a patch for ntp available on bug #169002, although upstream don't like it. I would create a new bug for each daemon you have this problem with and add it as a dependency to this bug. ssh, xdm (+kdm +gdm) and nscd should all work without error though - at least they do on my boxes.
Just one note here - Slawomir, please, don't bug baselayout people about apache initscript issues; it's been discussed over and over again on Bug 110556 and numerous duplicates. Gentoo apache maintainers have no intentions to keep hacking on this. If latest initscripts shipped w/ apache-2.2.4-r7 do not work for you, feel free to introduce whatever sleep and whatnot hacks there, we won't do it. The only fix that would be considered is fixing apache to behave (i.e., do not return success until the pidfile has been created on start, and do not return success until all apache processes have stopped on stop/restart - as Uberlord noted above.) Thanks.
Open bugs for the daemons in question, not baselayout.