ClamAV permissions

When I installed the OS I left ClamAV checked cause I figured this day and age even being on Linux better safe than sorry. Now every time I got to update it I have to give ownership of /var/lib/clamav/ to active user using Rootactions. I find this odd since I give ownership to the active user using the same method for /mnt/ before creating my folders in it for my secondary drives and partitions, and it never reverts the ownership. I’m assuming var is handled by the system than mnt is. That said how do I keep the system from reverting var’s permissions back so I don’t have to give the active user ownership every time ClamAV updates? Thanks

── 03:36:22 - Update ClamAV Database(FreshClam) ────────────────────────────────
ClamAV update process started at Fri Aug 23 03:36:22 2024
ERROR: Can't create temporary directory /var/lib/clamav/tmp.8f1e9794be
Hint: The database directory must be writable for UID 1000 or GID 1002
ERROR: Update failed.
ClamAV Databases failed: 
   0: Command failed: `/usr/bin/freshclam`
   1: `/usr/bin/freshclam` failed: exit status: 10

Location:
   src/steps/generic.rs:958
Retry? (y)es/(N)o/(s)hell/(q)uit

freshclam needs superuser access. However, you can enable and start the clamav-freshclam.service as superuser once, which runs every two hours or can overridden in /etc/clamav/freshclam.conf.

sudo systemctl enable --now clamav-freshclam.service
2 Likes

Thanks Service is now enabled.

1 Like

OK even with the service running I’m back to the below. I know it’s not a issue with systemd cause I have 6 other items that I did the below for and all are running fine.

sudo systemctl enanle --now snapd emby.server flaresolverr prowlarr radarr sonarr
Checking for plugin updates
Nothing to install / update

── 04:24:05 - Update ClamAV Database(FreshClam) ────────────────────────────────
ClamAV update process started at Sat Aug 24 04:24:05 2024
ERROR: Can't create temporary directory /var/lib/clamav/tmp.9a3c483e9d
Hint: The database directory must be writable for UID 1000 or GID 1002
ERROR: Update failed.
ClamAV Databases failed: 
   0: Command failed: `/usr/bin/freshclam`
   1: `/usr/bin/freshclam` failed: exit status: 10

Location:
   src/steps/generic.rs:958
Retry? (y)es/(N)o/(s)hell/(q)uit

You may have modified permissions. You can uninstall and reinstall clamav and re-enable the service

That’s what I was thinking uninstall, delete the /var/liv/clamav/ folder, reboot, reinstall, and re-enable the service.

LOL well that only made it worse. Good idea would of figured on it working. Guess will have to wait to see if the dev for ClamAV weighs in.

sudo systemctl stop clamav-freshclam.service

sudo systemctl disable clamav-freshclam.service

sudo systemctl stop clamav-daemon.service

sudo systemctl disable clamav-daemon.service
sudo pacman -Rns clamav
sudo pacman -Syu clamav

sudo systemctl enable --now clamav-daemon.service

sudo systemctl enable --now clamav-freshclam.service

OK still no love. I went ahead and just on that folder after that didn’t work did sudo chmod 777 /var/lib/clamav/. Worked, but will know for sure tomorrow when I do updates again if it keeps working.

OK looks like chmod isn’t the answer either.

What was the problem with a clean reinstall?

Same issue as above.

Since nothing seems to be working what command would I use to give myself ownership of that folder? I’m thinking that when I do updates I need ownership of the folder for updates to finish without hanging so I would create a ZSH alias for that command and Topgrade to run together.

Cleanly install it. freshclam requires superuser privileges. The alternative is to enable the systemd service. If the service fails with permission issues, it must be reported upstream as a bug.

YES YES YES

sudo chown UID:GID /var/lib/clamav && chmod 755 /var/lib/clamav

Worked like a charm.

1 Like

That ended up not being the solution after all see the post in my issue thread on github. This version of ClamAV is written wrong.

The Arch package’s issue tracker seems to be here: Issues Β· Arch Linux / Packaging / Packages / clamav Β· GitLab

Yea maybe I send them a detailed email so they create an account for me and I can report it to them. This is their version of ClamAV, right? I ask cause I always thought the Extra repo was KDE’s. Thanks

Arch Linux takes ClamAV’s code or binaries and packages the files to be later used by the Arch Linux package management system. This repository contains what Arch Linux maintainers use to create the package for you.

1 Like

See the last post it’s seems to have fixed the issue.