Ubuntu: Error starting ClamAV daemon



Question:

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/


Solution:1

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.


Solution:2

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!


Solution: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


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »