ClamAV "ERROR: Can't write to temporary directory"

26 posts / 0 new
Last post
#1 Sun, 04/28/2013 - 22:47
christophera

ClamAV "ERROR: Can't write to temporary directory"

Setting up Virtualmin GPS on a new vps server and when I do the final check, I get:

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

ERROR: Can't write to temporary directory

----------- SCAN SUMMARY ----------- Known viruses: 2205557 Engine version: 0.97.6 Scanned directories: 0 Scanned files: 0 Infected files: 0 Data scanned: 0.00 MB Data read: 0.00 MB (ratio 0.00:1) Time: 6.477 sec (0 m 6 s)

. Either change the program on the spam and virus scanners page, or disable this feature.

Looking in clamd.conf (am I in the right file?) - it looks like the temporary directory is /var/tmp

and that directories permissions are: drwxrwxrwt

Any thoughts on how to fix this?

Thanks,

Chris

Mon, 04/29/2013 - 09:08
andreychek

Howdy,

What is the output of these two commands:

mount
df -h
Mon, 04/29/2013 - 13:44
christophera

Hi, I've got:

# mount
/dev/sda on / type ext4 (rw,grpquota,errors=remount-ro,usrquota)
none on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

and

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda               20G  1.6G   18G   9% /
none                  246M     0  246M   0% /dev/shm
Mon, 04/29/2013 - 13:46
christophera

Formatting :) Always a little different than expected here!

Tue, 04/30/2013 - 14:59
christophera

Just checking back in on this in case you have any thoughts -

Tue, 04/30/2013 - 18:53
andreychek

Howdy,

I don't see anything unusual with your drive, the mount flags, or the available space. And the permissions appear correct.

So it's tough to say what might be going wrong there...

As a test, you could always try changing the temporary directory to /tmp, restart ClamAV, and then see if that works properly.

-Eric

Wed, 05/01/2013 - 08:03 (Reply to #6)
christophera

Hi Eric,

Changed to /tmp and rebooted but no difference.

This is on a brand new centOS 6 vps from digitalocean.com, an outfit I have never heard of before but was trying out because their prices look really good.

Would you like the address and root password to take a look? All that's been done with it is the CentOS and Virtualmin GPL install.

Up to you, just thought you might be curious. If you don't want to, perhaps I'll just delete it all and try installing again from scratch and see if the same thing happens.

Chris

Thu, 05/02/2013 - 10:04
christophera

hmm, just tried reinstalling from scratch with a new Centos 6.4 X64 image and same thing happened.

Fri, 05/03/2013 - 18:11 (Reply to #8)
macaba

The same happens with Ubuntu 12.04 LTS

Thu, 05/02/2013 - 14:10
andreychek

That's all very strange! What output do you receive if you run this command:

rpm -qa | grep clam

Thu, 05/02/2013 - 21:49
christophera

I get

clamav-db-0.97.6-1.el6.x86_64
clamd-0.97.6-1.el6.x86_64
clamav-0.97.6-1.el6.x86_64
Fri, 05/03/2013 - 22:20
andreychek

That's all very odd! I haven't seen that behavior before.

In Email Messages -> Spam and Virus Scanning, what is "Virus scanning program" set to?

And I believe you mentioned using a VPS... do you know what type of VPS it is?

-Eric

Fri, 05/03/2013 - 23:25 (Reply to #12)
christophera

When I installed Virtualmin this second time I left everything at the default settings. Currently "Virus scanning program" is set to: Standalone scanner (clamscan).

Fri, 05/03/2013 - 23:28
christophera

If I attempt to enable ClamAV server, I get:

Configuring and enabling the ClamAV scanning server .. Starting ClamAV server and enabling at boot .. .. failed to start : Starting Clam AntiVirus Daemon: [FAILED] .. all done

Fri, 05/03/2013 - 23:34
christophera

I'm checking on the vps type, let you know when I get an answer -

Sat, 05/04/2013 - 07:23 (Reply to #15)
christophera

For vps type, DigitalOcean support says:: Linux KVM technology

Is that what you were asking for?

I told them I was having some trouble setting up Virtualmin and they asked for a "list of possible values?," but I'm not sure what they are looking for. Probably easier if we work it out here :)

Mon, 05/06/2013 - 21:51
christophera

Eric, would you like me to send you a log in so you can take a look? If so, just let me know how to send it your way,

Chris

Wed, 05/08/2013 - 20:01
andreychek

Howdy,

If you look in /var/log/maillog and /var/log/messages after trying to start ClamAV, do you see any errors or unusual messages?

Also, does the command line scanner work when you run it manually?

You can determine that by running this command:

clamscan -v /etc/issue

-Eric

Thu, 05/09/2013 - 15:42 (Reply to #18)
christophera

Hi Eric,

I get:

# clamscan -v /etc/issue
Scanning /etc/issue
/etc/issue: OK

----------- SCAN SUMMARY -----------
Known viruses: 2268914
Engine version: 0.97.6
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.00 MB
Data read: 0.00 MB (ratio 0.00:1)
Time: 6.183 sec (0 m 6 s)

There's nothing that I see related in var/log/maillog,

but in var/log/messages, I'm getting:

May  9 20:23:46 jazz freshclam[24299]: ClamAV update process started at Thu May  9 20:23:46 2013
May  9 20:23:46 jazz freshclam[24299]: Your ClamAV installation is OUTDATED!
May  9 20:23:46 jazz freshclam[24299]: Local version: 0.97.6 Recommended version: 0.97.8
May  9 20:23:46 jazz freshclam[24299]: DON'T PANIC! Read http://www.clamav.net/support/faq
May  9 20:23:46 jazz freshclam[24299]: main.cvd is up to date (version: 54, sigs: 1044387, f-level: 60, builder: sven)
May  9 20:23:46 jazz freshclam[24299]: daily.cld is up to date (version: 17172, sigs: 1229899, f-level: 63, builder: jesler)
May  9 20:23:46 jazz freshclam[24299]: bytecode.cvd is up to date (version: 214, sigs: 41, f-level: 63, builder: neo)
May  9 20:25:10 jazz clamd[24430]: clamd daemon 0.97.6 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
May  9 20:25:10 jazz clamd[24430]: Running as user clam (UID 497, GID 498)
May  9 20:25:10 jazz clamd[24430]: Log file size limited to -1 bytes.
May  9 20:25:10 jazz clamd[24430]: Reading databases from /var/lib/clamav
May  9 20:25:10 jazz clamd[24430]: Not loading PUA signatures.
May  9 20:25:10 jazz clamd[24430]: Bytecode: Security mode set to "TrustSigned".
May  9 20:25:15 jazz clamd[24430]: Loaded 2268914 signatures.
May  9 20:25:16 jazz clamd[24430]: TCP: Bound to address 127.0.0.1 on port 3310
May  9 20:25:16 jazz clamd[24430]: TCP: Setting connection queue length to 30
May  9 20:25:16 jazz clamd[24430]: LOCAL: Unix socket file /var/run/clamav/clamd.sock
May  9 20:25:16 jazz clamd[24430]: LOCAL: Setting connection queue length to 30
May  9 20:25:16 jazz clamd[24430]: daemonize() failed: Cannot allocate memory
May  9 20:25:16 jazz clamd[24430]: Socket file removed.
Thu, 05/09/2013 - 22:23
andreychek

Hmm, that "daemonize() failed: Cannot allocate memory" error is a bit troubling.

What output do you get if you run this command:

free -m

Fri, 05/10/2013 - 01:00
christophera
             total       used       free     shared    buffers     cached
Mem:           490        358        132          0         32        167
-/+ buffers/cache:        158        332
Swap:            0          0          0
Fri, 05/10/2013 - 08:33
andreychek

Aha, I think that might be a large part of the issue there. I don't think you have enough RAM to run the ClamAV process. You only have 490MB of RAM, and there isn't any swap on your system.

That's a fairly low-memory system there, I wouldn't recommend running any daemon/service that doesn't absolutely need to be running.

It does seem that ClamAV is able to run from the command line though when you're doing it manually.

I'm really not sure what might cause all that :-)

I'm doing some Googling on that though, I'll let you know what I come up with.

-Eric

Fri, 05/10/2013 - 11:06
christophera

Thank Eric, that was it.

I thought it met the min requirements - but it most have been that I just needed more RAM. I resized the server up to 1GB and retried and it loaded everything right up.

Thanks again, glad that is resolved. I had planed to resize it anyway, but was using this smaller server as a test one,

Chris

Fri, 05/10/2013 - 12:45
andreychek

Super, I'm glad that's working now!

-Eric

Mon, 10/07/2013 - 19:04
imcdona

I'm having a similar issue on a Digital Ocean VPS running CentOS 6.4 32bit with 512mb of ram. However, in this instance, I'm getting the same error The selected virus scanning command does not work : ERROR: Can't write to temporary directory even though I don't have the daemon mode selected. It's set to standalone.

If I set Allow mailbox users to create mail filters? to no, I'm able to save the changes on the Spam and Virus Scanning preferences page and everything works correctly (even virus scanning) albeit procmail filtering is disabled. The issue seems to revolve around the mail filtering option somehow.

Is there a way I could enable the mail filtering option outside of the "Spam and Virus Scanning" page to avoid this issue?

Thanks

Fri, 10/11/2013 - 18:12
imcdona

I got it working by adding additional memory for a total 1gb of RAM. I was thinking I could drop back down to 512mb after enabling the option to allow users to create mail filters but figured I didn't want to push my luck.

In short, if you're having this problem, adding additional memory will solve the issue. Whether or not you can then drop the memory back down after enabling the mail filter option and not break anything is unknown.

Topic locked