Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 921088 - =app-antivirus/clamav-1.2.1: clamd init script reporting as crashed (but running)
Summary: =app-antivirus/clamav-1.2.1: clamd init script reporting as crashed (but runn...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Antivirus Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-30 14:14 UTC by Fitzcarraldo
Modified: 2024-03-19 10:10 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fitzcarraldo 2023-12-30 14:14:58 UTC
The app-antivirus/clamav-1.2.1 OpenRC initscript specifies the wrong path for the daemon's pid file

Details of the clamav package installed:

meshedgedx /home/fitzcarraldo # eix -I clamav
[I] acct-group/clamav
     Available versions:  0-r2
     Installed versions:  0-r2(03:58:28 04/08/23)
     Description:         System group: clamav

[I] acct-user/clamav
     Available versions:  0-r2
     Installed versions:  0-r2(04:06:23 04/08/23)
     Description:         System user: clamav

[I] app-antivirus/clamav
     Available versions:  0.103.8(0/lts)^t (~)0.103.11(0/lts)^t (~)1.0.3(0/lts)^t 1.1.0(0/sts)^t (~)1.1.3(0/sts)^t (~)1.2.1(0/sts)^t {bzip2 +clamapp clamdtop clamonacc clamsubmit debug doc experimental iconv ipv6 jit libclamav-only metadata-analysis-api milter rar selinux +system-mspack systemd test xml}
     Installed versions:  1.2.1(0/sts)^t(12:16:37 30/12/23)(clamapp rar system-mspack -clamonacc -debug -doc -experimental -jit -libclamav-only -milter -selinux -systemd -test)
     Homepage:            https://www.clamav.net/
     Description:         Clam Anti-Virus Scanner

Found 3 matches

rc-status reports that clamd has crashed:

meshedgedx /home/fitzcarraldo # /etc/init.d/clamd status
 * status: crashed
 
However, the clamav daemon appears to be running:

meshedgedx /home/fitzcarraldo # ps -ef | grep clam
clamav    4885     1  0 12:04 ?        00:00:00 /usr/bin/freshclam -p /run/freshclam.pid --daemon
clamav   12813     1  4 12:55 ?        00:00:55 /usr/sbin/clamd
root     24382  6591  0 13:14 pts/1    00:00:00 grep --colour=auto clam

I looked in /etc/init.d/clamd and noticed the line:

pidfile="/run/${RC_SVCNAME}.pid"

However, for this version of clamav (and any earlier versions after upstream changed the pid file location) it should be:

pidfile="/run/clamav/${RC_SVCNAME}.pid"

I edited /etc/init.d/clamd and changed the line as shown above, then restarted clamd:

meshedgedx /home/fitzcarraldo # nano /etc/init.d/clamd 
meshedgedx /home/fitzcarraldo # rc-service clamd restart
 * Caching service dependencies ...                                             [ ok ]
 * Stopping clamd ...                                                           [ ok ]
 * Starting clamd ...                                                           [ ok ]
meshedgedx /home/fitzcarraldo # /etc/init.d/clamd status
 * status: started
 
Problem solved.


Reproducible: Always

Steps to Reproduce:
1. Install app-antivirus/clamav-1.2.1 in Gentoo Testing
2. Reboot or restart clamd
3. Check service status
Comment 1 Michael Orlitzky gentoo-dev 2023-12-30 19:17:06 UTC
(In reply to Fitzcarraldo from comment #0)
> 
> I looked in /etc/init.d/clamd and noticed the line:
> 
> pidfile="/run/${RC_SVCNAME}.pid"
> 
> However, for this version of clamav (and any earlier versions after upstream
> changed the pid file location) it should be:
> 
> pidfile="/run/clamav/${RC_SVCNAME}.pid"
> 
> I edited /etc/init.d/clamd and changed the line as shown above, then
> restarted clamd:

Upstream didn't change the default, they only changed a comment in config file -- the Gentoo ebuild uncomments it. But, the new (commented) location is insecure:

  https://github.com/Cisco-Talos/clamav/issues/1076

The old value of /run/${RC_SVCNAME}.pid is correct. The newer ebuilds should be tweaked to use it rather than the commented-out line from upstream.