I got this error in freshclam

Forum for getting help with Project Gamera, Spamassassin, Clamav, qmail-scanner and other anti-spam tools.
diego
Forum Regular
Forum Regular
Posts: 111
Joined: Tue Aug 05, 2008 5:01 pm

I got this error in freshclam

Unread post by diego »

I am running clamav-0.94.2-3.el5.art

[root@server1 etc]# freshclam
ClamAV update process started at Sat Feb 7 23:07:26 2009
main.cvd is up to date (version: 49, sigs: 437972, f-level: 35, builder: sven)
ERROR: chdir_tmp: Can't create directory ./clamav-eb55b25a4beb18f2bd18e3ba69f69026
WARNING: Incremental update failed, trying to download daily.cvd
ERROR: getfile: Can't create new file /var/clamav/clamav-0a96430273e7660a0a741b252e342aea in /var/clamav
Hint: The database directory must be writable for UID 112 or GID 103
WARNING: Can't download daily.cvd from db.local.clamav.net

What can be causing this?
User avatar
mikeshinn
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 4155
Joined: Thu Feb 07, 2008 7:49 pm
Location: Chantilly, VA

Re: I got this error in freshclam

Unread post by mikeshinn »

The permissions for your /var/clamav (or where-ever your clamav dbs are help, sometimes /var/lib/clamav) are not set correctly. This is usually because freshclam is running a different user from clamd, or something changed the ownership of that directory.

check what user freshclam is running as and check /var/clamav (or whatever it is on your box) for what user/group owns it. Also check clamd - you dont want to change /var/clamav to something different from clamd (you'll break clamd).
diego
Forum Regular
Forum Regular
Posts: 111
Joined: Tue Aug 05, 2008 5:01 pm

Re: I got this error in freshclam

Unread post by diego »

Hi mike.

/var/clamav

its owned by qscand / qscand

and freshclam its root /root
faris
Long Time Forum Regular
Long Time Forum Regular
Posts: 2321
Joined: Thu Dec 09, 2004 11:19 am

Re: I got this error in freshclam

Unread post by faris »

You have qmail-scanner installed?

In that case you need to edit /etc/freshclam.conf so that DatabaseOwner is qscand, as follows:

DatabaseOwner qscand

And in /etc/clamd.conf edit things so that User is qscand too, as follows:

User qscand

Then chown all files in /var/log/clamav and /var/clamav to qscand:qscand by using the following commands

Code: Select all

chown -R qscand:qscand /var/clamav
and

Code: Select all

chown -R qscand:qscand /var/log/clamav
Check if this has solved the problem by just running freshclam on the command line.

Check that clamd restarts correctly by doing

Code: Select all

service clamd restart
Faris.
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>
faris
Long Time Forum Regular
Long Time Forum Regular
Posts: 2321
Joined: Thu Dec 09, 2004 11:19 am

Re: I got this error in freshclam

Unread post by faris »

p.s. Anytime you update clamav using yum, the default ownerships are going to change, and in some cases you .conf files may get overwritten (though that's unusual).

So you need to do this/check this every time you use yum and a new version of clamav/clamd etc is installed.

Faris.
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Re: I got this error in freshclam

Unread post by breun »

Freshclam has its own user setting (called DatabaseOwner) in /etc/freshclam.conf. I always manually set this to qscand instead of the default clamav and chown the /var/clamav dir accordingly.
faris wrote:p.s. Anytime you update clamav using yum, the default ownerships are going to change, and in some cases you .conf files may get overwritten (though that's unusual).

So you need to do this/check this every time you use yum and a new version of clamav/clamd etc is installed.
You'd think that the RPM packages could take care of this for us.
Lemonbit Internet Dedicated Server Management
faris
Long Time Forum Regular
Long Time Forum Regular
Posts: 2321
Joined: Thu Dec 09, 2004 11:19 am

Re: I got this error in freshclam

Unread post by faris »

Yeah, it would be nice if the ownerships were sorted automatically.

The thing is if you use qmail-scanner you end up using qscand and if you don't then you end up using clamav instead.

But remember that the /etc/cron.daily/freshclam script does sort out the ownerships of the directories and files automatically based on what's in the conf files.

Maybe that could get launched automatically after a clamav update, so it would sort everything out and avoid the problem. (otherwise you'd have to wait until the cron job runs)

What do you think Scott/Mike?

Faris.
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Re: I got this error in freshclam

Unread post by scott »

It does sort them out automatically on our systems
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Re: I got this error in freshclam

Unread post by breun »

Scott, what DatabaseOwner do you use in /etc/freshclam.conf, clamav or qscand? I've always had to manually adjust ownerships after ClamAV upgrades and it seems a lot of others are doing the same.
Last edited by breun on Mon Feb 09, 2009 6:39 am, edited 1 time in total.
Lemonbit Internet Dedicated Server Management
diego
Forum Regular
Forum Regular
Posts: 111
Joined: Tue Aug 05, 2008 5:01 pm

SOLVED

Unread post by diego »

Thank you Faris

Your method fixed

I will be aware of this every upgrade.

Thank you
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Re: I got this error in freshclam

Unread post by scott »

Its set to qscand on all my systems
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Re: I got this error in freshclam

Unread post by breun »

Everything is configured to use qscand on our boxes as well. After a ClamAV update /var/clamav is owned by clamav:clamav and 755, so freshclam won't work, because qscand is not allowed to write in /var/clamav. The RPM packages also install files in /var/clamav owned by clamav:clamav that freshclam cannot overwrite. We have to run 'chown -R qscand:qscand /var/clamav' after ClamAV updates to get things to work.
Lemonbit Internet Dedicated Server Management
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Re: I got this error in freshclam

Unread post by scott »

http://3es.atomicrocketturtle.com/packa ... lamav.spec is the spec file if you want to take a crack an an update
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Re: I got this error in freshclam

Unread post by breun »

I have no idea where to start with that one. What we're seeing is that /var/clamav is owned by clamav:clamav after ClamAV updates and there are also files owned by clamav:clamav in that directory after ClamAV updates. The /var/clamav directory is owned by both clamd and clamav-db, and apparently either or both of those packages set clamav:clamav as the owner of /var/clamav and some files in that directory. Running 'chown -R qscand:qscand /var/clamav' fixes this and gets things to work again. I don't know where in the RPM process this should be taken care of.
Lemonbit Internet Dedicated Server Management
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Re: I got this error in freshclam

Unread post by scott »

could be a trigger in qmail-scanner too:

http://3es.atomicrocketturtle.com/packa ... anner.spec

what I do to debug this stuff is:

rpm -q --scripts <package>
rpm -q --triggers <package>
Post Reply