1

I'm trying to build an email server based on Ubuntu, and I want to run SpamAssassin on it. I've followed the instructions, installed it from the repositories, and when I try to start SpamAssassin I get an error message like the following:

Job for spamassassin.service failed because the control process exited with error code.

See "systemctl status spamassassin.service" and "journalctl -xe" for details.

Running sudo systemctl status spamassassin.service gets me the following:

Feb 02 01:43:46 grace systemd[1]: spamassassin.service: Service RestartSec=100ms expired, scheduling restart.
Feb 02 01:43:46 grace systemd[1]: spamassassin.service: Scheduled restart job, restart counter is at 5.
Feb 02 01:43:46 grace systemd[1]: Stopped Perl-based spam filter using text analysis.
Feb 02 01:43:46 grace systemd[1]: spamassassin.service: Start request repeated too quickly.
Feb 02 01:43:46 grace systemd[1]: spamassassin.service: Failed with result 'exit-code'.
Feb 02 01:43:46 grace systemd[1]: Failed to start Perl-based spam filter using text analysis.

I've tried stopping the service and starting it as well as simply restarting it, but it doesn't make a difference. I can't figure out what's going on.

lordparthurnaax
  • 618
  • 9
  • 21
Ken Wright
  • 61
  • 1
  • 10
  • Not anough info. Please add the output of `grep spamd /var/log/mail.log` (consider adding yourself to the `adm` group so you can read logs without `sudo`). – fkraiem Feb 02 '19 at 07:34
  • Okay, here's a sample of mail.log: Feb 3 08:03:32 grace spamd[10234]: logger: removing stderr method Feb 3 08:03:32 grace spamd[10236]: config: no rules were found! Do you need to run 'sa-update'? Feb 3 08:03:33 grace spamd[10234]: child process [10236] exited or timed out without signaling production of a PID file: exit 255 at /usr/sbin/spamd line 3034. So I ran sa-update (I was too impatient to let it finish before -- my bad) but it exits with code 4, meaning it can't find the rules. I've tried a couple of other channels, but no joy. – Ken Wright Feb 04 '19 at 01:55

1 Answers1

2

If you are following this Ars Technica guide, then you probably have /etc/default/spamassassin looking like this:

SAHOME="/var/lib/spamassassin"
SAGLOBALCFGPATH="/etc/spamassassin"

# Change to one to enable spamd
ENABLED=1

# Options
# See man spamd for possible options. The -d option is automatically added.
OPTIONS="-x --max-children 5 --helper-home-dir ${SAHOME} -u spamd -g spamd --siteconfigpath ${SAGLOBALCFGPATH} --socketpath=/var/spool/postfix/spamassassin/spamd.sock --socketowner=spamd --socketgroup=spamd --socketmode=0660"

# Pid file
# Where should spamd write its PID to file? If you use the -u or
# --username option above, this needs to be writable by that user.
# Otherwise, the init script will not be able to shut spamd down.
PIDFILE="/var/run/spamd.pid"

# Cronjob
# Set to anything but 0 to enable the cron job to automatically update
# spamassassin's rules on a nightly basis
CRON=1

The path expansions of SAHOME and SAGLOBALCFGPATH are failing, so change this file so that it includes the full paths:

# Change to one to enable spamd
ENABLED=1

# Options
# See man spamd for possible options. The -d option is automatically added.
OPTIONS="-x --max-children 5 --helper-home-dir /var/lib/spamassassin -u spamd -g spamd --siteconfigpath /etc/spamassassin --socketpath=/var/spool/postfix/spamassassin/spamd.sock --socketowner=spamd --socketgroup=spamd --socketmode=0660"

# Pid file
# Where should spamd write its PID to file? If you use the -u or
# --username option above, this needs to be writable by that user.
# Otherwise, the init script will not be able to shut spamd down.
PIDFILE="/var/run/spamd.pid"

# Cronjob
# Set to anything but 0 to enable the cron job to automatically update
# spamassassin's rules on a nightly basis
CRON=1
  • 1
    That worked! Thanks! – Ken Wright Dec 28 '19 at 18:41
  • 1
    Hello, @KenWright, if [this] answer was helpful to you, then please consider marking it as the [accepted answer](https://askubuntu.com/help/accepted-answer) (by click on the grey tick ✓ left to it) so others may more easily find it in the future. This is also a polite way to thank the person answering your question for helping you out. – pa4080 Dec 30 '19 at 17:46
  • I didn't know that. Thank you! – Ken Wright Dec 31 '19 at 18:35
  • The better answer is for OP to follow a better guide. For instance: You do not need a `spamd` user. Please review this - it's debian/ubuntu repo-friendlier: https://gist.github.com/bmatthewshea/2acd4126b163216f2cefd605609befc8 – B. Shea Dec 10 '20 at 16:29