Error initialize libfreshclam init failed

17.04.2020

17.04.2020

clamav-logo

Сегодня в статье мы рассмотрим ошибку при попытки обновить антивирус ClamAV в операционной системе Linux.

Если выходит сообщение «ClamAV: Error /var/log/clamav/freshclam.log» при попытки обновления антивируса ClamAV командой:

sudo freshclam

Предупреждение:

ERROR: /var/log/clamav/freshclam.log is locked by another process
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
ERROR: initialize: libfreshclam init failed.
ERROR: Initialization error!

Решение ошибки ClamAV: Error /var/log/clamav/freshclam.log

В сообщении сказано, что /var/log/clamav/freshclam.log блокируется другим процессом. Давайте посмотрим каким:

sudo lsof /var/log/clamav/freshclam.log
COMMAND     PID   USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
freshclam 24489 clamav    3wW  REG   8,17    58462 800961 /var/log/clamav/freshclam.log

Из вывода видем что запустил данный процесс сам же clamav.

Как же все таки исправить данную ошибку? Нет ничего проще. Мы знаем что данный процесс запустил сам антивирусник ClamAV. Давайте же остановим его:

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

Далее запускаем обновление:

sudo freshclam

Теперь обновление проходит без ошибок. Ну а далее запускаем freshclam для работы в автоматическом режиме:

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

Если есть вопросы, то пишем в комментариях.

Также можете вступить в Телеграм канал, ВКонтакте или подписаться на Twitter. Ссылки в шапке страницы.
Заранее всем спасибо!!!

RSS

Добавление RSS-ленты на главную страницу этого сайта не поддерживается, так как это может привести к зацикливанию, замедляющему работу вашего сайта. Попробуйте использовать другой блок, например блок Последние записи, для отображения записей сайта.

Если вы нашли ошибку, пожалуйста, выделите фрагмент текста и нажмите Ctrl+Enter.

sudo freshclam

output:

ERROR: /var/log/clamav/freshclam.log is locked by another process
ERROR: Problem with internal logger (UpdateLogFile = 
/var/log/clamav/freshclam.log).
ERROR: initialize: libfreshclam init failed.
ERROR: Initialization error!

MandiYang's user avatar

MandiYang

1,7552 gold badges10 silver badges30 bronze badges

asked Nov 15, 2020 at 16:36

amal's user avatar

0

You’re getting this error because the clamav-freshclam service is running in the background.

  1. Stop it by typing sudo systemctl stop clamav-freshclam.service in a terminal.
  2. Do the manual update afterwards by typing sudo freshclam.
  3. Stop clamav-freshclam from starting automatically on system startup by executing sudo dpkg-reconfigure clamav-freshclam and configuring it for manual updates only, in the corresponding question.

By configuring clamav-freshclam this way, you will be able to select an update server that’s closer to you so that it works faster and you will also be able to stop freshclam from giving an error concerning the clamd.conf file everytime it updates clamav, by disabling the clamd daemon notification.

answered Nov 15, 2020 at 17:15

Stormlord's user avatar

StormlordStormlord

5,6392 gold badges24 silver badges38 bronze badges

Содержание

  1. Debian User Forums
  2. clamav error
  3. clamav error
  4. Re: clamav error
  5. Re: clamav error
  6. [SOLVED] Updated ClamAV but showed issues
  7. reachmedia
  8. reachmedia
  9. reachmedia
  10. reachmedia
  11. reachmedia
  12. [РЕШЕНО] ClamAV: Error /var/log/clamav/freshclam.log
  13. Решение ошибки ClamAV: Error /var/log/clamav/freshclam.log
  14. Обновить clamav вручную

Debian User Forums

clamav error

clamav error

#1 Post by Lonewolf71 » 2021-07-14 08:09

I was trying to scan my system just for the heck of it, but when I try to update clam I get the error below.

Re: clamav error

#2 Post by jakoline1 » 2021-07-14 11:08

You’re getting this error because the clamav-freshclam service is running in the background.

1- Stop it by typing

By configuring clamav-freshclam this way, you will be able to select an update server that’s closer to you so that it works faster and you will also be able to stop freshclam from giving an error concerning the clamd.conf file everytime it updates clamav, by disabling the clamd daemon notification.

Re: clamav error

#3 Post by jakoline1 » 2021-07-14 11:48

In the terminal you should highlight the option you want then press the tab key from your keyboard to chose either Ok or Cancel, then hit Enter.

Here is how I did it.

1- Run this command in terminal

2- Pick manual

3- Select the closet location

4- Leave blank (unless you’re using a proxy)

5- Not sure if it’s effective or not since we already disabled auto-updates, I choose 10

6- Select No, according to the guy at Ask Ubuntu he says notifications will result errors

7- I don’t know what bytecode database does but I’ll go with yes

8- I think a private mirror is where you hold your own version of the virus database away from the official ones, I don’t have a private mirror so I’ll leave it blank (leave blank and select OK)

9- Log rotation means deleting old log files when they get too old or too big in size, I’ll pick No, maybe you’ll have a different opinion.

After going through the previous steps, you may see this:

Источник

[SOLVED] Updated ClamAV but showed issues

reachmedia

Member

I did a package update for ClamAV (Administration->Updates->Upgrade) to the latest version for ClamAV package.

Please advise for the below error when doing Virus Detector->ClamAV->Update now.

ERROR: /var/log/clamav/freshclam.log is locked by another process
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
ERROR: initialize: libfreshclam init failed.
ERROR: Initialization error!
TASK ERROR: command ‘/usr/bin/freshclam —stdout’ failed: exit code 2

reachmedia

Member

WARNING: Ignoring deprecated option SafeBrowsing at /etc/clamav/freshclam.conf:18
ClamAV update process started at Mon Apr 26 21:21:12 2021
daily.cld database is up-to-date (version: 26152, sigs: 3973675, f-level: 63, builder: raynman)
main.cvd database is up-to-date (version: 59, sigs: 4564902, f-level: 60, builder: sigmgr)
bytecode.cld database is up-to-date (version: 333, sigs: 92, f-level: 63, builder: awillia2)
TASK OK

reachmedia

Member

I actually thought that this Google SafeBrowsing feature is Google API instead of ClamAV?

safebrowsing: (default = 1)
Enables support for Google Safe Browsing.

Proxmox Retired Staff

can you post the output from tail -n 200 /var/log/clamav/freshclam.log to see the error messages?

also what do you get from ps aux | grep clam ?

Best regards,
Oguz

Do you already have a Commercial Support Subscription? — If not, Buy now and read the documentation

reachmedia

Member

# tail -n 200 /var/log/clamav/freshclam.log
Mon Apr 26 20:28:05 2021 -> —————————————
Mon Apr 26 20:28:05 2021 -> freshclam daemon 0.103.2 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
Mon Apr 26 20:28:05 2021 -> ClamAV update process started at Mon Apr 26 20:28:05 2021
Mon Apr 26 20:28:05 2021 -> daily.cld database is up-to-date (version: 26152, sigs: 3973675, f-level: 63, builder: raynman)
Mon Apr 26 20:28:05 2021 -> main.cvd database is up-to-date (version: 59, sigs: 4564902, f-level: 60, builder: sigmgr)
Mon Apr 26 20:28:05 2021 -> bytecode.cld database is up-to-date (version: 333, sigs: 92, f-level: 63, builder: awillia2)
Mon Apr 26 20:28:05 2021 -> —————————————
Mon Apr 26 20:58:05 2021 -> Received signal: wake up
Mon Apr 26 20:58:05 2021 -> ClamAV update process started at Mon Apr 26 20:58:05 2021
Mon Apr 26 20:58:05 2021 -> daily.cld database is up-to-date (version: 26152, sigs: 3973675, f-level: 63, builder: raynman)
Mon Apr 26 20:58:05 2021 -> main.cvd database is up-to-date (version: 59, sigs: 4564902, f-level: 60, builder: sigmgr)
Mon Apr 26 20:58:05 2021 -> bytecode.cld database is up-to-date (version: 333, sigs: 92, f-level: 63, builder: awillia2)
Mon Apr 26 20:58:05 2021 -> —————————————
Mon Apr 26 21:21:10 2021 -> Update process terminated

# ps aux | grep clam
clamav 2035 0.4 13.4 1332896 1095668 ? Ssl 21:21 0:20 /usr/sbin/clamd —foreground=true
clamav 2054 0.0 0.1 65012 14320 ? Ss 21:21 0:00 /usr/bin/freshclam -d —foreground=true
root 2921 0.0 0.0 6072 892 pts/0 R+ 22:38 0:00 grep clam

reachmedia

Member

I think the frontend GUI has a bytecode status and after update it was removed.

Источник

[РЕШЕНО] ClamAV: Error /var/log/clamav/freshclam.log

Сегодня в статье мы рассмотрим ошибку при попытки обновить антивирус ClamAV в операционной системе Linux.

Если выходит сообщение « ClamAV: Error /var/log/clamav/freshclam.log » при попытки обновления антивируса ClamAV командой:

Решение ошибки ClamAV: Error /var/log/clamav/freshclam.log

В сообщении сказано, что /var/log/clamav/freshclam.log блокируется другим процессом. Давайте посмотрим каким:

Из вывода видем что запустил данный процесс сам же clamav.

Как же все таки исправить данную ошибку? Нет ничего проще. Мы знаем что данный процесс запустил сам антивирусник ClamAV. Давайте же остановим его:

Далее запускаем обновление:

Теперь обновление проходит без ошибок. Ну а далее запускаем freshclam для работы в автоматическом режиме:

Если есть вопросы, то пишем в комментариях.

Также можете вступить в Телеграм канал, ВКонтакте или подписаться на Twitter. Ссылки в шапке страницы.
Заранее всем спасибо.

Если вы нашли ошибку, пожалуйста, выделите фрагмент текста и нажмите Ctrl+Enter.

При попытке редактирования базы данных MySQL появляется ошибка «Error: Connection failed». Давайте исправим её.

Сегодня в статье рассмотрим, как можно избавиться от надписи в командной строке: E: Не удалось получить доступ к файлу блокировки

Сегодня в статье рассмотрим решение очередной ошибки в админ панели VestaCP, а точнее ошибки выпуска сертификата от Let`s Encrypt (Error: Читать

Сегодня поговорим о антивирусах в Linux системах. Рассмотрим сканер Rkhunter — сканирование системы Linux на вирусы. rkhunter ( Rootkit Hunter ) — инструмент, который Читать

Источник

Обновить clamav вручную

Всем привет. Решил начать пользоваться антивирусом, потому что появились опасения на счёт малвари (да, на линуксе). Выбор пал на ClamAV, как единственный опенсорсный антивирус. Скачал программу из репозитория, но оказалось, что она бесполезна, так как в ней нет сигнатур вирусов. Начал узнавать, оказалось, что это из-за санкций — нам закрыли обновления. Я, естественно, врубил VPN и скачал с сайта три файла — main.cvd , bytecode.cvd и daily.cvd , которые по идее должны нести в себе вирусную базу. Вопрос — куда их надо втыкать, в какую папку, чтобы антивирус их нормально воспринял и интегрировал в себя? Я пытался искать в интернете, но там только способ настройки автоматических обновлений через Tor или какие-то сомнительные зеркала, а я этому не доверяю, хочу сделать всё вручную.

Я, естественно, врубил VPN и скачал с сайта

А почему было не врубить VPN и дать обновиться ему самому?

А как? У меня VPN в виде приложения для браузера.

Проще поднять тор проксю

Я же говорю, я боюсь, что в Tor мне подменят выходной адрес и скачается какая-то бяка, и в итоге средством для борьбы с малварью будет сама по себе малварь.

А мутные впны вебброузерные конечно куда больше доверия вызывают лол

Ну так можно же в VPN весь трафик завернуть. Только нормальный юзай.

Есть VPN-сервисы, которые предлагают инструкцию или даже скрипт по настройке NetworkManager. Соответственно, это соединение можно использовать не только в браузере.

VPN и Tor всё равно рано или поздно заблокируют. Скорее всего, сигнатуры потом придётся качать с проверенных раздач торрентом, куда их будут заносить отдельные умельцы контрабандой. Так что лучше сейчас заранее отработать ручную установку. Да и тема изначально была именно про неё, а мне только про прокси советуют.

VPN и Tor всё равно рано или поздно заблокируют.

Как будут работать Yandex, Сбер, ЦБ и все остальные без VPN?

Бизнес же тоже пользуется не только простые смертные…

Нас могут просто отключить от интернета в качестве санкции, т.е. не обязательно это будет сделано усилиями РКН. Да и что-то мы всё в оффтоп уходим.

Решил начать пользоваться антивирусом

ну и как? вирусы уже нашел?

Так см.выше, базы нет. Естественно, и найдено тоже 0.

ERROR: /var/log/clamav/freshclam.log is locked by another process

ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).

ERROR: initialize: libfreshclam init failed.

ERROR: Initialization error!

Что это значит, как исправлять?

скачал с сайта три файла — main.cvd , bytecode.cvd и daily.cvd , которые по идее должны нести в себе вирусную базу. Вопрос — куда их надо втыкать, в какую папку, чтобы антивирус их нормально воспринял и интегрировал в себя?

Базы ClamAV держит в /var/lib/clamav/ . Они лежат там просто как файлы, можно копировать просто поверх старых.

Если ты запускаешь ClamAV вручную для сканирования, после обновления баз ничего делать не нужно — новый экземпляр сканера откроет и прочитает новые файлы. Если используешь clamd , то либо сервису нужно дать команду перезагрузить базы, например: systemctl reload clamav-daemon , либо послать clamd сигнал SIGUSR2 .

Я уже положил их туда, но система как не воспринимала их, так и не воспринимает (написано, что у меня 0 установленных вирусных сигнатур). И старых версий этих же файлов там не было совсем. Перезагрузить комп пробовал.

clamav-daemon.service is not active, cannot reload.

ERROR: Can’t open /var/log/clamav/clamav.log in append mode (check permissions!).

ERROR: Can’t initialize the internal logger

единственный опенсорсный антивирус

LibClamAV Error: Can’t load /var/lib/clamav/main.cvd: Can’t verify database integrity

LibClamAV Error: cli_loaddbdir(): error loading database /var/lib/clamav/main.cvd

ERROR: Can’t verify database integrity

Known viruses: 1996657

Engine version: 0.103.6

Scanned directories: 0

Scanned files: 0

Infected files: 0

Data scanned: 0.00 MB

Data read: 0.00 MB (ratio 0.00:1)

Time: 7.686 sec (0 m 7 s)

Start Date: 2022:08:05 21:35:28

End Date: 2022:08:05 21:35:36

Это ты дал команду запустить clamd с аргументом SIGUSR2, а я про посылку сигнала говорил. Сигналы это такой способ посылки сообщений запущенным процессам. Утилита kill умеет посылать сигналы. Например, kill -USR2 12345 пошлёт сигнал SIGUSR2 процессу с идентификатором 12345 .

У тебя, судя по всему, clamd просто не запущен, так что посылать сигналы некуда. Да и не нужно.

Видимо, что-то не то скачал.

Что в начале файла main.cvd ?

ClamAV-VDB:16 Sep 2021 08-32 -0400:62:6647427:90:137eccce31aacb21b5a98bb8c21cefd6:twaJBls8V5q64R7QY10AatEtPNuPWoVoxTaNO1jpBg7s5jIMMXpitgG1000YLp6rb0TWkEKjRqxneGTxuxWaWm7XBjsgwX2BRWh/y4fhs7uyImdKRLzQ5y8e2EkSChegF/i8clqfn+1qetq9j4gbktJ3JZpOXPoHlyr2Dv9S/Bg:sigmgr:1631795562

Дальше не читает стандартным редактором.

Заголовок вроде актуальный.

Файл полностью докачался? Размер должен быть 170479789 байт.

Размер файла 3,5 MB. Как точнее посмотреть — не знаю.

hexdump -C /var/lib/clamav/main.cvd | head -20

00000000 43 6c 61 6d 41 56 2d 56 44 42 3a 31 36 20 53 65 |ClamAV-VDB:16 Se|

00000010 70 20 32 30 32 31 20 30 38 2d 33 32 20 2d 30 34 |p 2021 08-32 -04|

00000020 30 30 3a 36 32 3a 36 36 34 37 34 32 37 3a 39 30 |00:62:6647427:90|

00000030 3a 31 33 37 65 63 63 63 65 33 31 61 61 63 62 32 |:137eccce31aacb2|

00000040 31 62 35 61 39 38 62 62 38 63 32 31 63 65 66 64 |1b5a98bb8c21cefd|

00000050 36 3a 74 77 61 4a 42 6c 73 38 56 35 71 36 34 52 |6:twaJBls8V5q64R|

00000060 37 51 59 31 30 41 61 74 45 74 50 4e 75 50 57 6f |7QY10AatEtPNuPWo|

00000070 56 6f 78 54 61 4e 4f 31 6a 70 42 67 37 73 35 6a |VoxTaNO1jpBg7s5j|

00000080 49 4d 4d 58 70 69 74 67 47 31 30 30 30 59 4c 70 |IMMXpitgG1000YLp|

00000090 36 72 62 30 54 57 6b 45 4b 6a 52 71 78 6e 65 47 |6rb0TWkEKjRqxneG|

000000a0 54 78 75 78 57 61 57 6d 37 58 42 6a 73 67 77 58 |TxuxWaWm7XBjsgwX|

000000b0 32 42 52 57 68 2f 79 34 66 68 73 37 75 79 49 6d |2BRWh/y4fhs7uyIm|

000000c0 64 4b 52 4c 7a 51 35 79 38 65 32 45 6b 53 43 68 |dKRLzQ5y8e2EkSCh|

000000d0 65 67 46 2f 69 38 63 6c 71 66 6e 2b 31 71 65 74 |egF/i8clqfn+1qet|

000000e0 71 39 6a 34 67 62 6b 74 4a 33 4a 5a 70 4f 58 50 |q9j4gbktJ3JZpOXP|

000000f0 6f 48 6c 79 72 32 44 76 39 53 2f 42 67 3a 73 69 |oHlyr2Dv9S/Bg:si|

00000100 67 6d 67 72 3a 31 36 33 31 37 39 35 35 36 32 20 |gmgr:1631795562 |

00000110 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |

  • (там чистая звёздочка, неправильно процитировалось)

Источник

  • #1

Hi Proxmox,

I did a package update for ClamAV (Administration->Updates->Upgrade) to the latest version for ClamAV package.

Please advise for the below error when doing Virus Detector->ClamAV->Update now.

Thanks

ERROR: /var/log/clamav/freshclam.log is locked by another process
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
ERROR: initialize: libfreshclam init failed.
ERROR: Initialization error!
TASK ERROR: command ‘/usr/bin/freshclam —stdout’ failed: exit code 2

  • #2

I’ve disabled the SafeBrowsing feature based on this thread: https://forum.proxmox.com/threads/clamav-does-not-update.88159/

WARNING: Ignoring deprecated option SafeBrowsing at /etc/clamav/freshclam.conf:18
ClamAV update process started at Mon Apr 26 21:21:12 2021
daily.cld database is up-to-date (version: 26152, sigs: 3973675, f-level: 63, builder: raynman)
main.cvd database is up-to-date (version: 59, sigs: 4564902, f-level: 60, builder: sigmgr)
bytecode.cld database is up-to-date (version: 333, sigs: 92, f-level: 63, builder: awillia2)
TASK OK

  • #3

Last edited: Apr 26, 2021

oguz

oguz

Proxmox Retired Staff


  • #4

hi,

can you post the output from tail -n 200 /var/log/clamav/freshclam.log to see the error messages?

also what do you get from ps aux | grep clam?

  • #5

root@pmg:~# tail -n 200 /var/log/clamav/freshclam.log
Mon Apr 26 20:28:05 2021 -> —————————————
Mon Apr 26 20:28:05 2021 -> freshclam daemon 0.103.2 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
Mon Apr 26 20:28:05 2021 -> ClamAV update process started at Mon Apr 26 20:28:05 2021
Mon Apr 26 20:28:05 2021 -> daily.cld database is up-to-date (version: 26152, sigs: 3973675, f-level: 63, builder: raynman)
Mon Apr 26 20:28:05 2021 -> main.cvd database is up-to-date (version: 59, sigs: 4564902, f-level: 60, builder: sigmgr)
Mon Apr 26 20:28:05 2021 -> bytecode.cld database is up-to-date (version: 333, sigs: 92, f-level: 63, builder: awillia2)
Mon Apr 26 20:28:05 2021 -> —————————————
Mon Apr 26 20:58:05 2021 -> Received signal: wake up
Mon Apr 26 20:58:05 2021 -> ClamAV update process started at Mon Apr 26 20:58:05 2021
Mon Apr 26 20:58:05 2021 -> daily.cld database is up-to-date (version: 26152, sigs: 3973675, f-level: 63, builder: raynman)
Mon Apr 26 20:58:05 2021 -> main.cvd database is up-to-date (version: 59, sigs: 4564902, f-level: 60, builder: sigmgr)
Mon Apr 26 20:58:05 2021 -> bytecode.cld database is up-to-date (version: 333, sigs: 92, f-level: 63, builder: awillia2)
Mon Apr 26 20:58:05 2021 -> —————————————
Mon Apr 26 21:21:10 2021 -> Update process terminated

root@pmg:~# ps aux | grep clam
clamav 2035 0.4 13.4 1332896 1095668 ? Ssl 21:21 0:20 /usr/sbin/clamd —foreground=true
clamav 2054 0.0 0.1 65012 14320 ? Ss 21:21 0:00 /usr/bin/freshclam -d —foreground=true
root 2921 0.0 0.0 6072 892 pts/0 R+ 22:38 0:00 grep clam

  • #6

I think the frontend GUI has a bytecode status and after update it was removed.

pmg-clamav.JPG

In the terminal you should highlight the option you want then press the tab key from your keyboard to chose either Ok or Cancel, then hit Enter.

Here is how I did it.

1- Run this command in terminal

Code: Select all

sudo dpkg-reconfigure clamav-freshclam

2- Pick manual
Image

3- Select the closet location
Image

4- Leave blank (unless you’re using a proxy)
Image

5- Not sure if it’s effective or not since we already disabled auto-updates, I choose 10
Image

6- Select No, according to the guy at Ask Ubuntu he says notifications will result errors
Image

7- I don’t know what bytecode database does but I’ll go with yes
Image

8- I think a private mirror is where you hold your own version of the virus database away from the official ones, I don’t have a private mirror so I’ll leave it blank (leave blank and select OK)
Image

9- Log rotation means deleting old log files when they get too old or too big in size, I’ll pick No, maybe you’ll have a different opinion.
Image

After going through the previous steps, you may see this:

Code: Select all

Wed Jul 14 13:49:31 2021 -> Your ClamAV installation is OUTDATED!
Wed Jul 14 13:49:31 2021 -> Local version: 0.103.2 Recommended version: 0.103.3

It doesn’t matter, it’s telling you that Clamav itself is outdated, as for the virus database it’s fine and up-to-date

Code: Select all

Wed Jul 14 13:49:31 2021 -> daily.cld database is up-to-date
Wed Jul 14 13:49:31 2021 -> main.cvd database is up-to-date
Wed Jul 14 13:49:31 2021 -> bytecode.cvd database is up-to-date

What is ClamAV?

ClamAV is an opensource antivirus engine which is used to detect trojans , rootkits ,malwares , virus and malicious threats.

It comes with a inbuilt utilities such as command line scanner , multi thread daemon which can be scaled , automatic database updater.

Most of us think that Linux servers are very secure and it’s highly protected.But it’s not the case.Sometimes the packages we install and the application we setup and their dependencies may have security and vulnerability issues.

We have to check the systems regularly for any security threats and vulnerability issues.The security and vulnerability issues can either be in a file , or the packages we install and can be injected through the websites.

To overcome such scenario , We have to setup a proper vulnerability scanner so that we can take actions on them immediately if found any.

In this article , We will see how to setup an open source antivirus engine which helps us to identify trojan , malwares , malicious threats and viruses.

Setup Clamav on Ubuntu Instances:

First we need to install clamav packages in all the systems.Since the clamav package comes with the systems repository we can install it directly.

To install clamav in the Ubuntu systems , use the below command,

apt-get install clamav

Once the clamav is installed , freshclam comes with the package by default.

If you want to know the version of clamav that is installed, Issue the below command.

clamscan -V

freshclam is a command which is used to update the clamav scanner virus definitions.

So For the first time, We need to manually update the virus definitions database and the virus signatures.

For the first time You might face an issues when running freshclam,

[email protected]:~# freshclam 
ERROR: /var/log/clamav/freshclam.log is locked by another process
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
ERROR: initialize: libfreshclam init failed.
ERROR: Initialization error!

To fix this , We just have to kill the freshclam process using the below command,

pkill freshclam

Now if you run freshclam , You should see the following output.

[email protected]:~# freshclam
Tue Jan 21 23:04:28 2020 -> ClamAV update process started at Tue Jan 21 23:04:28 2020
Tue Jan 21 23:04:28 2020 -> daily.cvd database is up to date (version: 25702, sigs: 2153296, f-level: 63, builder: raynman)
Tue Jan 21 23:04:28 2020 -> main.cvd database is up to date (version: 59, sigs: 4564902, f-level: 60, builder: sigmgr)
Tue Jan 21 23:04:28 2020 -> bytecode.cvd database is up to date (version: 331, sigs: 94, f-level: 63, builder: anvilleg)

Now we are ready to scan the servers.

You can just run the clamscan command which will scan all the files and folder in the server and provide us the output.

clamscan

This might take longer If you have more files and folders in the server.

If you want to send the scanning process to a file , use the below command.

clamscan -r / > scannedreport.docx

If you want to scan the particular folder and files and subdirectories of that folder, use the below command.

clamscan -r /Downloads > downloadscannedreport.docx

Once the scan is completed, You should see the output as shown below:

[email protected]:~$ clamscan -r Music
Music/Wordpress-Pages-Backup/fit-devops.WordPress.2020-01-12.xml: OK
Music/Wordpress-Pages-Backup/fit-devops.WordPress.2020-01-04.xml: OK
Music/Wordpress-Pages-Backup/fit-devops.WordPress.2020-01-16.xml: OK
Music/Wordpress-Pages-Backup/fit-devops.WordPress.2020-01-15.xml: OK
Music/Wordpress-Pages-Backup/fit-devops.WordPress.2020-01-14.xml: OK

----------- SCAN SUMMARY -----------
Known viruses: 6708220
Engine version: 0.102.1
Scanned directories: 2
Scanned files: 5
Infected files: 0
Data scanned: 12.11 MB
Data read: 7.34 MB (ratio 1.65:1)
Time: 17.376 sec (0 m 17 s)

If you want to scan all the file and folder and list only the infected files , Use the below command,

clamscan -r --bell -i / > infectedfiles.docs

If you want to send the output to a different file If any infected files found, Use the belo command.

clamscan -r  /Downloads |grep FOUND  >> infectedfiles.docs

Automating the scanning of folders

If you want to schedule the virus scanning to run on the particular time, We need to add a cronjob.

Lets say we want to say our servers everyday at 11PM.We will add a cronjob

crontab -e
0 23 * * * clamscan -r / > scannedoutput.docs

Clamscan can consume lot of CPU.In order to overcome that , We can limit the cpu usage for the clamscan.

cpulimit is the package we have to install and we can limit the cpu usage of a process.

apt-get install cpulimit
yum install cpulimit
cpulimit -e program -l %cpu & 

First we have start a process and then limit the cpu usage for that particular process.

[email protected]:~$ clamscan Downloads/ &
[1] 6885
[email protected]:~$ cpulimit -e 6885 -l 40

This way to can limit the cpu usage for the clamav scanner.

Hope this article helped you to mitigate the issues related to malwares and vulnerabilities using clamscan virus scanner.

Please do check out my other publications.

Forum rules
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.

gael33

Level 4
Level 4
Posts: 405
Joined: Thu Mar 19, 2009 9:50 am
Location: Glasgow, Scotland.

Clamav won’t update?

I’ve noticed that the antivirus won’t update. Tried freshclam from the CLI … failt?

How do I fix it?

Gael.

Attachments
Screenshot from 2021-04-04 20-27-52.png

Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.

Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.

Linux Mint 21 Cinnamon
Saor Alba Gu Brath

User avatar

spamegg

Level 9
Level 9
Posts: 2964
Joined: Mon Oct 28, 2019 2:34 am
Contact:

Re: Clamav won’t update?

Post

by spamegg » Mon Apr 05, 2021 2:49 am

You don’t need to use antivirus on Mint. I used Clamav in the past, there was a complicated update procedure, had to go read some stuff in their documentation. Even then it still wasn’t working properly. It’s just not worth it. I’m guessing just like I was, you are recently switching from Windows right? You’ll need to learn to let go of these old Windows habits.

User avatar

JoeFootball

Level 13
Level 13
Posts: 4643
Joined: Tue Nov 24, 2009 1:52 pm
Location: /home/usa/mn/minneapolis/joe

Re: Clamav won’t update?

Post

by JoeFootball » Mon Apr 05, 2021 5:49 am

gael33 wrote:
How do I fix it?

I’m inferring from the error, that the mirror that you want to use for updates needs to be specified in the freshclam configuration file.

Hoser Rob

Level 19
Level 19
Posts: 9588
Joined: Sat Dec 15, 2012 8:57 am

Re: Clamav won’t update?

Post

by Hoser Rob » Mon Apr 05, 2021 8:45 am

spamegg wrote: ↑

Mon Apr 05, 2021 2:49 am


You don’t need to use antivirus on Mint. ….

+1. The funny thing is that clam isn’t even intended for Linux viruses (which don’t exist in the wild anyway), it’s for checking attachments on Linux mail servers for Windows viruses. And people use a program like that for some time and no one ever seems to notice.

gael33

Level 4
Level 4
Posts: 405
Joined: Thu Mar 19, 2009 9:50 am
Location: Glasgow, Scotland.

Re: Clamav won’t update?

Post

by gael33 » Mon Apr 05, 2021 10:09 am

spamegg wrote: ↑

Mon Apr 05, 2021 2:49 am


You don’t need to use antivirus on Mint. I used Clamav in the past, there was a complicated update procedure, had to go read some stuff in their documentation. Even then it still wasn’t working properly. It’s just not worth it. I’m guessing just like I was, you are recently switching from Windows right? You’ll need to learn to let go of these old Windows habits.

I read in a magazine that viruses can be passed on from Linux computers, for example, if I was to receive an email from someone whose computer had been compromised by a virus, it may not affect my computer, but if I was to share the email with another friend who is running MS Windows, they would be infected through me. I would feel bad about that. That’s why I have antivirus software on my computer.

Linux Mint 21 Cinnamon
Saor Alba Gu Brath

DAMIEN1307

Re: Clamav won’t update?

Post

by DAMIEN1307 » Mon Apr 05, 2021 10:13 am

I read in a magazine that viruses can be passed on from Linux computers, for example, if I was to receive an email from someone whose computer had been compromised by a virus, it may not affect my computer, but if I was to share the email with another friend who is running MS Windows, they would be infected through me. I would feel bad about that. That’s why I have antivirus software on my computer.

Its really up to the WINDOWS users to care and protect their own systems…A/V is necessary with Windows for this reason…If they are not protecting their own system, then whos fault is it, yours or theirs???…DAMIEN

byt the way…Cead Mile Failte.

User avatar

Lineman Maul

Level 1
Level 1
Posts: 20
Joined: Sun Apr 18, 2021 8:39 pm
Location: The Ozarks, U.S.

Re: Clamav won’t update?

Post

by Lineman Maul » Wed May 19, 2021 2:45 pm

gael33 wrote: ↑

Mon Apr 05, 2021 10:09 am


I read in a magazine that viruses can be passed on from Linux computers, for example, if I was to receive an email from someone whose computer had been compromised by a virus, it may not affect my computer, but if I was to share the email with another friend who is running MS Windows, they would be infected through me. I would feel bad about that. That’s why I have antivirus software on my computer.

I agree with your sentiments, Gael33. I dual-boot, run w10 in work vms, share and access multiple drives. I also care about my family’s systems, those who haven’t the time or energy to commit to LM yet (I’m trying :D ).

Have you found a fix for your op yet, Gael33? I found clamtk to be a great gui program on LM cinnamon. The command-line is lacking for me at the moment. Specifically, freshclam, which brought me to this thread. From what I understand so far, it’s just a matter of correct configuration.

[…]

DAMIEN1307 wrote: ↑

Mon Apr 05, 2021 10:13 am


Its really up to the WINDOWS users to care and protect their own systems…A/V is necessary with Windows for this reason…If they are not protecting their own system, then whos fault is it, yours or theirs???…DAMIEN

What a curious thing to read here! Are security tools exclusively for windows users? Or, better yet, are linux systems petri dishes for windows systems? Please elaborate.

That blog post itself reeks of speculation. Perhaps it’s the lack of citations that I’m bothered with. I am interested in any examples of clamav (or any other av) being compromised by a third party. I suppose it could happen…but the probability of me passing on an infenction to a windows system seems much higher.

User avatar

pcfan5

Level 5
Level 5
Posts: 545
Joined: Tue Sep 06, 2016 10:57 am
Location: Argentina

Re: Clamav won’t update?

Post

by pcfan5 » Wed Jul 14, 2021 9:25 am

Hello I have the same question as the Topic (I need an antivirus on my linux system because sometimes I get USB sticks used on windows). I went to the clamav offcial site but the solution there is too complicated for me, I don’t know how to compile, and the clamavTK interface shows there is an update but doesn’t apply it.

System:
Host: sil-MOV Kernel: 5.4.0-72-generic x86_64 bits: 64
Desktop: Xfce 4.14.1 Distro: Linux Mint 19.3 Tricia

DAMIEN1307

Re: Clamav won’t update?

Post

by DAMIEN1307 » Wed Jul 14, 2021 10:24 am

sometimes I get USB sticks used on windows

Regarding USB sticks that you get from a windows user…Any possible Windows malware or viruses cannot effect a Linux operating system, they simply cannot execute themselves and would need password permission to do so in any event that would have to be provided by you, the user…DAMIEN

User avatar

blueicetwice

Level 4
Level 4
Posts: 244
Joined: Wed May 25, 2016 8:12 am

Re: Clamav won’t update?

Post

by blueicetwice » Wed Jul 14, 2021 11:17 am

GAEL33, many of us had the same issue.
It requires the user to update each and every application manually.

Frankly, it took me nearly 1/2 hour to do so, which I considered a pain.

I dropped by a Game & Fish [governmental unit] and axe them if they could
find a home for Clamav.

Last edited by blueicetwice on Wed Jul 14, 2021 11:21 am, edited 2 times in total.

DAMIEN1307

Re: Clamav won’t update?

Post

by DAMIEN1307 » Wed Jul 14, 2021 11:54 am

This website does not even give instruction on how to update Clamaverst. :oops: :oops: :oops: :oops:

Of course it doesnt…its trying to tell you that ClamAV and its ilk, are nothing more than a placebo to placate former Windows users, that has no real value or use for the Home linux user and can even be harmful to your system with false positives etc…Pjotr, one of our foremost LM forum members, owns and operates the blog site and is extremely knowledgeable of the «do’s and don’ts» of your Linux operating home use system…Notice the sub-header of the blog…«Antivirus Software and Rootkit Removers: Both Unnecessary and Harmful»…It would behove you to heed his many years of experience and advice…DAMIEN

Last edited by DAMIEN1307 on Wed Jul 14, 2021 12:53 pm, edited 2 times in total.

User avatar

pcfan5

Level 5
Level 5
Posts: 545
Joined: Tue Sep 06, 2016 10:57 am
Location: Argentina

Re: Clamav won’t update?

Post

by pcfan5 » Wed Jul 14, 2021 1:29 pm

Thanks for the replies. First of all if someone has placed a question regarding how to update something, it is because it is needed for some reason. In my case, most clients bring me USB sticks they use under windows. Though I know their viruses aren’t harmful to my Gnu-Linux system, sometimes they need me to fix them for any reason. So the topic question isn’t «use or don’t use anti -virus», for that there are many topics , and many discussions, and after all it is an end-user call.
The question is simple, how to update Clamav, if we like. I searched on the Clamav oficial site https://www.clamav.net/, and the procedure is too complex for me since I don’t know how to compile a program, neither I understand the instructions or readme file that comes with the hithub file.

I’ve been reading for quite a while now, these are some of my results.

Code: Select all

sudo freshclam
  
WARNING: Ignoring deprecated option SafeBrowsing at /etc/clamav/freshclam.conf:22
ERROR: /var/log/clamav/freshclam.log is locked by another process
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
ERROR: initialize: libfreshclam init failed.
ERROR: Initialization error!

just in case I also tried:

Code: Select all

sudo apt-get install clamav-daemon
Reading package lists... Done
Building dependency tree       
Reading state information... Done
clamav-daemon is already the newest version (0.103.2+dfsg-0ubuntu0.18.04.2).
The following packages were automatically installed and are no longer required:
  gconf-service gconf-service-backend gconf2-common libgconf-2-4
  libgraphicsmagick++1-dev libgraphicsmagick1-dev simutrans-data
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.

Code: Select all

]sudo apt-get install libclamunrar6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libclamunrar6

I’ve also read on this forum , someone suggested not to pay attention to the GUI interface of clamav-TK saying there is an update.

The options to download a tarball from «clamav.net» in order to get version 0.103.3 provide a file to work with, which is to advanced for me and dare to say it is the same for this topic author.

Last edited by pcfan5 on Wed Jul 14, 2021 1:57 pm, edited 2 times in total.

DAMIEN1307

Re: Clamav won’t update?

Post

by DAMIEN1307 » Wed Jul 14, 2021 1:48 pm

For my limited virus detection needs, I just use VirusTotal.

+1…This is the best advice for anyone that absolutely needs such a thing…At least this one doesnt require a download to your system and has over 70 different A/Vs simultaneously scanning what you give to it to scan…DAMIEN

User avatar

pcfan5

Level 5
Level 5
Posts: 545
Joined: Tue Sep 06, 2016 10:57 am
Location: Argentina

Re: Clamav won’t update?

Post

by pcfan5 » Wed Jul 14, 2021 1:54 pm

DAMIEN1307 wrote: ↑

Wed Jul 14, 2021 1:48 pm

For my limited virus detection needs, I just use VirusTotal.

+1…This is the best advice for anyone that absolutely needs such a thing…At least this one doesnt require a download to your system and has over 70 different A/Vs simultaneously scanning what you give to it to scan…DAMIEN

Thank you. ;)

DAMIEN1307

Re: Clamav won’t update?

Post

by DAMIEN1307 » Wed Jul 14, 2021 3:21 pm

Thank you. ;)

Your welcome…You should also Thank @JoeFootball for mentioning it in the first place as well…lol…DAMIEN

— Advertisement —

Are there viruses in Linux? The answer is yes, the point is that Linux is a very secure system that minimizes risks. However, when you use a Linux server on a network where there are many clients using Windows, it is useful to install ClamAV to remove those viruses.

ClamAV is an open source antivirus engine for detecting Trojans, viruses, malware and other malicious threats. Of course, it is available for the most common Linux distributions including Debian, Ubuntu, and CentOS.

In case you didn’t know, ClamAV is the standard for mail gateway scanning software. Of course, we are talking about the open source area. This tells you how powerful and reliable it is. All this, with a high performance, which assures you that you will not have an unnecessary expense of computer resource.

Let’s install ClamAV on Debian 10 / Debian 9.

1. Install ClamAV

Installing ClamAV is really simple because it is available in the main repositories of most Linux distributions.

In case you are using Fedora:

:~$ sudo dnf install clamav

For CentOS 7:

:~$ sudo yum install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd

To install ClamAV in OpenSuse, just run:

:~$ sudo zypper install clamav

And for Debian and Ubuntu:

:~$ su
:~# apt update && sudo apt upgrade
:~# apt-get install clamav clamav-daemon

1.- Upgrading the system

1.- Upgrading the system
2.- Install ClamAV on Debian
2.- Install ClamAV on Debian

The installation is done.

2. Using ClamAV

Like any antivirus, its effectiveness depends on how often you update your virus definition. So the first step is to update ClamAV.

:~# freshclam

3.- Refreshing the clamav database

3.- Refreshing the ClamAV database

Next, scan a directory.

:~# clamscan -r /home/angelo

4.- Scanning a directory

4.- Scanning a directory

The -r option is for recursively search.

In this case, ClamAV doesn’t detect any viruses because I literally don’t have any. It is practically a clean Debian installation.

I got an infected file, let’s see how ClamAV treats it.

5.- An infected file found

5.- An infected file found

As you can see, ClamAV found the infected file. Now, remove it.

:~# clamscan --infected --remove --recursive /home/angelo

6.- Removing an infected file

6.- Removing an infected file

The above process is very easy but it is not a good idea if it has to be done frequently. So, initialize the ClamAV daemon to constantly look for threats.

:~# systemctl start clamav-daemon
:~# systemctl start clamav-freshclam

Finally, you can consult the rest of ClamAV usage using its help. It is important to know other options of use and configuration.

:~# clamav --help

8.- Other clamav options

7.- Others ClamAV options

And that’s it for now.

Conclusion

It is important to know how to use ClamAV on Linux because security is an issue that should not be taken lightly. Its installation and use are quite simple but because it is open source it guarantees a correct and frequently updated database.

Please share this post with your friends.

Понравилась статья? Поделить с друзьями:
  • Error init webgl failed
  • Error init render что это
  • Error init port failed please retry
  • Error init driver 2 xone
  • Error init driver 0xc0000603