1

Topic: Clamd not start

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): v0.9.7
- Deployed with iRedMail Easy or the downloadable installer?
- Linux/BSD distribution name and version: Centos 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): pgsql
- Web server (Apache or Nginx):Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes, we do
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi guys, i really apreciate your guide.

My mail server has issues.

I have reviewed and i see error with clamav.

When i start amavis, it shows me:

(!)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
...
(!)ClamAV-clamd 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)
(!)WARN: all primary virus scanners failed, considering backups
(!)WARN: all primary virus scanners failed, considering backups

When i search socket clamd (ss -l), it is not, but the socket /var/run/clamd.amavisd/clamd.socket exists.

I have tried to start mannually clamd (systemctl start clamd@amavisd.service) service but it state is:

"Active: activating (start) since ...", never stay active.

The "systemctl status clamd@amavisd.service" is:

Starting clamd scanner (amavisd) daemon...
clamd daemon 0.99.3 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
Running as user amavis
Log file size limited to 1048576 bytes
Reading databases from /var/lib/clamav
Not loading PUA signatures.
Bytecode: Security mode set to "TrustSigned"

Freshclam shows me:

freshclam
ClamAV update process started at Tue Jul  9 15:59:27 2019
WARNING: Your ClamAV installation is OUTDATED!
WARNING: Local version: 0.99.3 Recommended version: 0.101.2
DON'T PANIC! Read http://www.clamav.net/documents/upgrading-clamav
main.cvd is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
daily.cvd is up to date (version: 25505, sigs: 1614490, f-level: 63, builder: raynman)
bytecode.cld is up to date (version: 328, sigs: 94, f-level: 63, builder: neo)

Please, guide me, it is affecting me.

Sorry my english

----

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

2

Re: Clamd not start

Try to stop service "clamd@amavisd" first, then run the clamd command from console directly:

clamd -c /etc/clamd.d/amavisd.conf --debug --foreground

Any error?

3

Re: Clamd not start

ZhangHuangbin wrote:

Try to stop service "clamd@amavisd" first, then run the clamd command from console directly:

clamd -c /etc/clamd.d/amavisd.conf --debug --foreground

Any error?


No sr, i don't see error.

Limits: Global size limit set to 104857600 bytes.
Limits: File size limit set to 26214400 bytes.
Limits: Recursion level limit set to 16.
Limits: Files limit set to 10000.
Limits: MaxEmbeddedPE limit set to 10485760 bytes.
Limits: MaxHTMLNormalize limit set to 10485760 bytes.
Limits: MaxHTMLNoTags limit set to 2097152 bytes.
Limits: MaxScriptNormalize limit set to 5242880 bytes.
Limits: MaxZipTypeRcg limit set to 1048576 bytes.
Limits: MaxPartitions limit set to 50.
Limits: MaxIconsPE limit set to 100.
Limits: MaxRecHWP3 limit set to 16.
Limits: PCREMatchLimit limit set to 10000.
Limits: PCRERecMatchLimit limit set to 5000.
Limits: PCREMaxFileSize limit set to 26214400.
Archive support enabled.
Algorithmic detection enabled.
Portable Executable support enabled.
ELF support enabled.
Mail files support enabled.
OLE2 support enabled.
PDF support enabled.
SWF support enabled.
HTML support enabled.
XMLDOCS support enabled.
HWP3 support enabled.
Self checking every 600 seconds.
SelfCheck: Database status OK.
SelfCheck: Database status OK.

4

Re: Clamd not start

I had the exact same problem on Centos, i spent hours on it and i finally gave up big_smile

If you really need clamav then reinstall on debian instead on centos and it works just fine.

But imo an antivirus is not really needed on a mail server if the users already have an antivirus on their computer, which is the case most of the time.

If you are in that situation i suggest you stay on centos and just disable clamav :

https://forum.iredmail.org/topic3149-ir … n-off.html

AND

Check SQL table "amavisd.policy", you should have one record for global spam policy with column "policy_name='@.'". Try to update column "bypass_spam_checks", "bypass_virus_checks" to 'Y'.

Note: with "lookup_sql_dsn" setting enabled in amavisd config file, settings stored in SQL db will be used instead of config file.

It will free a lot of RAM on your server wink

5

Re: Clamd not start

Neutro wrote:

I had the exact same problem on Centos, i spent hours on it and i finally gave up big_smile

If you really need clamav then reinstall on debian instead on centos and it works just fine.

But imo an antivirus is not really needed on a mail server if the users already have an antivirus on their computer, which is the case most of the time.

If you are in that situation i suggest you stay on centos and just disable clamav :

https://forum.iredmail.org/topic3149-ir … n-off.html

AND

Check SQL table "amavisd.policy", you should have one record for global spam policy with column "policy_name='@.'". Try to update column "bypass_spam_checks", "bypass_virus_checks" to 'Y'.

Note: with "lookup_sql_dsn" setting enabled in amavisd config file, settings stored in SQL db will be used instead of config file.

It will free a lot of RAM on your server wink


Neutro i really appreciate your reply but in this moment, the situation changed.

In this moment, the socket is NOT refusing connections, and i can see it with ss -l

u_str  LISTEN     0      200    /var/run/clamd.amavisd/clamd.socket

In this moment, the mail server is working fine, but why, how the socket is active?, how is possible track what happened?, i want to learn why, how..., and i want to know how correct this situation if it pass again?

Thanks for your guide.

6

Re: Clamd not start

How much memory does this server have? 2GB?

7

Re: Clamd not start

ZhangHuangbin wrote:

How much memory does this server have? 2GB?

8GB

8

Re: Clamd not start

With 8GB memory, clamav should be satisfied. Need to check log file to figure out why it doesn't start, also try to start it manually with debug option.

9

Re: Clamd not start

ZhangHuangbin wrote:

Try to stop service "clamd@amavisd" first, then run the clamd command from console directly:

clamd -c /etc/clamd.d/amavisd.conf --debug --foreground

Any error?

_________________________________________

Thanks for the solution.
while the server does not restart or does not close the ssh session. clamd runs fine.

How to do so when rebooting do not have to do the same?

10

Re: Clamd not start

phqr58 wrote:

How to do so when rebooting do not have to do the same?

Just enable the clamd service. It runs in background.