Page 1 of 1

Clamd hangs while update. Can't connect to socket. VestaCP control panel clamd service inactive.

Posted: Thu Jun 10, 2021 12:58 pm
by trogvar
About a month ago I've started receiving messages in exim4 paniclog that mailserver can't connect to /var/run/clamav/clamd.ctl socket file.
Sending and receiving mail stopped!
Socket and pid files were at the place, clamd daemon started and working. Looking at freshclam.log I've found last string that "Clamd successfully notified about the update.".

I've stopped clamd and freshclam with /etc/init.d scripts, restarted. But daemon didn't delete /var/run/clamav/* files. I've removed them manually and restarted daemon again and it worked..

I get this trouble almost every day.

Digging at freshclam update schedule..

OS: Debian 9.13
Clamd: ClamAV 0.102.4/26197/Thu Jun 10 14:10:09 2021
Kernel: 4.9.0-15-amd64 Debian 4.9.258-1 (2021-03-08)

Update:
Web panel says that it turned off:
Image

Running ./v-list-sys-services also says that daemon is off :

NAME STATE CPU MEM UPTIME
---- ----- --- --- ------
apache2 running 0 148 559
nginx running 0.1 65 559
bind9 running 0.1 185 8853
exim4 running 0 2 31
dovecot running 0 0 31
clamav-daemon stopped 0 0 0
spamassassin running 16.7 4045 271
mysqld running 0 813 23020
vsftpd running 0 0 686
cron running 0 6 31
iptables running 0 0 0
fail2ban running 0.2 128 23047

p.s.
Fixed Web Panel by changing
'clamav-daemon' on 'clamd'
in /usr/local/vesta/conf/vesta.conf
This also fixed clamav configure 404 http error.

p.p.s Tried to delete databases from /var/lib/clamav/*.cld and restarted freshclam - it downloaded new *.cvd compressed and signed database files.
Will monitor this changes, hope it'll help.

Re: Clamd hangs while update. Can't connect to socket.

Posted: Tue Jun 15, 2021 8:24 am
by trogvar
Seems like deleting old *.cld clamd base files and updating them with new *.cvd fixed the problem.

Re: Clamd hangs while update. Can't connect to socket.

Posted: Thu Jun 24, 2021 9:11 am
by trogvar
Turns out that somewhen VestaCP changed clamav-daemon name to clamd, but system doesn'tknow about it. That's why we have lots of problems to start and stop or monitor Clamd service from VestaCP control Panel.
Here is the fix:

systemctl stop clamav-daemon
systemctl disable clamav.daemon
mv /lib/systemd/system/clamav-daemon.service /lib/systemd/system/clamd.service
mv /etc/systemd/system/clamav-daemon.service.d /etc/systemd/system/clamd.service.d
systemctl enable clamd.service
systemctl start clamd.service

That will rename clamav-daemon to clamd.

Remember changes also must be made in /usr/local/vesta/conf/vesta.conf
ANTIVIRUS_SYSTEM='clamav-daemon' change to ANTIVIRUS_SYSTEM='clamd'

There is another way to fix this if you don't wat to rename systemd service:
edit /user/local/vesta/bin/v-start-service
and /user/local/vesta/bin/v-stop-service

adding special if for clamd like :

if [ "$service" == 'clamd' ]; then
service clamav-daemon start >/dev/null 2>&1
fi