ClamAV: WARNING: Can't open file ... Permission denied

NethServer Version: 7.9

Hi, last days I got error notification mails like:

Message List

Sun Aug 22 02:54:01 2021

Scanned Folder: /WARNING: Can’t open file /sys/fs/xfs/dm-0/stats/stats_clear: Permission denied
WARNING: Can’t open file /sys/fs/xfs/sda1/stats/stats_clear: Permission denied
WARNING: Can’t open file /sys/fs/xfs/stats/stats_clear: Permission denied
WARNING: Can’t open file /sys/bus/cpu/drivers/processor/bind: Permission denied
WARNING: Can’t open file /sys/bus/cpu/drivers/processor/uevent: Permission denied
<…>
WARNING: Can’t open file /sys/bus/clockevents/drivers_probe: Permission denied
WARNING: Can’t open file /sys/devices/pci0000:00/0000:00:00.0/remove: Permission denied
WARNING: Can’t open file /sys/devices/pci0000:00/0000:00:00.0/rescan: Permission denied
WARNING: Can’t open file /sys/devices/pci0000:00/0000:00:01.0/remove: Permission denied
WARNING: Can’t open file /sys/devices/pci0000:00/0000:00:01.0/rescan: Permission denied
<…>
WARNING: Can’t open file /sys/devices/LNXSYSTM:00/device:00/ACPI0010:00/LNXCPU:02/eject: Permission denied
WARNING: Can’t open file /sys/devices/LNXSYSTM:00/device:00/ACPI0010:00/LNXCPU:03/eject: Permission denied
WARNING: Can’t open file /sys/class/gpio/unexport: Permission denied
WARNING: Can’t open file /sys/class/gpio/export: Permission denied
<…>
WARNING: Can’t open file /sys/module/nf_conntrack_tftp/uevent: Permission denied

Does anyone know this error and is there a solution?

Best regards, Marko

only see this kind of stuff if I"m fooling around with a kernel on a device with is not really supported by that kernel. /sys is a virtual file system where the kernel exposes the devices and their drivers to user space.

So from my (brief) scanning of your reported issue it looks like the kernel on this system is in distress… which is quite alarming…

Or clamav is trying to do stuff it is not allowed to do…
An uid/gid issue comes to mind, is clamav reinstalled recently?
(Or other reinstalls which may have messed uid/gid up…)

EDIT 3th thought:
Does clamav scan the hole rootfs ? Do not think that is possible, in /sys are (virtual) files even root can not touch :hushed: as they belong to the kernel.

I use this server round about a year w/o such problems, it is a standard KVM-Server

is clamav re installed recently?

No, it runs the hole time.

Does clamav scan the hole rootfs

I use it with standard configuration out of the box. I didn’t change anything.

Thank you for your thoughts, MArko

I disabled the scanning. After re-enabling comes an error message

Is /sys present on your system, (as root) ls -l /sys ?

or mount | grep sysfs

yes, it is:

[root@srv01 ~]# mount | grep sysfs
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)

Still there is “something” not right there causing ClamAV not to except the exclusion of /sys.

1 Like

I use exactly the same cloud server type for another Nethserver without problems

DANGERZONE (hope this is clear !)

you may try to remount sysfs

mount -o remount,rw,nosuid,nodev,noexec,relatime -t sysfs sysfs /sys

1 Like

I did it (also a reboot). The error persists.

Maybe i should remove clamscan completely once and reinstall? However, I am not sure how to remove the package without leaving any residue to avoid artifacts.

I think we need to ping @stephdl :wink:

In preparation of this:

config show clamscan

and you may try to reconfigure the module manually by:
signal-event nethserver-clamscan-update

EDIT: and of course
rpm -qa | grep nethserver-clamscan

config show clamscan

[root@srv01 /]# config show clamscan
clamscan=configuration
AlgoDetection=disabled
BlockEncrypted=disabled
BlockMacros=disabled
Bytecode=enabled
BytecodeTimout=120000
BytecodeUnsigned=disabled
DetectBroken=disabled
DetectPua=disabled
DetectStructured=disabled
FilesystemScan=weekly
,/usr/share/doccanExclude=/boot
FilesystemScanFilesystems=/
FilesystemScanReportTo=root
FilesystemScanUnofficialSigs=disabled
IncludePua=Packed,PwTool,NetTool,P2P,IRC,RAT,Tool,Spy,Server,Script
JobDay=7d
JobHour=2h
MaxScanFile=45
PartInstersection=disabled
PhishingScanUrl=disabled
PhishingSigs=disabled
Quarantine=enabled
QuarantineDirectory=/var/spool/clamav/quarantine
ScanArchive=enabled
ScanElf=enabled
ScanHTML=enabled
ScanHwp=enabled
ScanMail=enabled
ScanOle2=enabled
ScanPdf=enabled
ScanPe=enabled
ScanSwf=enabled
ScanXML=enabled
customSettings=
reallyWantToMove=disabled
status=enabled
[root@srv01 /]#

rpm -qa | grep nethserver-clamscan
nethserver-clamscan-1.0.4-1.ns7.sdl.noarch

I did: signal-event nethserver-clamscan-update
… and the error persists

This is not right, maybe related to:

It works on my second server well.
Maybe @stephdl can help.

Thank you Mark!

config setprop clamscan Exclude /boot,/proc,/sys,/usr/share/doc

config show clamscan

[root@srv01 /]# config setprop clamscan Exclude /boot,/proc,/sys,/usr/share/doc
[root@srv01 /]# config show clamscan
clamscan=configuration
AlgoDetection=disabled
BlockEncrypted=disabled
BlockMacros=disabled
Bytecode=enabled
BytecodeTimout=120000
BytecodeUnsigned=disabled
DetectBroken=disabled
DetectPua=disabled
DetectStructured=disabled
Exclude=/boot,/proc,/sys,/usr/share/doc
FilesystemScan=weekly
,/usr/share/doccanExclude=/boot
FilesystemScanFilesystems=/
FilesystemScanReportTo=root
FilesystemScanUnofficialSigs=disabled
IncludePua=Packed,PwTool,NetTool,P2P,IRC,RAT,Tool,Spy,Server,Script
JobDay=7d
JobHour=2h
MaxScanFile=45
PartInstersection=disabled
PhishingScanUrl=disabled
PhishingSigs=disabled
Quarantine=enabled
QuarantineDirectory=/var/spool/clamav/quarantine
ScanArchive=enabled
ScanElf=enabled
ScanHTML=enabled
ScanHwp=enabled
ScanMail=enabled
ScanOle2=enabled
ScanPdf=enabled
ScanPe=enabled
ScanSwf=enabled
ScanXML=enabled
customSettings=
reallyWantToMove=disabled
status=enabled
[root@srv01 /]#

Error persists

still there :thinking:

config setprop clamscan Exclude /boot …?

the db is corrupted… whatever you set that false (corrupt) entry persists.

if I config setprop clamscan Exclude /proc,/sys,/usr/share/doc
without /boot
[root@srv01 /]# config setprop clamscan Exclude /proc,/sys,/usr/share/doc
[root@srv01 /]# config show clamscan
clamscan=configuration
AlgoDetection=disabled
BlockEncrypted=disabled
BlockMacros=disabled
Bytecode=enabled
BytecodeTimout=120000
BytecodeUnsigned=disabled
DetectBroken=disabled
DetectPua=disabled
DetectStructured=disabled
Exclude=/proc,/sys,/usr/share/doc
FilesystemScan=weekly
,/usr/share/doccanExclude=/boot
FilesystemScanFilesystems=/
FilesystemScanReportTo=root
FilesystemScanUnofficialSigs=disabled
IncludePua=Packed,PwTool,NetTool,P2P,IRC,RAT,Tool,Spy,Server,Script
JobDay=7d
JobHour=2h
MaxScanFile=45
PartInstersection=disabled
PhishingScanUrl=disabled
PhishingSigs=disabled
Quarantine=enabled
QuarantineDirectory=/var/spool/clamav/quarantine
ScanArchive=enabled
ScanElf=enabled
ScanHTML=enabled
ScanHwp=enabled
ScanMail=enabled
ScanOle2=enabled
ScanPdf=enabled
ScanPe=enabled
ScanSwf=enabled
ScanXML=enabled
customSettings=
reallyWantToMove=disabled
status=enabled
[root@srv01 /]#