1

Topic: ERROR: Can't save PID to file /var/run/clamd.amavisd/clamd.pid: Permis

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.8 MARIADB edition.
- Deployed with iRedMail - downloadable installer?
- Linux/BSD distribution name and version: centos 7
- Store mail accounts in which backend (MySQL):
- Web server (Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

the amavisd user is gobbling up resources (mainly cpu) because of numerous log entries which appear to eminate from this error:
ERROR: Can't save PID to file /var/run/clamd.amavisd/clamd.pid: Permission denied

i don't fully under stand the processes behind this, but obviously there is a file ownership issue here.

as i understand it, this file is being continually being recreated so even when you change the ownership of the file, it quickly reverts back to being owned by root:root

the user for amavis is amavis, so from what i can see amavis needs to be able to either rewrite or access this file in some way

on another test system i have, the owner is root:amavis and i am not having the same problem.
how can i get this system to create the file as root:amavis as owner?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: ERROR: Can't save PID to file /var/run/clamd.amavisd/clamd.pid: Permis

well, i have scoured the internet looking for a solution to this problem without any luck.

because i lack the basic understanding of the real nuts and bolts of this process, especially one that seems to have been adapted to what appears to have been a hybrid model of scanning, the information available never seems to apply to this exact model.

i will have to look deeper into the available resources to solve this.

i the meantime i have opened the permissions for the .pid file up to 0776 which allows the file to be accessed by amavis. not ideal but it is going to have to do for now.

3

Re: ERROR: Can't save PID to file /var/run/clamd.amavisd/clamd.pid: Permis

iredmail is at 1.6.2, and you are running on an unsupported system aswell

centos is dropped entirely, you would need centos stream 8 or 9

4

Re: ERROR: Can't save PID to file /var/run/clamd.amavisd/clamd.pid: Permis

Try to restart both "clamd@amavisd" and "amavisd" services.

5 (edited by raystrach 2022-10-11 19:57:04)

Re: ERROR: Can't save PID to file /var/run/clamd.amavisd/clamd.pid: Permis

thanks zhang

i had previously tried to restart clamd@amavis but had not separately restarted amavisd.

this action appeared to change the permissions of the pid file back to 0664 after i had changed them to 0774 (i think)

had this in the log after some prior unsuccessful tries to connect to the socket.

Oct 11 20:23:05 mailer amavis[7110]: (07110-08) (!)connect to /var/run/clamd.amavisd/clamd.socket failed, attempt #1: Can't connect to a UNIX socket /var/run/clamd.amavisd/clamd.socket: Connection refused
Oct 11 20:23:05 mailer amavis[7110]: (07110-08) (!)clamav-socket: All attempts (1) failed connecting to /var/run/clamd.amavisd/clamd.socket, retrying (2)
Oct 11 20:23:09 mailer clamd[15354]: LOCAL: Removing stale socket file /var/run/clamd.amavisd/clamd.socket
Oct 11 20:23:09 mailer clamd[15354]: LOCAL: Unix socket file /var/run/clamd.amavisd/clamd.socket

this appears to indicate that it eventually worked. after this things appeared normal. amavis was using a normal amount of resources.

the time of these logs is usually the time the system starts using all the cpu (after reloading the databases), so so far so good.
i will monitor it and report back tomorrow to see if things hold up.

iredmail is at 1.6.2, and you are running on an unsupported system aswell

centos is dropped entirely, you would need centos stream 8 or 9

i am aware of the end of centos (this is v 7.8 - supported to 2024) and plan on upgrading soon to alma or rocky linux now that they seem to be up and running ok

6

Re: ERROR: Can't save PID to file /var/run/clamd.amavisd/clamd.pid: Permis

How much memory does this server have? At least 4GB memory is required for Amavisd + SpamAssassin + ClamAV to serve low traffic production server.

7

Re: ERROR: Can't save PID to file /var/run/clamd.amavisd/clamd.pid: Permis

How much memory does this server have? At least 4GB memory is required for Amavisd + SpamAssassin + ClamAV to serve low traffic production server.

yes. it is 4gb and it is a low traffic production server.

thanks zhang

also happy to report that the server continues to function efficiently