<div dir="ltr"><div><div><div>Package: clamav</div><div>Version: 0.99.2+dfsg-2</div></div><div><br></div><div>Hi,</div><div>we've got a bug reported to Ubuntu (<a href="http://pad.lv/1590688">pad.lv/1590688</a>) that I looked into.</div><div>All issues apply to sid as well, so I wanted to provide my fix for your review, discussion and inclusion.</div><div><br></div><div>## The case ##</div><div>1. "sudo apt-get install clamav-daemon clamav-freshclam"</div><div>2. ClamAV doesn't start even though it should.</div><div><br></div><div>$ systemctl status clamav-daemon</div><div>● clamav-daemon.service - Clam AntiVirus userspace daemon</div><div> Loaded: loaded (/lib/systemd/system/clamav-daemon.service; enabled; vendor preset: enabled)</div><div> Active: inactive (dead)</div><div>Condition: start condition failed at Thu 2016-06-09 11:58:19 EEST; 7min ago</div><div> Docs: man:clamd(8)</div><div> man:clamd.conf(5)</div><div> <a href="http://www.clamav.net/lang/en/doc/">http://www.clamav.net/lang/en/doc/</a></div><div><br></div><div>$ systemctl status clamav-freshclam.service</div><div>● clamav-freshclam.service - ClamAV virus database updater</div><div> Loaded: loaded (/lib/systemd/system/clamav-freshclam.service; enabled; vendor preset: enabled)</div><div> Active: inactive (dead)</div><div> Docs: man:freshclam(1)</div><div> man:freshclam.conf(5)</div><div> <a href="http://www.clamav.net/lang/en/doc/">http://www.clamav.net/lang/en/doc/</a></div><div><br></div><div><br></div><div>## The issues ##</div><div>#1 - freshclam not starting after install anymore (works in jessie)</div><div> => That part is a regression.</div><div>#2 - clamav-daemon is blocked on the condition of having the db available, but after it is available doesn't get started</div><div> => That part (more or less) always behaved that way</div><div><br></div><div>Eventually the user needs to manually start freshclam to get it working.</div><div>Then wait a while until the db is available and then (re-)start the clamav-daemon to pick up it is available.</div><div><br></div><div>## Solutions ##</div><div>1. get freshclam started on install by moving some sections in the postinst</div><div> (should be fixed as it is a regression)</div><div> For this I have a debdiff provided to ease your work (and it was also the way I built and tested it).</div><div><br></div><div>2. let clamav-daemon start automatically after the files are made available.</div><div> 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.</div><div> It might look like:</div><div> [Unit]</div><div> Description=Path Activation for Clam AntiVirus userspace daemon</div><div> Documentation=man:clamd(8) man:clamd.conf(5) <a href="http://www.clamav.net/lang/en/doc/">http://www.clamav.net/lang/en/doc/</a></div><div><br></div><div> [Path]</div><div> # Check and wait for database existence before starting up</div><div> PathExistsGlob=@DBDIR@/main.{c[vl]d,inc}</div><div> PathExistsGlob=@DBDIR@/daily.{c[vl]d,inc}</div><div><br></div><div> [Install]</div><div> WantedBy=sockets.target</div><div><br></div><div>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.</div><div>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.</div><div>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.</div></div><div><br></div><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="color:rgb(136,136,136);font-size:12.8px">Christian Ehrhardt</span><div style="color:rgb(136,136,136);font-size:12.8px">Software Engineer, Ubuntu Server</div><div style="color:rgb(136,136,136);font-size:12.8px">Canonical Ltd</div></div></div></div></div></div>
</div>