8

I was updating the clamav antivirus defenitons with the sudo freshclam command and the output was:

ERROR: /var/log/clamav/freshclam.log is locked by another process
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).

3 Answers3

12

This is likely to be because the update is currently being run automatically, or you are running it somewhere else (you would know about this). You can change how often it is run automatically, and also stop it being run automatically by running the following:

sudo dpkg-reconfigure clamav-freshclam

After completing the setup you will be able to run sudo freshclam without error (unless you set it to cron and you happen to execute the command at the time it automatically checks).

  • 1
    You are correct, this error is because the daemon is running. +1 for beating me to the answer. =) By the way, after completing the setup, it will let you run the sudo freshclam. – Terrance Jan 08 '16 at 23:33
  • @Terrance: I'm sure I've also seen this question asked before (I think I may have even answered it), but I can't find it to mark as duplicate... –  Jan 08 '16 at 23:34
  • I know I have answered it too once before. =) I'll take a look. – Terrance Jan 08 '16 at 23:35
  • 1
    You actually asked it: http://askubuntu.com/q/636851/231142 – Terrance Jan 08 '16 at 23:37
  • @Terrance: Oh, how funny! :D –  Jan 09 '16 at 14:46
  • I was having the same issue in Ubuntu 16.04 after a fresh install of clamav (without the daemon) and a reboot. Reconfiguring clamav-freshclam, as suggested, fixed the issue. – Daniel Oct 24 '16 at 12:16
  • I need to use this suggestion as well. Needed. http://askubuntu.com/questions/526317/cant-run-freshclam – Satya Prakash Mar 26 '17 at 17:32
6

I suppose that you cannot update clamav database due to it being locked by running daemon. Presumably Ubuntu proceeds with an automatic update.

To update virus database manually, you have to stop daemon by typing in CLI:

sudo /etc/init.d/clamav-freshclam stop

Now you can update virus signatures:

sudo freshclam -v

Finally, restart daemon with

sudo /etc/init.d/clamav-freshclam start
Christianus
  • 571
  • 1
  • 3
  • 16
-2

Another thing to do is to edit the /var/log/clamav/freshclam. conf file and change the 1 to 0. This is the only datavthat you will see in the file, if not LEAVE IT ALONE!!!!!! and wait.

Do this ONLY IF THE OTHER SOLUTIONS DO NOT WORK! While this is a drastic step, what it does is to tell Freshclam that it hasn't run yet.

REMEMBER THIS IS ONLY THE FINAL SOLUTION if the other suggestions do not work.