[Bug 267844] security/clamav: ERROR: Can't save PID to file /var/run/clamav/clamd.pid

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 18 Nov 2022 09:04:10 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267844

            Bug ID: 267844
           Summary: security/clamav: ERROR: Can't save PID to file
                    /var/run/clamav/clamd.pid
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: yasu@freebsd.org
          Reporter: ohartmann@walstatt.org
             Flags: maintainer-feedback?(yasu@freebsd.org)
          Assignee: yasu@freebsd.org

Running security/clamav on recent CURRENT (14.0-CURRENT #108
main-n259290-f556a05c4926: Thu Nov 17 19:44:14 CET 2022 amd64). After the last
update, a couple of day ago from today (performing daily updates), clamd won't
startup again, see the error below.

This issue is well known if /var/run is on tmpfs or any other memory backed
filesystem vanishing after a reboot (this is a very common procedure in
environments of elevated security):

[...]
#:/usr/src # service clamav-clamd restart
clamav_clamd not running? (check /var/run/clamav/clamd.pid).
Starting clamav_clamd.
ERROR: Can't save PID to file /var/run/clamav/clamd.pid: No such file or
directory
/usr/local/etc/rc.d/clamav-clamd: WARNING: failed to start clamav_clamd

In /etc/rc.conf the tag 

var_run_enable="YES"

is set (all other var_run_ options are left untouched so far). The issue shown
below has been discussed recently, I provided an alteration to the rc script
checking for the existence of /var/run at startup of clamav. According to man
rc.conf(5) setting this variable/tag to YES should provide saving the folder
tree layout of /var/run and saving this to /var/db/mtree. Obvously, this isn't
correctly done, /var/db/mtree is empty on those hosts (var/db is on a
non-volatile device).

When I did the update of security/clamav, clamav-clamd was already running,
var/run/clamav existed. Shutting down/rebooting the system then left var/run
untouched after recreating, so I suppose this method is either flawed or it
doesn't work properly with clamav-clamd.

-- 
You are receiving this mail because:
You are the assignee for the bug.