如何正确启动 clamav-freshclam.service:freshclam:... 无法将 PID 保存到文件 /var/run/clamav/freshclam.pid:没有此文件或目录

如何正确启动 clamav-freshclam.service:freshclam:... 无法将 PID 保存到文件 /var/run/clamav/freshclam.pid:没有此文件或目录

无法启动服务 clamav-freshclam.service:

$ sudo systemctl start clamav-freshclam.service 
$ systemctl status clamav-freshclam.service 
● clamav-freshclam.service - ClamAV virus database updater
     Loaded: loaded (/lib/systemd/system/clamav-freshclam.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2022-08-21 15:21:43 CEST; 8s ago
       Docs: man:freshclam(1)
             man:freshclam.conf(5)
             https://docs.clamav.net/
    Process: 103714 ExecStart=/usr/bin/freshclam -d --foreground=true (code=exited, status=2)
   Main PID: 103714 (code=exited, status=2)

Aug 21 15:21:43 seb-C70D-B-311 systemd[1]: Started ClamAV virus database updater.
Aug 21 15:21:43 seb-C70D-B-311 freshclam[103714]: Sun Aug 21 15:21:43 2022 -> !Cant save PID to file /var/run/clamav/freshclam.pid: No such file or directory
Aug 21 15:21:43 seb-C70D-B-311 systemd[1]: clamav-freshclam.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Aug 21 15:21:43 seb-C70D-B-311 systemd[1]: clamav-freshclam.service: Failed with result 'exit-code'.
$ echo $?
3
$ grep PidFile /etc/clamav/freshclam.conf
PidFile /var/run/clamav/freshclam.pid
$ ls /var/run/clamav/
ls: cannot access '/var/run/clamav/': No such file or directory

我猜测该/var/run/clamav/目录不是自动创建的。

EDIT0:找到了:

$ grep -A1 Automatically /etc/clamav/freshclam.conf
# Automatically created by the clamav-freshclam postinst
# Comments will get lost when you reconfigure the clamav-freshclam package

看来我需要重新配置该clamav-freshclam包:

$ sudo mv /etc/clamav/freshclam.conf /etc/clamav/freshclam.BACK
renamed '/etc/clamav/freshclam.conf' -> '/etc/clamav/freshclam.BACK'
$ sudo dpkg-reconfigure clamav-freshclam
$ sdiff -s /etc/clamav/freshclam.conf /etc/clamav/freshclam.BACK
ReceiveTimeout 0                       |    ReceiveTimeout 30
NotifyClamd /etc/clamav/clamd.conf             <
DatabaseMirror db.fr.clamav.net                |    DatabaseMirror db.local.clamav.net
                               >    PidFile /var/run/clamav/freshclam.pid
$ sudo systemctl start clamav-freshclam.service
$ systemctl status clamav-freshclam.service  
● clamav-freshclam.service - ClamAV virus database updater
     Loaded: loaded (/lib/systemd/system/clamav-freshclam.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-08-21 17:29:22 CEST; 5min ago
       Docs: man:freshclam(1)
             man:freshclam.conf(5)
             https://docs.clamav.net/
   Main PID: 63346 (freshclam)
      Tasks: 1 (limit: 8130)
     Memory: 233.0M
     CGroup: /system.slice/clamav-freshclam.service
             └─63346 /usr/bin/freshclam -d --foreground=true

Aug 21 17:30:31 seb-C70D-B-311 freshclam[63346]: Sun Aug 21 17:30:31 2022 -> main.cvd updated (version: 62, sigs: 6647427, f-level: 90, builder: sigmgr)
Aug 21 17:30:31 seb-C70D-B-311 freshclam[63346]: Sun Aug 21 17:30:31 2022 -> bytecode database available for download (remote version: 333)
Aug 21 17:30:31 seb-C70D-B-311 freshclam[63346]: Sun Aug 21 17:30:31 2022 -> Testing database: /var/lib/clamav/tmp.0bd40b5775/clamav-afbed25073ea69c84c5b4b>
Aug 21 17:30:31 seb-C70D-B-311 freshclam[63346]: Sun Aug 21 17:30:31 2022 -> Database test passed.
Aug 21 17:30:31 seb-C70D-B-311 freshclam[63346]: Sun Aug 21 17:30:31 2022 -> bytecode.cvd updated (version: 333, sigs: 92, f-level: 63, builder: awillia2)
Aug 21 17:30:31 seb-C70D-B-311 freshclam[63346]: WARNING: Ignoring deprecated option AllowSupplementaryGroups at /etc/clamav/clamd.conf:11
Aug 21 17:30:31 seb-C70D-B-311 freshclam[63346]: WARNING: Ignoring deprecated option DetectBrokenExecutables at /etc/clamav/clamd.conf:41
Aug 21 17:30:31 seb-C70D-B-311 freshclam[63346]: WARNING: Ignoring deprecated option ScanOnAccess at /etc/clamav/clamd.conf:61
Aug 21 17:30:31 seb-C70D-B-311 freshclam[63346]: ERROR: Parse error at /etc/clamav/clamd.conf:78: Unknown option StatsEnabled
Aug 21 17:30:31 seb-C70D-B-311 freshclam[63346]: Sun Aug 21 17:30:31 2022 -> !NotifyClamd: Cant find or parse configuration file /etc/clamav/clamd.conf
$ grep -A1 Automatically /etc/clamav/clamd.conf 
#Automatically Generated by clamav-base postinst
#To reconfigure clamd run #dpkg-reconfigure clamav-base

看来我还需要重新配置clamav-base包:

$ sudo mv /etc/clamav/clamd.conf /etc/clamav/clamd.BACK
renamed '/etc/clamav/clamd.conf' -> '/etc/clamav/clamd.BACK'
$ sudo dpkg-reconfigure clamav-base
$ ls /etc/clamav/clamd.conf
ls: cannot access '/etc/clamav/clamd.conf': No such file or directory
$ sudo systemctl restart clamav-freshclam.service 
$ systemctl status clamav-freshclam.service  
● clamav-freshclam.service - ClamAV virus database updater
     Loaded: loaded (/lib/systemd/system/clamav-freshclam.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-08-21 17:40:30 CEST; 11s ago
       Docs: man:freshclam(1)
             man:freshclam.conf(5)
             https://docs.clamav.net/
   Main PID: 65732 (freshclam)
      Tasks: 1 (limit: 8130)
     Memory: 3.0M
     CGroup: /system.slice/clamav-freshclam.service
             └─65732 /usr/bin/freshclam -d --foreground=true

Aug 21 17:40:30 seb-C70D-B-311 systemd[1]: Started ClamAV virus database updater.
Aug 21 17:40:30 seb-C70D-B-311 freshclam[65732]: Sun Aug 21 17:40:30 2022 -> ClamAV update process started at Sun Aug 21 17:40:30 2022
Aug 21 17:40:30 seb-C70D-B-311 freshclam[65732]: Sun Aug 21 17:40:30 2022 -> ^Your ClamAV installation is OUTDATED!
Aug 21 17:40:30 seb-C70D-B-311 freshclam[65732]: Sun Aug 21 17:40:30 2022 -> ^Local version: 0.103.6 Recommended version: 0.103.7
Aug 21 17:40:30 seb-C70D-B-311 freshclam[65732]: Sun Aug 21 17:40:30 2022 -> DONT PANIC Read https://docs.clamav.net/manual/Installing.html
Aug 21 17:40:30 seb-C70D-B-311 freshclam[65732]: Sun Aug 21 17:40:30 2022 -> daily.cvd database is up-to-date (version: 26634, sigs: 1998006, f-level: 90, b>
Aug 21 17:40:30 seb-C70D-B-311 freshclam[65732]: Sun Aug 21 17:40:30 2022 -> main.cvd database is up-to-date (version: 62, sigs: 6647427, f-level: 90, build>
Aug 21 17:40:30 seb-C70D-B-311 freshclam[65732]: Sun Aug 21 17:40:30 2022 -> bytecode.cvd database is up-to-date (version: 333, sigs: 92, f-level: 63, build>

问题解决了,现在我需要更新它:-)。

为我 :ClamAV 安装ClamAV 配置

相关内容