7

I can't get the ClamAV daemon to start on my Ubuntu 14.04 server. Here's what I get when I try to start the service:

sudo service clamav-daemon start
* Starting ClamAV daemon clamd  [fail]

When I try to run the clamdscan here's what I get

clamdscan test.jpg
ERROR: Could not lookup (null): Servname not supported for ai_socktype

----------- SCAN SUMMARY -----------
Infected files: 0
Total errors: 1
Time: 0.000 sec (0 m 0 s)

When I run the normal clamscan on the file, everything is fine:

clamscan test.jpg
test.jpg: OK

----------- SCAN SUMMARY -----------
Known viruses: 3708601
Engine version: 0.98.5
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.18 MB
Data read: 0.18 MB (ratio 1.02:1)
Time: 9.991 sec (0 m 9 s)

Here are the packages I have installed related to ClamAV:

> dpkg -l | grep 'clam'
ii  clamav                              0.98.5+addedllvm-0ubuntu0.14.04.1   amd64        anti-virus utility for Unix - command-line interface
ii  clamav-base                         0.98.5+addedllvm-0ubuntu0.14.04.1   all          anti-virus utility for Unix - base package
ii  clamav-daemon                       0.98.5+addedllvm-0ubuntu0.14.04.1   amd64        anti-virus utility for Unix - scanner daemon
ii  clamav-freshclam                    0.98.5+addedllvm-0ubuntu0.14.04.1   amd64        anti-virus utility for Unix - virus database update utility
ii  libclamav6                          0.98.5+addedllvm-0ubuntu0.14.04.1   amd64        anti-virus utility for Unix - library

Here are the contents of /etc/clamav/clamd.conf http://paste.ubuntu.com/9544920/

Here are the contents of ll /var/run/ http://paste.ubuntu.com/9553966/

2
  • Please delete all of your coments as they have been incorporated into your question already... ;) Furthermore, post the output of :ll /var/run/clamav/clamd.ctl (we're now going to go through the entire clamd config) :(
    – Fabby
    Dec 17, 2014 at 17:59
  • Could you please add the output of ll /var/run/ to your question in a few minutes? I'll remove the redundant/unhelpful info first.
    – Fabby
    Dec 17, 2014 at 19:19

3 Answers 3

7

The problem was memory usage. Apparently clamav-daemon uses about 300MB of memory when all the virus libraries loaded. I'm running on a small VPS with 1GB of RAM and mysql-server-5.6 takes up a big chunk of that. To improve performance I added performance_schema = off to /etc/mysql/my.cnf which reduced memory consumption by about 400MB! (why is this the new default in 5.6.6?!). Anyway, that freed up some memory which allowed clamav-daemon to start without a problem.

1
  • Can't believe clamav-daemon doesn't throw some specific error for this issue! Thank god for your comment otherwise I would have wasted a lot more time trying to figure out the problem Feb 18, 2020 at 10:50
4

We've got it! :-) Type the following commands in a terminal Ctrl+Alt+T

sudo touch /var/run/clamav/clamd.ctl
sudo chown clamav:clamav /var/run/clamav/clamd.ctl

start clamd again!

3

I have run into this issue pretty consistently when provisioning vagrant boxes with clamav. Ensuring definitions have been downloaded and restarting the service consistently fixes it.

sudo freshclam && sudo service clamav-daemon restart

2
  • +1 thank you! I was provisioning a vagrant box and this was the solution that worked for me.
    – Jose B
    May 1, 2016 at 11:51
  • after messing with docker memory limits for a while, this was the fix
    – Oli
    Nov 29, 2016 at 12:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .