I am getting issue with clamd and amavisd please see error message below
I am running an email server on CentOS 7.3….. amavisd and clamd seems working fine, but they keep jump up with errors every time before I send mails from my email server, and get errors if I send mails from Gmail to my email server.
Apr 4 15:37:49 mail postfix/smtpd[3367]: connect from mail-pg0-f45.google.com[74.12*.**.**]
Apr 4 15:37:49 mail postfix/smtpd[3367]: E42B1606A5C9: client=mail-pg0-f45.google.com[74.12*.**.**]
Apr 4 15:37:50 mail postfix/cleanup[3371]: E42B1606A5C9: message-id=<CAC-5EtvTiKHMGZXukkj=4rxhOKiD1f3oifaBE6QnmCnbgjM10A@mail.gmail.com>
Apr 4 15:37:50 mail postfix/qmgr[1374]: E42B1606A5C9: from=<wil*******@gmail.com>, size=2488, nrcpt=1 (queue active)
Apr 4 15:37:50 mail postfix/smtpd[3367]: disconnect from mail-pg0-f45.google.com[74.12*.**.**]
Apr 4 15:37:50 mail amavis[2097]: (02097-02) (!)connect to /var/run/clamd.amavisd/clamd.sock failed, attempt #1: Can't connect to a UNIX socket /var/run/clamd.amavisd/clamd.sock: No such file or directory
Apr 4 15:37:51 mail amavis[2097]: (02097-02) (!)connect to /var/run/clamd.amavisd/clamd.sock failed, attempt #1: Can't connect to a UNIX socket /var/run/clamd.amavisd/clamd.sock: No such file or directory
Apr 4 15:37:51 mail amavis[2097]: (02097-02) (!)ClamAV-clamd: All attempts (1) failed connecting to /var/run/clamd.amavisd/clamd.sock, retrying (2)
Apr 4 15:37:57 mail amavis[2097]: (02097-02) (!)connect to /var/run/clamd.amavisd/clamd.sock failed, attempt #1: Can't connect to a UNIX socket /var/run/clamd.amavisd/clamd.sock: No such file or directory
Apr 4 15:37:57 mail amavis[2097]: (02097-02) (!)ClamAV-clamd av-scanner FAILED: run_av error: Too many retries to talk to /var/run/clamd.amavisd/clamd.sock (All attempts (1) failed connecting to /var/run/clamd.amavisd/clamd.sock) at (eval 129) line 613.\n
Apr 4 15:37:57 mail amavis[2097]: (02097-02) (!)WARN: all primary virus scanners failed, considering backups
Please help, really appreciate it!
Best Answer
tl;dr:
The long version:
My guess is you're getting a "no such file or directory" error because the socket
/var/run/clamd.amavisd/clamd.sock
doesn't exist, which in turn is because the clam daemon isn't installed or running and listening on that socket.To fix, try
...which includes the daemon,
clamd
.By default, the service that comes with it,
/usr/lib/systemd/system/clamd@scan.service
, which in turn includes/usr/lib/systemd/system/clamd@.service
, tries to open the wrong config file, by virtue of the%i
in the service which is a placeholder for the instance name. To make the service use the amavis conf file instead, copy it to an appropriately instantiated unit:(see 9.6.5. Working with Instantiated Units in the RHEL 7 documentation for more on this)
Finally, try
and check it's running now, with
And finally enable it with
Checking the contents of
/var/run/clamd.amavisd
, you should now findclamd.sock
is present.For good measure,
And double check your logfiles that everything is working now.
If not, and if SELinux is enforcing, you may need to run the following first, for ClamAV and freshclam to function: