Postfix SMTP error caused by ClamAV "Can't connect to a UNIX socket /var/run/clamav/clamd.ctl"

Discussion in 'Installation/Configuration' started by Magiodev, Jan 4, 2019.

  1. Magiodev

    Magiodev New Member

    Hey guys! I've searched and read "all" the topics regarding this issue, but my situation does not coincide with the others.

    I've followed the Perfect Server manual installation on Debian 9, nginx variant. I have Debian 9.5 x64.

    I don't have the clamd.ctl file inside /var/run/amavis.
    Both "clamav" and "amavisd-new" are successfully installed, but don't know why inside the /etc/clamav/clamd.conf the LocalSocket is set as
    /var/run/clamav/clamd.ctl if it doesn't exists.

    Inside /etc/clamav/clamd.conf i've checked that "FixStaleSocket true" is set and i've also manually added the line "AllowSupplemenaryGroup yes".
    Inside /var/run/amavis are contained the files amavisd.lock and amavisd.pid
    Inside /var/run/clamav there are not files, but the folder exists.

    ===LOGS FROM ISPCONFIG MONITOR ===

    Jan 4 14:00:53 server2 postfix/pickup[1273]: 00C4721882: uid=5005 from=<[email protected]>
    Jan 4 14:00:53 server2 postfix/cleanup[1652]: 00C4721882: message-id=<[email protected]>
    Jan 4 14:00:53 server2 postfix/qmgr[1274]: 00C4721882: from=<[email protected]>, size=917, nrcpt=2 (queue active)
    Jan 4 14:00:53 server2 amavis[1460]: (01460-01) (!)connect to /var/run/clamav/clamd.ctl failed, attempt #1: Can't connect to a UNIX socket /var/run/clamav/clamd.ctl: No such file or directory
    Jan 4 14:00:54 server2 amavis[1460]: (01460-01) (!)connect to /var/run/clamav/clamd.ctl failed, attempt #1: Can't connect to a UNIX socket /var/run/clamav/clamd.ctl: No such file or directory
    Jan 4 14:00:54 server2 amavis[1460]: (01460-01) (!)ClamAV-clamd: All attempts (1) failed connecting to /var/run/clamav/clamd.ctl, retrying (2)
    Jan 4 14:01:00 server2 amavis[1460]: (01460-01) (!)connect to /var/run/clamav/clamd.ctl failed, attempt #1: Can't connect to a UNIX socket /var/run/clamav/clamd.ctl: No such file or directory
    Jan 4 14:01:00 server2 amavis[1460]: (01460-01) (!)ClamAV-clamd av-scanner FAILED: run_av error: Too many retries to talk to /var/run/clamav/clamd.ctl (All attempts (1) failed connecting to /var/run/clamav/clamd.ctl) at (eval 113) line 613.\n
    Jan 4 14:01:00 server2 amavis[1460]: (01460-01) (!)WARN: all primary virus scanners failed, considering backups

    ===MORE LOGS FROM service clamav-daemon status ====
    [email protected]:/var/run/clamav# service clamav-daemon status
    ● 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: active (running) since Fri 2019-01-04 14:49:42 CET; 9s ago
    Docs: man:clamd(8)
    man:clamd.conf(5)
    https://www.clamav.net/documents/
    Process: 4997 ExecStartPre=/bin/chown clamav /run/clamav (code=exited, status=0/SUCCESS)
    Process: 4995 ExecStartPre=/bin/mkdir /run/clamav (code=exited, status=1/FAILURE)
    Main PID: 5000 (clamd)
    Tasks: 1 (limit: 4915)
    CGroup: /system.slice/clamav-daemon.service
    └─5000 /usr/sbin/clamd --foreground=true
    Jan 04 14:49:42 server2 systemd[1]: Starting Clam AntiVirus userspace daemon...
    Jan 04 14:49:42 server2 mkdir[4995]: /bin/mkdir: cannot create directory ‘/run/clamav’: File exists
    Jan 04 14:49:42 server2 systemd[1]: Started Clam AntiVirus userspace daemon.
     
    Last edited: Jan 4, 2019
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    What I remember from the similar threads, the problem usually was that amavis was not running. You do not show you have verified that.
    Code:
    systemctl status amavis
     
  3. Magiodev

    Magiodev New Member

    I've actually solved in a fresh installation. After executing this from the Perfect Server tutorial
    apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl libdbd-mysql-perl postgrey
    clamd.ctl socket file wasn't in /var/run/clamav/ folder, but set inside /etc/clamav/main.conf
    solved just reloading clamav-daemon service with systemctl, after that clamd.ctl appeared inside the folder

    yes i checked amavis and was ok. the ones that was affected is clamav-daemon

    obviously i tried like 20 times in the previous installation to solve by that way but nothing happened.

    I strongly suggest to do that during the initial installation/configuration
     

Share This Page