I think I have resolved this with:
# touch /var/run/clamd.scan/clamd.sock
chown clamscan: /var/run/clamd.scan/clamd.sock
chmod 660 /var/run/clamd.virtualmin/clamd.sock
then uncommented these lines in /etc/clamd.d/scan.conf:
PidFile /var/run/clamd.scan/clamd.pid
LocalSocket /var/run/clamd.scan/clamd.sock
this one is more specific: I have a Virtual Server for my server hostname and had to modify on /etc/postfix/main.cf this line:
mydestination = $myhostname, localhost.$mydomain, localhost, servername
(‘servername’ is the short version of your hostname)
to:
mydestination = localhost.$mydomain, localhost, servidor2
This is because “$myhostname” is already present in the Virtual Server so is already a local domain and having it on $mydestination var was causing issues.
for last:
systemctl restart postfix
systemctl restart clamd@scan.service
I could test this with:
clamdscan -c /etc/clamd.d/scan.conf /etc/hosts
prior the fix:
ERROR: Could not lookup (null): Servname not supported for ai_socktype
after the fix:
/etc/hosts: OK
-edit-
A FIX ON MY INSTRUCTIONS ABOVE:
Removing “$myhostname” from $mydestination variable, caused all the incoming messages to bounce back! Actually, I had to revert it to original string. The warning in the postfix logs are just because I had a Virtual Server with the same name of my server’s hostname. Since I’m not receiving e-mail on this domain, all I had to do was select the virtual server in Virtual > Edit Virtual Server > disabled Mail, Virus Scan, Spam scan, Mailman, then Save. This removed “myserver.mydomain.com” from the virtual alias table and the error in Postfix log gone away, and e-mail remained working fine! I hope it helps.