My Amavis which i run in a Ubuntu 14.04.1 LTS sends me every day about 4 Mails with following content:
"pyzor: check failed: internal error, python traceback seen in response"
Well since i didnt see any traceback and wasnt able to find it, i googled...
First Hint was "pyzor ping". I ran it as User amavis and the result was "public.pyzor.org:24441 (200, 'OK')"
So that seems fine. Its alive. Then i tested if its "working".
Input:
spamassassin -D pyzor <1415394952.V54I4460799M230590.h2063374.stratoserver.net\:2\,Sa
Feedback:
Nov 25 08:48:16.182 [13757] dbg: pyzor: network tests on, attempting Pyzor
Nov 25 08:48:30.944 [13757] dbg: pyzor: pyzor is available: /usr/bin/pyzor
Nov 25 08:48:30.945 [13757] dbg: pyzor: opening pipe: /usr/bin/pyzor --homedir /etc/mail/spamassassin check < /tmp/.spamassassin13757wvlpQJtmp
Nov 25 08:48:30.992 [13757] dbg: pyzor: [13759] finished successfully
Nov 25 08:48:30.992 [13757] dbg: pyzor: got response: public.pyzor.org:24441 (200, 'OK') 1 0
After further searching in google without any helping results i thought "look into the Content of /usr/sbin/amavisd-new-cronjob!"
#!/bin/bash
# amavisd-new cronjob helper
#
# Run it as the amavis user
#
# First parameter specifies which cronjob routine to run:
# sa-sync: spamassassin fast sync
# sa-clean: spamassassin cleanup
test -e /usr/bin/sa-learn || exit 0
test -e /usr/sbin/amavisd-new || exit 0
if [ "$(id --name -u)" != "amavis" ]
then
echo "Please run this cronjob as user amavis"
exit 1
fi
set -e
umask 022
if ! perl -MMail::SpamAssassin -e "my \$spamtest = Mail::SpamAssassin->new();
\$spamtest->compile_now (); \$spamtest->{conf}->{use_bayes} ? exit 0 : exit 1"
then
#bayes is disabled - just exit
exit
fi
case $1 in
sa-sync)
/usr/bin/sa-learn --sync 2>&1 >/dev/null
;;
sa-clean)
/usr/bin/sa-learn --sync --force-expire 2>&1 >/dev/null
;;
*)
echo "$0: unknown cron routine $1" >&2
exit 1
;;
esac
exit 0
I was able to succsessfully execute "sa-sync" and "sa-clean" as User Amavis so the error has to be somewhere further up.
I commented following lines and was suddenly able to execute the amavisd-new-cronjob as User amavis without any errors...
#if ! perl -MMail::SpamAssassin -e "my \$spamtest = Mail::SpamAssassin->new();
#\$spamtest->compile_now (); \$spamtest->{conf}->{use_bayes} ? exit 0 : exit 1"
#then
# #bayes is disabled - just exit
# exit
#fi
I dont feel well leaving it as it is, since i am not sure what those lines do or which permissons the User amavis needs to successfully run them.
Has anybody a hint for me how to solve this Problem?
I recently investigated on this issue because I got the same error as a mail from cron. My server runs with Debian Wheezy.
You can track the error by testing pyzor using the documented command line:
$ su - amavis -c "echo test | spamassassin -D pyzor 2>&1 | less"
Of course you can replace "echo test" with a real spam mail in order to get a real test result. But BTT: In my case, the problem was that amavis had no permission to read /etc/spamassassin/servers. I solved this by changing the group and permissions of the file
$ ls -l /etc/spamassassin/servers
-rw------- 1 debian-spamd root 23 Mär 27 10:34 /etc/spamassassin/servers
$ chgrp amavis /etc/spamassassin/servers; chmod g+r /etc/spamassassin/servers
To check if that really helped you can simply rerun the test command line (from above). It now should return without errors.
Cheers, Marco