The most common cause of this error is a problem with the ClamAV installation. First check to make sure it's running by running the following:

# svstat /clamd

and you should get an output similar to

/service/clamav/: up (pid 32616) 1972 seconds

The user above can be anything. I personally use user qscand to run clamav as well as SpamAssassin.

Check the freshclam logs at /var/log/qmail/clamd/current and check for errors. If you see any It could be due to the ownership/permissions on /var/db/clamav.

Most of these issues can be resolved by cleaning out the entire clamav installation. I would remove the following folders/files and then doing a clean install of clamav. Please also note that if you do not have these types of paths/files on your system, they may vary from distro to distro:

/usr/local/etc/rc.d/clamav-clamd (could also be startup scripts in /etc/rc.d or /etc/init.d in other systems)
/usr/local/etc/rc.d/clamav-freshclam (could also be startup scripts in /etc/rc.d or /etc/init.d in other systems)


For FreeBSD users, remove all the clamav references from /etc/rc.conf
Take freshclam out of crontab This may not exist if you are running clamav from daemontools.

# cd /var/qmail/bin

# chmod 4755 qmail-scanner-queue
# chown qscand:qscand qmail-scanner-queue

# vi

The first thing you will want to troubleshoot when getting this error is to find out if this is a qmail related problem or a qmail-scanner issue. In most cases, it's either qmail-scanner, clamav or spamassassin causing the problem.

Go to /var/qmail/supervise/qmail-smtpd/run and comment out the following line so it looks like this:


Restart qmail and then try sending a test message. If it goes through, We can proceed with the next step. Skip the next paragraph and continue with the next.

If you don't get your test message, it is a qmail delivery problem. What you will want to run is qmailctl stat and make sure ALL SERVICES are up FOR MORE than one second. If something is running around 0-1 seconds consistently, Something is wrong with that service. Take a look at the logs for that service and troubleshoot from there.

Now we know that it's qmail-scanner related issue. Lets take a quick look at the QMAILQUEUE line in /var/qmail/supervise/qmail-smtpd/run:


The Major hint here is to make sure you used quotation marks ( " ) and not an Apostrophe ( ' )

We can also check spamassassin perl dependancies. Run the following command but change the version number in the Mail-SpamAssassin section:

# /usr/ports/mail/spamassassin/work/Mail-SpamAssassin-3.x.x/build/check_dependencies

It is very important that the Perl versions are the same. So if one perl module is 5.24.2 and the rest are 5.24.1, It would be in your best interest to update that perl module to 5.24.2 as well. .

Another thing we will check is to make spamd is running.

The way to check this is by running

# svstat /service/spamd

You should get the following output:

/service/spamd/: up (pid 2599) 2933 seconds

You can also check the log files at the following locations to look for a more descriptive error:


Also try chmod 4755 /var/qmail/bin/

See Disabling SpamAssassin or Clamav from qmail-scanner below:

Disabling SpamAssassin or Clamav from qmail-scanner

If you use the clamav ownership, rather than qscand, the perl wrapper ends up
owned as qscand, rather than clamav.

Also check out John Simpsons post about getting qmail-scanner to work with clamav.

Make sure that /var/spool/qmailscan/quarantine-attachments.db is being owned by qscand:qscand. Running /var/qmail/bin/ -g as root (w/o setuidgid) will change the db ownership