Topic: clamd wont start and use 100% cpu
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? downloadable
- Linux/BSD distribution name and version: Centos 7.6
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MariaDB
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? no
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Hey folks,
I've reinstalled my mail server from scratch a few days ago.
After the install i noticed that a process "clamd" ran by user "amavid" was taking 100% cpu. So i disabled amavis alltogether in postfix.
But i noticed today that since amavis also manages DKIM i can't disable it
So i enabled amavis back in postfix and found out that the problem was caused by the clamd@amavisd service.
If I run systemctl start clamd@amavisd the ssh command hangs forever, using another ssh windows systemctl status clamd@amavisd shows:
juin 07 08:00:34 smtp.ah1z.com systemd[1]: Starting Generic clamav scanner daemon...
juin 07 08:00:34 smtp.ah1z.com clamd[22034]: WARNING: Ignoring deprecated option AllowSupplementaryGroups at /etc/clamd.d/amavisd.conf:21
juin 07 08:00:34 smtp.ah1z.com clamd[22034]: Received 0 file descriptor(s) from systemd.
juin 07 08:00:34 smtp.ah1z.com clamd[22034]: clamd daemon 0.101.2 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
juin 07 08:00:34 smtp.ah1z.com clamd[22034]: Running as user amavis (UID 990, GID 987)
juin 07 08:00:34 smtp.ah1z.com clamd[22034]: Log file size limited to 1048576 bytes.
juin 07 08:00:34 smtp.ah1z.com clamd[22034]: Reading databases from /var/lib/clamav
juin 07 08:00:34 smtp.ah1z.com clamd[22034]: Not loading PUA signatures.
juin 07 08:00:34 smtp.ah1z.com clamd[22034]: Bytecode: Security mode set to "TrustSigned".
While it's trying to start, it eats up all CPU as shown in "top":
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
22334 amavis 20 0 364672 254996 3240 R 96,4 13,5 0:24.45 clamd
Jun 7 08:00:34 smtp clamd[22034]: Received 0 file descriptor(s) from systemd.
Jun 7 08:00:34 smtp clamd[22034]: clamd daemon 0.101.2 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
Jun 7 08:00:34 smtp clamd[22034]: Running as user amavis (UID 990, GID 987)
Jun 7 08:00:34 smtp clamd[22034]: Log file size limited to 1048576 bytes.
Jun 7 08:00:34 smtp clamd[22034]: Reading databases from /var/lib/clamav
Jun 7 08:00:34 smtp clamd[22034]: Not loading PUA signatures.
Jun 7 08:00:34 smtp clamd[22034]: Bytecode: Security mode set to "TrustSigned".
Jun 7 08:02:05 smtp clamd[22334]: Received 0 file descriptor(s) from systemd.
Jun 7 08:02:05 smtp clamd[22334]: clamd daemon 0.101.2 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
Jun 7 08:02:05 smtp clamd[22334]: Running as user amavis (UID 990, GID 987)
Jun 7 08:02:05 smtp clamd[22334]: Log file size limited to 1048576 bytes.
Jun 7 08:02:05 smtp clamd[22334]: Reading databases from /var/lib/clamav
Jun 7 08:02:05 smtp clamd[22334]: Not loading PUA signatures.
Jun 7 08:02:05 smtp clamd[22334]: Bytecode: Security mode set to "TrustSigned".
Jun 7 08:03:35 smtp clamd[22606]: Received 0 file descriptor(s) from systemd.
Jun 7 08:03:35 smtp clamd[22606]: clamd daemon 0.101.2 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
Jun 7 08:03:35 smtp clamd[22606]: Running as user amavis (UID 990, GID 987)
Jun 7 08:03:35 smtp clamd[22606]: Log file size limited to 1048576 bytes.
Jun 7 08:03:35 smtp clamd[22606]: Reading databases from /var/lib/clamav
Jun 7 08:03:35 smtp clamd[22606]: Not loading PUA signatures.
Jun 7 08:03:35 smtp clamd[22606]: Bytecode: Security mode set to "TrustSigned".
Jun 7 08:05:06 smtp clamd[23505]: Received 0 file descriptor(s) from systemd.
Jun 7 08:05:06 smtp clamd[23505]: clamd daemon 0.101.2 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
Jun 7 08:05:06 smtp clamd[23505]: Running as user amavis (UID 990, GID 987)
Jun 7 08:05:06 smtp clamd[23505]: Log file size limited to 1048576 bytes.
Jun 7 08:05:06 smtp clamd[23505]: Reading databases from /var/lib/clamav
Jun 7 08:05:06 smtp clamd[23505]: Not loading PUA signatures.
Jun 7 08:05:06 smtp clamd[23505]: Bytecode: Security mode set to "TrustSigned".
I've noticed i had several lines of this kind in my maillog file:
Jun 7 06:36:44 smtp amavis[11355]: (11355-01) (!)connect to /var/run/clamd.amavisd/clamd.socket failed, attempt #1: Can't connect to a UNIX socket /var/run/clamd.amavisd/clamd.socket: Aucun fichier ou dossier de ce type
Jun 7 06:36:44 smtp amavis[11355]: (11355-01) (!)clamav-socket: All attempts (1) failed connecting to /var/run/clamd.amavisd/clamd.socket, retrying (2)
Jun 7 06:36:50 smtp amavis[11355]: (11355-01) (!)connect to /var/run/clamd.amavisd/clamd.socket failed, attempt #1: Can't connect to a UNIX socket /var/run/clamd.amavisd/clamd.socket: Aucun fichier ou dossier de ce type
Jun 7 06:36:50 smtp amavis[11355]: (11355-01) (!)clamav-socket av-scanner FAILED: run_av error: Too many retries to talk to /var/run/clamd.amavisd/clamd.socket (All attempts (1) failed connecting to /var/run/clamd.amavisd/clamd.socket) at (eval 134) line 659.\n
But i don't know where they come from since they dont show when i try to start the clamd@amavisd service
This is my amavisd.conf in /etc/clamd.d:
# Use system logger.
LogSyslog yes
# Specify the type of syslog messages - please refer to 'man syslog'
# for facility names.
LogFacility LOG_MAIL
# This option allows you to save a process identifier of the listening
# daemon (main thread).
PidFile /var/run/clamd.amavisd/clamd.pid
# Remove stale socket after unclean shutdown.
# Default: disabled
FixStaleSocket yes
# Run as a selected user (clamd must be started by root).
User amavis
# Path to a local socket file the daemon will listen on.
LocalSocket /var/run/clamd.amavisd/clamd.sock
These are the packages installed on my server:
clamav.x86_64 0.101.2-1.el7 @epel
clamav-filesystem.noarch 0.101.2-1.el7 @epel
clamav-lib.x86_64 0.101.2-1.el7 @epel
clamav-scanner-systemd.x86_64 0.101.2-1.el7 @epel
clamav-server-systemd.x86_64 0.101.2-1.el7 @epel
clamav-update.x86_64 0.101.2-1.el7 @epel
clamd.x86_64 0.101.2-1.el7 @epel
I've searched on the forum and found out that some people had the same problem because they were running only 1GB RAM but my server is running 2GB ram (it's a vmware virtual machine running on ESXI 6.7).
So i've disabled the service clamd@amavisd for now and my mail server is running fine with dkim but without clamav scan.
Would appreciate if anyone got an idea of why this is happening?
Thanks!
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.