Email delivery very slow

Discussion in 'General' started by HenrysCat, Sep 22, 2019.

  1. HenrysCat

    HenrysCat Member

    Just installed on Debian 10 all went well, but email is very slow to deliver to the recipient, up to 15 minutes, and this shows in the warning log
    Code:
    Sep 22 10:16:40 mail amavis[4585]: (04585-02) (!)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
    Sep 22 10:16:41 mail amavis[4585]: (04585-02) (!)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
    Sep 22 10:16:41 mail amavis[4585]: (04585-02) (!)ClamAV-clamd: All attempts (1) failed connecting to /var/run/clamav/clamd.ctl, retrying (2)
    Sep 22 10:16:47 mail amavis[4585]: (04585-02) (!)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
    Sep 22 10:16:47 mail amavis[4585]: (04585-02) (!)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 659.\n
    Sep 22 10:16:47 mail amavis[4585]: (04585-02) (!)WARN: all primary virus scanners failed, considering backups
    Sep 22 10:17:02 mail amavis[4585]: (04585-02) (!)run_av (ClamAV-clamscan) FAILED - unexpected exit 2, output="LibClamAV Error: mpool_malloc(): Can't allocate memory (262144 bytes).\nLibClamAV Error: cli_ac_addpatt: Can't allocate memory for new->trans\nLibClamAV Error: cli_parse_add(): Problem adding signature (3).\nLibClamAV Error: Problem parsing database at line 7654\nLibClamAV Error: Can't load daily.ldb: Can't allocate memory\nLibClamAV Error: cli_tgzload: Can't load daily.ldb\nLibClamAV Error: Can't load /var/lib/clamav/daily.cvd: Malformed database\nERROR: Malformed database"
    Sep 22 10:17:02 mail amavis[4585]: (04585-02) (!)ClamAV-clamscan av-scanner FAILED: /usr/bin/clamscan unexpected exit 2, output="LibClamAV Error: mpool_malloc(): Can't allocate memory (262144 bytes).\nLibClamAV Error: cli_ac_addpatt: Can't allocate memory for new->trans\nLibClamAV Error: cli_parse_add(): Problem adding signature (3).\nLibClamAV Error: Problem parsing database at line 7654\nLibClamAV Error: Can't load daily.ldb: Can't allocate memory\nLibClamAV Error: cli_tgzload: Can't load daily.ldb\nLibClamAV Error: Can't load /var/lib/clamav/daily.cvd: Malformed database\nERROR: Malformed database" at (eval 113) line 951.
    Sep 22 10:17:02 mail amavis[4585]: (04585-02) (!!)AV: ALL VIRUS SCANNERS FAILED
    Any ideas?
    Thanks all
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

  3. HenrysCat

    HenrysCat Member

    systemctl status amavis gives below
    Code:
    root@mail:~# systemctl status amavis
    ● amavis.service - LSB: Starts amavisd-new mailfilter
       Loaded: loaded (/etc/init.d/amavis; generated)
       Active: active (running) since Sun 2019-09-22 11:51:03 UTC; 4h 58min ago
         Docs: man:systemd-sysv-generator(8)
      Process: 2695 ExecStart=/etc/init.d/amavis start (code=exited, status=0/SUCCESS)
        Tasks: 3 (limit: 1149)
       Memory: 183.9M
       CGroup: /system.slice/amavis.service
               ├─2710 /usr/sbin/amavisd-new (master)
               ├─2714 /usr/sbin/amavisd-new (ch1-avail)
               └─2715 /usr/sbin/amavisd-new (ch1-avail)
    
    Sep 22 14:15:28 mail amavis[2715]: (02715-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
    Sep 22 14:15:29 mail amavis[2715]: (02715-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
    Sep 22 14:15:29 mail amavis[2715]: (02715-01) (!)ClamAV-clamd: All attempts (1) failed connecting to /var/run/clamav/clamd.ctl, retrying (2)
    Sep 22 14:15:35 mail amavis[2715]: (02715-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
    Sep 22 14:15:35 mail amavis[2715]: (02715-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 659.\n
    Sep 22 14:15:35 mail amavis[2715]: (02715-01) (!)WARN: all primary virus scanners failed, considering backups
    Sep 22 14:16:08 mail amavis[2715]: (02715-01) (!)run_av (ClamAV-clamscan) FAILED - unexpected exit 2, output="LibClamAV Error: mpool_malloc(): Can't allocate memory (262144 bytes).\nLibClamAV Error: cli_ac_addpatt: Can't allocate memory for new->trans\nLibClamAV Error: cli_parse_add(): Problem adding signature (3).\nLibClamAV Error: Problem parsing database at line 38539\nLibClamAV Error: Can't load daily.ldb: Can't allocate memory\nLibClamAV Error: cli_tgzload: Can't load daily.ldb\nLibClamAV Error: Can't load /var/lib/clamav/daily.cvd: Malformed database\nERROR: Malformed database"
    Sep 22 14:16:08 mail amavis[2715]: (02715-01) (!)ClamAV-clamscan av-scanner FAILED: /usr/bin/clamscan unexpected exit 2, output="LibClamAV Error: mpool_malloc(): Can't allocate memory (262144 bytes).\nLibClamAV Error: cli_ac_addpatt: Can't allocate memory for new->trans\nLibClamAV Error: cli_parse_add(): Problem adding signature (3).\nLibClamAV Error: Problem parsing database at line 38539\nLibClamAV Error: Can't load daily.ldb: Can't allocate memory\nLibClamAV Error: cli_tgzload: Can't load daily.ldb\nLibClamAV Error: Can't load /var/lib/clamav/daily.cvd: Malformed database\nERROR: Malformed database" at (eval 113) line 951.
    Sep 22 14:16:08 mail amavis[2715]: (02715-01) (!!)AV: ALL VIRUS SCANNERS FAILED
    Sep 22 14:16:10 mail amavis[2715]: (02715-01) Passed UNCHECKED {RelayedOutbound}, ORIGINATING LOCAL [94.118.99.203]:51572 [94.118.99.203] <[email protected]> -> <[email protected]>, Queue-ID: 82FB24120C, Message-ID: <[email protected]>, mail_id: LOv4-uAcwc5x, Hits: 0.181, size: 2193, queued_as: CFD7241215, 42253 ms
    ~
    lines 1-22/22 (END)
    
    I installed from this guide, https://www.howtoforge.com/perfect-...ispconfig-3-1/#-install-webalizer-and-awstats
    Followed it to the letter ;) so clamav installed.
     
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    What shows
    Code:
    free -h
    df -hT
     
  5. HenrysCat

    HenrysCat Member

    Code:
    root@mail:~# free -h
                  total        used        free      shared  buff/cache   available
    Mem:          987Mi       607Mi       124Mi        27Mi       255Mi       214Mi
    Swap:            0B          0B          0B
    
    
    root@mail:~# df -hT
    Filesystem     Type      Size  Used Avail Use% Mounted on
    udev           devtmpfs  479M     0  479M   0% /dev
    tmpfs          tmpfs      99M   12M   88M  12% /run
    /dev/vda1      ext4       25G  3.1G   21G  14% /
    tmpfs          tmpfs     494M     0  494M   0% /dev/shm
    tmpfs          tmpfs     5.0M  4.0K  5.0M   1% /run/lock
    tmpfs          tmpfs     494M     0  494M   0% /sys/fs/cgroup
    tmpfs          tmpfs      99M     0   99M   0% /run/user/0
    root@mail:~# 
     
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    I know from previous threads that 1 GB memory is not enough for running mail server with clamav. That host probably has out of memory errors logged to /var/log/syslog.
    You can create swap, 2 or 4 GB to allow virtual memory big enough to fit the clamav processes. If you can create disk partition of that size assign that as swap. Or if you just today installed this system, it may be easier to install it again but this time partition the disk so there is a partition for swap.
     
    niemand-glaumy and HenrysCat like this.
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    The reason for the slow mail delivery is probably the failed clamav scanner. according to the error, the clamav signature database is corrupted. you should consider to delete the file /var/lib/clamav/daily.cvd and then get a fresh database using freshclam command.
     
    niemand-glaumy and HenrysCat like this.
  8. HenrysCat

    HenrysCat Member

    Thanks, I have created a 4GB swap, run freshclam and get
    Code:
    root@mail:~# freshclam
    Mon Sep 23 07:52:12 2019 -> ClamAV update process started at Mon Sep 23 07:52:12 2019
    Mon Sep 23 07:52:12 2019 -> main.cvd is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
    Mon Sep 23 07:52:12 2019 -> Downloading daily.cvd [100%]
    Mon Sep 23 07:52:52 2019 -> daily.cvd updated (version: 25580, sigs: 1775120, f-level: 63, builder: raynman)
    Mon Sep 23 07:52:52 2019 -> *Can't query daily.25580.105.1.0.6810DA54.ping.clamav.net
    Mon Sep 23 07:52:52 2019 -> bytecode.cvd is up to date (version: 331, sigs: 94, f-level: 63, builder: anvilleg)
    Mon Sep 23 07:52:58 2019 -> Database updated (6341463 signatures) from db.local.clamav.net (IP: 104.16.218.84)
    Mon Sep 23 07:52:58 2019 -> ^Clamd was NOT notified: Can't connect to clamd through /var/run/clamav/clamd.ctl: No such file or directory
    If I run systemctl status clamav-daemon
    Code:
    root@mail:~# systemctl status clamav-daemon
    ● clamav-daemon.service - Clam AntiVirus userspace daemon
       Loaded: loaded (/lib/systemd/system/clamav-daemon.service; enabled; vendor pr
      Drop-In: /etc/systemd/system/clamav-daemon.service.d
               └─extend.conf
       Active: failed (Result: exit-code) since Sun 2019-09-22 11:35:54 UTC; 20h ago
         Docs: man:clamd(8)
               man:clamd.conf(5)
               https://www.clamav.net/documents/
      Process: 383 ExecStartPre=/bin/mkdir /run/clamav (code=exited, status=0/SUCCES
      Process: 410 ExecStartPre=/bin/chown clamav /run/clamav (code=exited, status=0
      Process: 419 ExecStart=/usr/sbin/clamd --foreground=true (code=exited, status=
     Main PID: 419 (code=exited, status=1/FAILURE)
    I have run
    sudo service clamav-freshclam start
    &
    sudo /etc/init.d/clamav-freshclam start
    Still not running?
     
  9. HenrysCat

    HenrysCat Member

    Restarted the server, clamav-daemon running and email delivered within a few seconds.
    Thank you guys, been using vesta for years now, already decided to move to ISPconfig :)
     

Share This Page