Summary: | [openrc] app-antivirus/clamav-0.94.2 - init.d script fails to start/stop clamd | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Joakim <moonwalker> |
Component: | Current packages | Assignee: | Net-Mail Packages <net-mail+disabled> |
Status: | RESOLVED WORKSFORME | ||
Severity: | normal | CC: | antivirus, binki |
Priority: | High | ||
Version: | 2008.0 | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Joakim
2008-11-29 06:59:28 UTC
(In reply to comment #0) > When stopping clamav it looks like all is fine: > mail / # /etc/init.d/clamd stop > * Stopping clamd ... [ ok ] > * Stopping freshclam ... [ ok ] > > it's just that clamd never stopped aka pid is not killed: > mail / # /etc/init.d/clamd start > * Starting clamd ... * start-stop-daemon: /usr/sbin/clamd is already running > * Failed to start clamd > I have the same problem. I have openrc-0.3.0-r1. The following is the command the /etc/init.d/clamd stop() function uses to "stop" one clamav process. However, I removed the --quiet switch: nbisgentoo64 ~ # start-stop-daemon --stop --name freshclam * start-stop-daemon: no matching processes found nbisgentoo64 ~ # echo $? 0 nbisgentoo64 ~ # pidof freshclam 15894 Thus, start-stop-daemon (at least from openrc-0.3.0-r1) returns 0 even though it reports that it can't find a process. I fixed this on my system locally by using replacing "--name freshclam" with "--exec /usr/bin/freshclam". I did likewise for clamav-milter and clamd. I think this change is justifiable because the start() function of /etc/init.d/clamd uses the --exec parameter to start up the clamav processes. If you pass "--exec /usr/sbin/clamd" to start-stop-daemon to start clamd, shouldn't it be passed to start-stop-daemon when stopping the process? However, because the "pidof freshclam" command worked, shouldn't the "--name freshclam" parameter also work? The solution I am using may be a workaround of an OpenRC/start-stop-daemon bug, but I am not willing to try going back to an earlier baselayout to test this possibility. I have exactly the same problem. http://forums.gentoo.org/viewtopic-t-718952-highlight-.html I'll just add a killall commands to init scripts. (In reply to comment #2) > I have exactly the same problem. > http://forums.gentoo.org/viewtopic-t-718952-highlight-.html > > I'll just add a killall commands to init scripts. > I'd recommend against a plain killall command. I think the -w option of killall may be enough, though, because that'll make killall wait for clamd to terminate. If you use killall without any arguments, it'll merely send SIGTERM and not check up on the clamd process. Then you'll run into problems using the "rc-service clamd restart" command, as clamd would be started again before the old daemon exited. However, I'm still guessing that the whole problem is an OpenRC start-stop-daemon bug in handling --name. I'll try to remember to check OpenRC's bug tracker and the newest version later. Thank you for the info Nathan. I'm aware restart won't work. And to tell you the truth i did it your way. Changed my mind later. :-) Worksforme using openrc-0.4.1. Please test and reopen if it's still an issue for you with openrc-0.4.1. homer clamav # /etc/init.d/clamd start * Starting clamd... [ ok ] * Starting freshclam... [ ok ] homer clamav # ps axf|grep clam 19722 ? SNs 0:00 /usr/sbin/clamd 19727 ? SNs 0:00 /usr/bin/freshclam -d homer clamav # /etc/init.d/clamd stop * Stopping clamd... [ ok ] * Stopping freshclam... [ ok ] homer clamav # ps axf|grep clam homer clamav # (In reply to comment #5) > Worksforme using openrc-0.4.1. Please test and reopen if it's still an issue > for you with openrc-0.4.1. works for me with openrc-0.4.1 too - but not with openrc-0.3.?. So this was an OpenRC bug that was fixed and will probably fix many other initscripts too: ddclient, nfs, xdm, and other scripts in my install use start-stop-daemon's --name switch as well. Thanks for pointing this out. |