clamav-daemon fails to start

Bug #1784193 reported by Barry Kolts
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
clamav (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

lsb_release -rd
Description: Ubuntu 18.04.1 LTS
Release: 18.04

 apt-cache policy clamav
clamav:
  Installed: 0.100.1+dfsg-1ubuntu0.18.04.2

Expected clamav-daemon to be running.

What happens:
clamav-daemon fails to start

sudo systemctl status clamav-daemon
● clamav-daemon.service - Clam AntiVirus userspace daemon
   Loaded: loaded (/lib/systemd/system/clamav-daemon.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2018-07-28 19:53:14 CDT; 6s ago
     Docs: man:clamd(8)
           man:clamd.conf(5)
           https://www.clamav.net/documents/
  Process: 3589 ExecStart=/usr/sbin/clamd --foreground=true (code=exited, status=1/FAILURE)
 Main PID: 3589 (code=exited, status=1/FAILURE)

Jul 28 19:53:04 Bionic-Desktop systemd[1]: Started Clam AntiVirus userspace daemon.
Jul 28 19:53:14 Bionic-Desktop clamd[3589]: Sat Jul 28 19:53:14 2018 -> !LOCAL: Could not create socket directory: /var/run/clamav: Permission denied
Jul 28 19:53:14 Bionic-Desktop clamd[3589]: Sat Jul 28 19:53:14 2018 -> !LOCAL: Socket file /var/run/clamav/clamd.ctl could not be bound: No such file or directory
Jul 28 19:53:14 Bionic-Desktop clamd[3589]: Sat Jul 28 19:53:14 2018 -> !Can't unlink the socket file /var/run/clamav/clamd.ctl
Jul 28 19:53:14 Bionic-Desktop systemd[1]: clamav-daemon.service: Main process exited, code=exited, status=1/FAILURE
Jul 28 19:53:14 Bionic-Desktop systemd[1]: clamav-daemon.service: Failed with result 'exit-code'.

What other information can I provide?

Revision history for this message
Barry Kolts (bhkolts) wrote :

I was able to fix this by copying /lib/systemd/system/clamav-daemon.service to /etc/systemd/system/clamav.service and adding the two lines:
ExecStartPre=-/bin/mkdir /run/clamav
ExecStartPre=/bin/chown clamav /run/clamav
to the top of the [Service] section.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

In my bionic container, I installed clamav-daemon (and its dependencies) and it worked right out of the box.

Of note, however, is this extend.conf systemd file shown in systemctl status clamav-daemon:
root@bionic-clamav-1784193:~# systemctl status clamav-daemon
● clamav-daemon.service - Clam AntiVirus userspace daemon
   Loaded: loaded (/lib/systemd/system/clamav-daemon.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/clamav-daemon.service.d
           └─extend.conf
   Active: inactive (dead)
     Docs: man:clamd(8)
           man:clamd.conf(5)
           https://www.clamav.net/documents/

That file has the mkdir and chown commands you showed:
root@bionic-clamav-1784193:~# cat /etc/systemd/system/clamav-daemon.service.d/extend.conf
[Service]
ExecStartPre=-/bin/mkdir /run/clamav
ExecStartPre=/bin/chown clamav /run/clamav

That is created by clamav-daemon's postinst script, so it should have happened when you installed the package, unless that failed for some reason (not shown in this bug report).

These are the packages I have:
ii clamav 0.100.1+dfsg-1ubuntu0.18.04.2 amd64 anti-virus utility for Unix - command-line interface
ii clamav-base 0.100.1+dfsg-1ubuntu0.18.04.2 all anti-virus utility for Unix - base package
ii clamav-daemon 0.100.1+dfsg-1ubuntu0.18.04.2 amd64 anti-virus utility for Unix - scanner daemon
ii clamav-freshclam 0.100.1+dfsg-1ubuntu0.18.04.2 amd64 anti-virus utility for Unix - virus database update utility
ii libclamav7:amd64 0.100.1+dfsg-1ubuntu0.18.04.2 amd64 anti-virus utility for Unix - library

Can you try removing your workaround, and reinstalling the packages? And check if that extend.conf file is created, and/or if there is some error during postinst?

The only thing I saw when installing it was a harmless id command showing that the clamav user doesn't exist at the time of installation:
...
Setting up clamav-base (0.100.1+dfsg-1ubuntu0.18.04.2) ...
id: ‘clamav’: no such user
Processing triggers for ureadahead (0.100.0-20) ...
...

Changed in clamav (Ubuntu):
status: New → Incomplete
Revision history for this message
Barry Kolts (bhkolts) wrote :

Andreas,
In /etc/systemd/system/clamav-daemon.service.d I have extend.conf.dpkg.old instead of extend.conf. That is where I got the two lines
ExecStartPre=-/bin/mkdir /run/clamav
ExecStartPre=/bin/chown clamav /run/clamav
from. Tjat would explain why i don't have the Drop-in line.
The packages I have are
ii clamav 0.100.1+dfsg-1ubuntu0.18.04.2 amd64 anti-virus utility for Unix - command-line interface
ii clamav-base 0.100.1+dfsg-1ubuntu0.18.04.2 all anti-virus utility for Unix - base package
ii clamav-daemon 0.100.1+dfsg-1ubuntu0.18.04.2 amd64 anti-virus utility for Unix - scanner daemon
ii clamav-freshclam 0.100.1+dfsg-1ubuntu0.18.04.2 amd64 anti-virus utility for Unix - virus database update utility
ii libclamav7:amd64 0.100.1+dfsg-1ubuntu0.18.04.2 amd64 anti-virus utility for Unix - library
Which appear to be the same as yours.
Looking in /var/log/apt/term file I see the line id:'clamav': no such user, but no other errors.

I would be glad to uninstall and re-install to see if /etc/systemd/system/clamav-daemon.service/extend.conf.dpkd.old has the right file name if you like.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

That extend.conf file has some complicated handling in clamav-daemon's postinst. It even tries to handle a .dpkg-old copy of it.

You could purge and reinstall, but to fix your installation that shouldn't be necessary (and would be annoying if you have configured clamav to your liking already). You can just restore the extend.conf file in /etc/systemd/system/clamav-daemon.service.d and get rid of your customizations.

But if you can purge and reinstall (making sure to remove your customized file, and the dpkg.old one as well), that should also work, and would put you back on track with what the packages expect to find for future upgrades.

Revision history for this message
Barry Kolts (bhkolts) wrote :

After a few purges and re-installs I have some insight into this. My goal was to use clamav with Thunderbird's plugin clamrib. In order to do that I need to add to lines two to clamav-daemon.conf. So I thought I needed use dpkg-reconfigure clamav-daemon and pick no for manually configure. That is what added .dpkg.old to extend.conf. So I did a purge and re-install and just added my two lines to clamav-daemon.conf and all is working as expected. According to the first dialog box in dpkg-reconfigure, see the third picture in my attachment notes.txt,I shouldn't have to worry about future upgrades removing my additions to clamav-daemon.conf.

As a side note, I tried using dpkg-reconfigure and pick yes to handle the configuration automatically. I picked all the default values until it started looping between the two dialog boxes shown at the top of my attachment. I don't think I need to use dpkg-reconfigure.

At this point I'm not sure if I have discovered a bug or just didn't understand what I was doing. In any case thank you for your help and time.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

> I picked all the default values until it started looping between the two dialog boxes
> shown at the top of my attachment.

That is indeed a bug, and it was filed recently: https://bugs.launchpad.net/ubuntu/+source/clamav/+bug/1783897

Maybe once that is fixed we won't have the dpkg-old problem you encountered here.

Thanks for getting back to us about what happened and what you tried. I will mark this bug as a duplicate of #1783897 for the time being. That dpkg-reconfigure loop prevents us from checking what would happen at the end of the reconfigure session: if the extend.conf file would be there, unrenamed, or not.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.