[Pkg-clamav-devel] Bug#827909: clamav-freshclam and clamav-daemon not starting after install

Christian Ehrhardt christian.ehrhardt at canonical.com
Wed Jun 22 12:39:50 UTC 2016


Package: clamav
Version:  0.99.2+dfsg-2

Hi,
we've got a bug reported to Ubuntu (pad.lv/1590688) that I looked into.
All issues apply to sid as well, so I wanted to provide my fix for your
review, discussion and inclusion.

## The case ##
1. "sudo apt-get install clamav-daemon clamav-freshclam"
2. ClamAV doesn't start even though it should.

$ systemctl status clamav-daemon
● clamav-daemon.service - Clam AntiVirus userspace daemon
   Loaded: loaded (/lib/systemd/system/clamav-daemon.service; enabled;
vendor preset: enabled)
   Active: inactive (dead)
Condition: start condition failed at Thu 2016-06-09 11:58:19 EEST; 7min ago
     Docs: man:clamd(8)
           man:clamd.conf(5)
           http://www.clamav.net/lang/en/doc/

$ systemctl status clamav-freshclam.service
● clamav-freshclam.service - ClamAV virus database updater
   Loaded: loaded (/lib/systemd/system/clamav-freshclam.service; enabled;
vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:freshclam(1)
           man:freshclam.conf(5)
           http://www.clamav.net/lang/en/doc/


## The issues ##
#1 - freshclam not starting after install anymore (works in jessie)
  => That part is a regression.
#2 - clamav-daemon is blocked on the condition of having the db available,
but after it is available doesn't get started
  => That part (more or less) always behaved that way

Eventually the user needs to manually start freshclam to get it working.
Then wait a while until the db is available and then (re-)start the
clamav-daemon to pick up it is available.

## Solutions ##
1. get freshclam started on install by moving some sections in the postinst
   (should be fixed as it is a regression)
    For this I have a debdiff provided to ease your work (and it was also
the way I built and tested it).

2. let clamav-daemon start automatically after the files are made available.
   This could be done by path based activation, but since these files are
actually part of clamav upstream it is probably just here for discussion
for now.
   It might look like:
     [Unit]
     Description=Path Activation for Clam AntiVirus userspace daemon
     Documentation=man:clamd(8) man:clamd.conf(5)
http://www.clamav.net/lang/en/doc/

     [Path]
     # Check and wait for database existence before starting up
     PathExistsGlob=@DBDIR@/main.{c[vl]d,inc}
     PathExistsGlob=@DBDIR@/daily.{c[vl]d,inc}

     [Install]
     WantedBy=sockets.target

I also experimented with converting the ConditionPathExists to Assert, to
get some user notification of the fact that it is not running right after
install.
But that is "too" noisy, especially as it can render the install to report
as failed when the postinst starts the service and the assert fails.
So I dropped it - If you'd like to add some output again please feel free -
I posted the (very) old output in the linked Ubuntu bug.


Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-clamav-devel/attachments/20160622/9c4f38ab/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-freshclam-not-starting-after-install.debdiff
Type: application/octet-stream
Size: 3316 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-clamav-devel/attachments/20160622/9c4f38ab/attachment.obj>


More information about the Pkg-clamav-devel mailing list