clamscan failing due to /tmp directory

When configuring Virtualmin on either a Debian Lenny or Centos-5 Xen VPS partition, the Virtualmin configuration check is failing when it goes to check clamscan, with the following error:


The ClamAV program clamscan does not appear to be working properly :

LibClamAV Warning: ***********************************************************
LibClamAV Warning: *** This version of the ClamAV engine is outdated. ***
LibClamAV Warning: *** DON’T PANIC! Read http://www.clamav.net/support/faq ***
LibClamAV Warning: ***********************************************************
LibClamAV Warning: ***********************************************************
LibClamAV Warning: *** This version of the ClamAV engine is outdated. ***
LibClamAV Warning: *** DON’T PANIC! Read http://www.clamav.net/support/faq ***
LibClamAV Warning: ***********************************************************
ERROR: Can’t write to temporary directory

----------- SCAN SUMMARY -----------
Known viruses: 623266
Engine version: 0.94.2
Scanned directories: 0
Scanned files: 0
Infected files: 0
Data scanned: 0.00 MB
Time: 1.892 sec (0 m 1 s)


I’m not worried about the LibClamAV warning. It’s the ERROR line that’s the problem.

This only started happening in the past week or two. Changing from clamscan to clamdscan “fixes” the issue, but the problem still exists when trying to switch back to clamscan.

What temporary directory is clamscan trying to access? I’ve looked at various config files and can’t seem to figure it out.

Clam’s temp directory generally defaults to either /tmp or /var/tmp.

However, it’s set in the clamd.conf file (in /etc/clamav/clamd.conf on Ubuntu/Debian), with the parameter “TemporaryDirectory”.

You could either try another directory, or simply make sure there’s nothing wrong with /tmp or /var/tmp.

All that said – I’d tend to recommend using clamdscan anyhow… it’s a daemon, and requires a lot less CPU to run.

-Eric

Sure, clamdscan is fine, but I’m with an ISP and we’re rolling this out on a new VPS platform we’re working on and I need it to work “out of the box” for customers when they go through the “Check config” wizard, otherwise it will generate support calls. And there’s no need for unnecessary calls if they can be prevented.

Something changed in the last revision of either Virtualmin or clam… not sure what’s going on, but everything was working with the test setups until recently.

Hmmm… I think clamav is what changed. I’m seeing the following in the clamd.conf file:


#Automatically Generated by clamav-base postinst

TemporaryDirectory is not set to its default /tmp here to make overriding

the default with environment variables TMPDIR/TMP/TEMP possible


clamscan works fine from the command line. It fails when trying to run from virtualmin, probably because there’s no environment variable set.

So, I’ll either write a post-install routine to set the temporary directory, or a routine to set the default in virtualmin to clamdscan.

Well, if Virtualmin isn’t doing something right – you can always file a bug report. No one wants the config test to fail.

While I haven’t seen the problem you’re running into before, if it’s solvable in Virtualmin, I might suggest filing a bug report and saying it’s solvable by setting an environment variable.

You can test that by going into Webmin -> Webmin -> Webmin Configuration -> Operating System and Environment, and setting the variables in the “Additional environment variables” section.

-Eric

Hmmm… adding those variables didn’t fix it. But I just tested on Centos 5 and it’s not happening there. It appears to only be with my Debian Lenny installs. I’ll do a bit more investigating before opening a ticket.

This was fixed by increasing available memory in the VPS partition. Apparently, 256MB is not enough on Debian Lenny to run all of the default daemons installed via Virtualmin GPL.

im using 512 mem and it still fails, i cant upgrade my linode today since they have no more mem available right now. :frowning:

hmm on a new install on deb5 with 512 mem i cannot start clamd :

li62-217:/etc/clamav# clamd
LibClamAV Warning: ***********************************************************
LibClamAV Warning: *** This version of the ClamAV engine is outdated. ***
LibClamAV Warning: *** DON’T PANIC! Read http://www.clamav.net/support/faq ***
LibClamAV Warning: ***********************************************************
Segmentation fault

im not having much luck last few days.

steve

ok i taken the server up to 720mb ram and same issue. I will switch over to centos now. but this is an issue with the latest build by the looks of it.