ClamAV: clamd.ctl file is not getting created on ubuntu
Solution 1
I faced this issue on my Ubuntu 20.04 LTS machine,
What I did was:
- run
sudo systemctl stop clamav-daemon.service
- then run
sudo rm /var/log/clamav/freshclam.log
(sometimes it gets locked) - start the service
sudo systemctl start clamav-daemon.service
to ensure everything is OK run sudo systemctl status clamav-daemon.service
and the output should look something like this:
➜ ~ sudo systemctl status clamav-daemon.service
● clamav-daemon.service - Clam AntiVirus userspace daemon
Loaded: loaded (/lib/systemd/system/clamav-daemon.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/clamav-daemon.service.d
└─extend.conf
Active: active (running) since Sun 2020-05-03 05:03:51 EEST; 4s ago
Docs: man:clamd(8)
man:clamd.conf(5)
https://www.clamav.net/documents/
Process: 6122 ExecStartPre=/bin/mkdir -p /run/clamav (code=exited, status=0/SUCCESS)
Process: 6124 ExecStartPre=/bin/chown clamav /run/clamav (code=exited, status=0/SUCCESS)
Main PID: 6138 (clamd)
Tasks: 1 (limit: 14203)
Memory: 367.3M
CGroup: /system.slice/clamav-daemon.service
└─6138 /usr/sbin/clamd --foreground=true
May 03 05:03:51 user systemd[1]: Starting Clam AntiVirus userspace daemon...
May 03 05:03:51 user systemd[1]: Started Clam AntiVirus userspace daemon.
Now run
sudo freshclam
and check the log file (or console output)
Sun May 3 05:04:02 2020 -> --------------------------------------
Sun May 3 05:04:02 2020 -> ClamAV update process started at Sun May 3 05:04:02 2020
Sun May 3 05:04:02 2020 -> daily.cvd database is up to date (version: 25800, sigs: 2331970, f-level: 63, builder: raynman)
Sun May 3 05:04:02 2020 -> main.cvd database is up to date (version: 59, sigs: 4564902, f-level: 60, builder: sigmgr)
Sun May 3 05:04:02 2020 -> bytecode.cvd database is up to date (version: 331, sigs: 94, f-level: 63, builder: anvilleg)
Enjoy!
Solution 2
I found that after you run the:
freshclam
And get this error:
Clamd was NOT notified: Can't connect to clamd through /var/run/clamav/clamd.ctl: No such file or directory
You just need to run restart for the demon:
service clamav-daemon restart
And then freshclam
again and all works.
Solution 3
Add a sock file for ClamAV:
sudo touch /var/lib/clamav/clamd.sock
sudo chown clamav:clamav /var/lib/clamav/clamd.sock
Then, edit /etc/clamav/clamd.conf
- uncomment this line:
LocalSocket /var/lib/clamav/clamd.sock
Save the file and restart clamav-daemon.service
Another error:
sudo freshclam
Downloading daily-25578.cdiff [100%]
Downloading daily-25579.cdiff [100%]
Downloading daily-25580.cdiff [100%]
Downloading daily-25581.cdiff [100%]
Downloading daily-25582.cdiff [100%]
Downloading daily-25583.cdiff [100%]
daily.cld updated (version: 25583, sigs: 1778105, f-level: 63, builder: raynman)
Downloading bytecode-331.cdiff [100%]
bytecode.cld updated (version: 331, sigs: 94, f-level: 63, builder: anvilleg)
Database updated (6344448 signatures) from database.clamav.net (IP: 104.16.219.84)
WARNING: Clamd was NOT notified: Can't connect to clamd through /run/clamav/clamd.ctl: No such file or directory
Add a sock file for ClamAV:
sudo touch /run/clamav/clamd.sock
sudo chown clamav:clamav /run/clamav/clamd.sock
sudo systemctl restart clamav-daemon.service
sudo freshclam
ClamAV update process started at Thu Sep 26 11:47:12 2019
main.cvd is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
daily.cld is up to date (version: 25583, sigs: 1778105, f-level: 63, builder: raynman)
bytecode.cld is up to date (version: 331, sigs: 94, f-level: 63, builder: anvilleg)
That's it.
Solution 4
To reconfigure clamav run
dpkg-reconfigure clamav-daemon
Please read /usr/share/doc/clamav-daemon/README.Debian.gz
for details
Related videos on Youtube
Nikhil Nanjappa
¤ Kickass Full Stack Developer ¤ ¤ Code blooded ¤ ¤ Self Motivated ¤ ¤ Beer lover ¤ ¤ Ruby on Rails ¤ ¤ HTML5 - jade, haml, slim ¤ ¤ CSS3 - sass, less ¤ ¤ JavaScript - es6 ¤ ¤ JQuery ¤ ¤ Flexbox ¤ ¤ Boostrap ¤ ¤ Angular ¤ ¤ Jekyll ¤ ¤ Git - github, bitbucket ¤ ¤ Node ¤ ¤ Grunt, Gulp, npm ¤
Updated on September 18, 2022Comments
-
Nikhil Nanjappa over 1 year
I have ubuntu 16.04.6 version and I'm trying to install & run the
clamdscan
on it to check for antiviruses.I've used the installation instructions as given in their website. ie.
sudo apt-get install clamav sudo apt-get install clamav-daemon
The above 2 commands works fine. But when I try to download the definitions (which I'm assuming is mandatory after the above) by running the command
sudo freshclam
it fails throwing the following error:
^Clamd was NOT notified: Can't connect to clamd through /var/run/clamav/clamd.ctl: No such file or directory
According to this accepted answer, the file should get created after installing
clamav-daemon
but obviously that does not happen. -
Nikhil Nanjappa over 4 yearsIs there no better way to do this while running provision script on a server ? I mean, locally it could work. But i'm trying to run provision scripts to execute commands on AWS EC2 instance and opening and uncommenting a file on the fly in the server seems weird.
-
JoKeR over 4 yearsjust type
nano /etc/clamav/clamd.conf
uncomment and save. This tutorial fixed an issue on my system. -
JoKeR over 4 yearsif you still get another error
/var/run/clamav/clamd.ctl
no such file or directory create and give ownership to a sock file in that directory as well as specified in my answer.