After upgrading to baselayout-1.12.0_pre5 on one of my servers I discovred that I was unable to start any courier-imap daemons any more. The reason was that courier-authlib will not start with this version of baselayout and all the other courier processes depend on that. Reproducible: Always Steps to Reproduce: 1. # emerge -u "=sys-apps/baselayout-1.12.0_pre5" 2. # reboot 3. # /etc/init.d/courier-authlib start Actual Results: The last command printed out the following error message: pidof: invalid options on command line! and the daemon did not start (ps aux reports no authdaemon processes) Expected Results: The daemon should have been started successfuly which can be checked e.g. with: # ps aux | grep authdaemon This should report a number (the actual number depends on the /etc/courier/authlib/authdaemonrc settings) of daemons listening for authentication requests. It seems that the reason for that problem stems from the method used to compute the pids related to a particular daemon. Those operations are performed in the /lib/rcscripts/sh/rc-daemon.sh file. The method used fetches the command line arguments from the daemon invoation and feeds them into pidof. This method assumes that those arguments that are program names will return the relevant pids, those that are something else will return nothing. What has been overlooked is the pidof behavior. When an argument begins with a minus sign it returns an error message as mentioned earlier. A quck fix for this problem would be to add a line that reads as the following: args=`echo $args | sed "s/'-\+/'/g"` before the pidof invocation on line 191: eval /bin/pidof -x ${args} The additional line strips the leading minus signs from the parameters which fixes the problem. I have encountered that problem only when trying to start Courier Imap but I suspect that other daemons may be affected as well.
I can verify that this problem also occurs with the new 1.12.0_pre6 version of baselayout: # /etc/init.d/courier-authlib start * Starting courier-authlib: authdaemond ... pidof: invalid options on command line! [ !! ] This is with the following package versions: sys-apps/baselayout-1.12.0_pre6 net-libs/courier-authlib-0.57 net-mail/courier-imap-4.0.4 Please also see Bug 98745 (apparently the newer baselayout's causes problems with "courier-authlib" + "courier-imap" but not with the full "courier" package, although I have not tested the latter myself)
I am aswell getting this error with 1.12.0_pre5 and 1.12.0_pre6 of baselayout * Starting courier-authlib: authdaemond ... pidof: invalid options on command line! [ !! ] Im thinking in the source in 'start-stop-daemon' the pidof command has the wrong argument?
I can confirm that baselayout-1.12.0_pre6 still behaves the same way and the same workaround in /lib/rcscripts/sh/rc-daemon.sh fixes it.
Could someone test editing the courier-authlib init script and changing line 30 to read /usr/bin/env $logger -- -pid="$pidfile" -start "${AUTHLIB}/${AUTHDAEMOND}" I don't think that rc-daemon.sh is at fault here - it's the faulty calling of start-stop-daemon again.
I changed line # 30 in /etc/init.d/courier-authlib according to your suggestion and it does fix the problem. Courier Authlib now starts without any problem with the unaltered rc-daemon.sh from baselayout-1.12.0_pre6 (meantime I updated my baselayout but the same should be the case with 1.12.0_pre5).
If I manually runs this, it starts fine, so it has to be something with baselayout. jupiter ~ # source /etc/courier/authlib/authdaemonrc jupiter ~ # AUTHLIB="/usr/lib/courier/courier-authlib" jupiter ~ # AUTHDAEMOND="authdaemond" jupiter ~ # pidfile="/var/run/authdaemon.pid" jupiter ~ # logger="/usr/sbin/courierlogger" jupiter ~ # start-stop-daemon --quiet --start --pidfile "$pidfile" -- exec /usr/bin/env -- - $logger -pid="$pidfile" -start "${AUTHLIB}/ ${AUTHDAEMOND}" jupiter ~ # cd /var/lib/init.d/started/ jupiter started # ln -s /etc/init.d/courier-authlib Then I can start courier, since it sees courier-authlib as if it was started by init.
(In reply to comment #4) > Could someone test editing the courier-authlib init script and changing line 30 > to read > /usr/bin/env $logger -- -pid="$pidfile" -start "${AUTHLIB}/${AUTHDAEMOND}" > I don't think that rc-daemon.sh is at fault here - it's the faulty calling of > start-stop-daemon again. That works fine :-)
Fixed in 0.57-r1 - or just re-emerge your current version.
*** Bug 103602 has been marked as a duplicate of this bug. ***