Mailing List Archive

Having trouble getting Spamassassin to work on Ubuntu Server 18.10
I've been trying to set up an email server and I want to use
Spamassassin to prevent it from becoming Spam Central.  I've installed
SA and spamass-milter, but when I try to restart it after customizing
the config files, I get this:

Job for spamassassin.service failed because the control process exited
with error code.
See "systemctl status spamassassin.service" and "journalctl -xe" for
details.

So I checked journalctl and got this:

-- Unit spamassassin.service has begun starting up.
Feb 08 02:19:31 grace spamd[6289]: logger: removing stderr method
Feb 08 02:19:32 grace spamd[6314]: Timeout::_run: check: no loaded
plugin implements 'check_main': cannot scan!
Feb 08 02:19:32 grace spamd[6314]: Check that the necessary '.pre' files
are in the config directory.
Feb 08 02:19:32 grace spamd[6314]: At a minimum, v320.pre loads the
Check plugin which is required.
Feb 08 02:19:32 grace spamd[6289]: child process [6314] exited or timed
out without signaling production of a PID file: exit 255 at
/usr/sbin/spamd line 3034.
Feb 08 02:19:32 grace systemd[1]: spamassassin.service: Control process
exited, code=exited status=255
Feb 08 02:19:32 grace systemd[1]: spamassassin.service: Failed with
result 'exit-code'.
Feb 08 02:19:32 grace systemd[1]: Failed to start Perl-based spam filter
using text analysis.
-- Subject: Unit spamassassin.service has failed

At a friend's suggestion I also checked the mail.log and got this:

Feb  8 02:19:25 grace spamd[6144]: logger: removing stderr method
Feb  8 02:19:26 grace spamd[6172]: Timeout::_run: check: no loaded
plugin implements 'check_main': cannot scan!
Feb  8 02:19:26 grace spamd[6172]: Check that the necessary '.pre' files
are in the config directory.
Feb  8 02:19:26 grace spamd[6172]: At a minimum, v320.pre loads the
Check plugin which is required.
Feb  8 02:19:26 grace spamd[6144]: child process [6172] exited or timed
out without signaling production of a PID file: exit 255 at
/usr/sbin/spamd line 3034.

Yes, v320.pre loads the Mail::SpamAssassin::Plugin::Check module, which
is installed and up to date.  I've just about run out of ideas.  Anyone
have any?

Sorry this is so long, but I didn't want to omit any pertinent information.

Ken Wright,
pulling his hair out.
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On Sun, Feb 10, 2019 at 02:30:28AM -0500, Ken Wright wrote:
> I've been trying to set up an email server and I want to use
> Spamassassin to prevent it from becoming Spam Central.  I've installed
> SA and spamass-milter, but when I try to restart it after customizing
> the config files, I get this:
>
> Job for spamassassin.service failed because the control process exited
> with error code.
> See "systemctl status spamassassin.service" and "journalctl -xe" for
> details.
>
> So I checked journalctl and got this:
>
> -- Unit spamassassin.service has begun starting up.
> Feb 08 02:19:31 grace spamd[6289]: logger: removing stderr method
> Feb 08 02:19:32 grace spamd[6314]: Timeout::_run: check: no loaded
> plugin implements 'check_main': cannot scan!
> Feb 08 02:19:32 grace spamd[6314]: Check that the necessary '.pre' files
> are in the config directory.
> Feb 08 02:19:32 grace spamd[6314]: At a minimum, v320.pre loads the
> Check plugin which is required.
what is the content of the "v320.pre" file ?
It seems you have disabled too many plugins.
Giovanni
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On 10 Feb 2019, at 00:30, Ken Wright <daddywarlock@gmail.com> wrote:
> I've been trying to set up an email server

Don't do it!

Seriously, running and maintaining a mail server is practically a full-time job. Do you really want to spend a lot of time (and some time nearly every day) maintaining and patching and dealing with spam and viruses.

> Job for spamassassin.service failed because the control process exited
> with error code.
> See "systemctl status spamassassin.service" and "journalctl -xe" for
> details.

What OS are you using (version and patch level)

> Feb 8 02:19:25 grace spamd[6144]: logger: removing stderr method
> Feb 8 02:19:26 grace spamd[6172]: Timeout::_run: check: no loaded
> plugin implements 'check_main': cannot scan!

I suspect you have a versioning problem.

> Yes, v320.pre loads the Mail::SpamAssassin::Plugin::Check module, which
> is installed and up to date. I've just about run out of ideas. Anyone
> have any?

Saying it is up to date isn't useful without version information. The current version of SA is 3.4.2.

How did you install SpamAssassin?

Did you tun sa-update? Did it succeed? If not, did you run it with a -D flag?

Get SA working before you try to using spams-milter.


--
I can't die, I haven't seen The Jolson Story
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On 2/10/19 7:35 AM, @lbutlr wrote:
> Don't do it!

Why not?

> Seriously, running and maintaining a mail server is practically a
> full-time job.

I profoundly disagree.

I spend less than 30 minutes a week administering my email / web / dns /
news / shell servers. I've been spending about the same amount of time
for years.

Admittedly I would spend about an hour a week on actual system
administration when I ran a server that served hundreds of clients for
$EMPLOYER. But 1 out of 40 hours (for an American work week) is /far/
from a full-time job.

> Do you really want to spend a lot of time (and some time nearly every day)
> maintaining and patching and dealing with spam and viruses.

Is 30 minutes a week worth the freedom and flexibility that I have to do
what ever I want on my servers? Absolutely.

> What OS are you using (version and patch level)

Ubuntu LTS or Gentoo with recent updates, depending on the system.

> Saying it is up to date isn't useful without version information. The
> current version of SA is 3.4.2.

I've largely been happy (as in they do what I want) with the versions
that come in distro repos.

> How did you install SpamAssassin?
>
> Did you tun sa-update? Did it succeed? If not, did you run it with a
> -D flag?
>
> Get SA working before you try to using spams-milter.

Agreed.



--
Grant. . . .
unix || die
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On 2/10/19 3:56 AM, Giovanni Bechis wrote:
> On Sun, Feb 10, 2019 at 02:30:28AM -0500, Ken Wright wrote:
>> I've been trying to set up an email server and I want to use
>> Spamassassin to prevent it from becoming Spam Central.  I've installed
>> SA and spamass-milter, but when I try to restart it after customizing
>> the config files, I get this:
>>
>> Job for spamassassin.service failed because the control process exited
>> with error code.
>> See "systemctl status spamassassin.service" and "journalctl -xe" for
>> details.
>>
>> So I checked journalctl and got this:
>>
>> -- Unit spamassassin.service has begun starting up.
>> Feb 08 02:19:31 grace spamd[6289]: logger: removing stderr method
>> Feb 08 02:19:32 grace spamd[6314]: Timeout::_run: check: no loaded
>> plugin implements 'check_main': cannot scan!
>> Feb 08 02:19:32 grace spamd[6314]: Check that the necessary '.pre' files
>> are in the config directory.
>> Feb 08 02:19:32 grace spamd[6314]: At a minimum, v320.pre loads the
>> Check plugin which is required.
> what is the content of the "v320.pre" file ?
> It seems you have disabled too many plugins.

I don't think so.  v320.pre loads the Check plugin first thing.  Here's
the file:

# /etc/mail/spamassassin directory; previously only one, "init.pre" was
# read.  Now both "init.pre", "v310.pre", and any other files ending in
# ".pre" will be read.  As future releases are made, new plugins will be
# added to new files, named according to the release they're added in.
###########################################################################

# Check - Provides main check functionality
#
loadplugin Mail::SpamAssassin::Plugin::Check

# HTTPSMismatch - find URI mismatches between href and anchor text
#
loadplugin Mail::SpamAssassin::Plugin::HTTPSMismatch

# URIDetail - test URIs using detailed URI information
#
loadplugin Mail::SpamAssassin::Plugin::URIDetail

# Shortcircuit - stop evaluation early if high-accuracy rules fire
#
# loadplugin Mail::SpamAssassin::Plugin::Shortcircuit

# Plugins which used to be EvalTests.pm
# broken out into separate plugins
loadplugin Mail::SpamAssassin::Plugin::Bayes
loadplugin Mail::SpamAssassin::Plugin::BodyEval
loadplugin Mail::SpamAssassin::Plugin::DNSEval
loadplugin Mail::SpamAssassin::Plugin::HTMLEval
loadplugin Mail::SpamAssassin::Plugin::HeaderEval
loadplugin Mail::SpamAssassin::Plugin::MIMEEval
loadplugin Mail::SpamAssassin::Plugin::RelayEval
loadplugin Mail::SpamAssassin::Plugin::URIEval
loadplugin Mail::SpamAssassin::Plugin::WLBLEval

# VBounce - anti-bounce-message rules, see rules/20_vbounce.cf
#
loadplugin Mail::SpamAssassin::Plugin::VBounce

# Rule2XSBody - speedup by compilation of ruleset to native code
#
# loadplugin Mail::SpamAssassin::Plugin::Rule2XSBody

# ASN - Look up the Autonomous System Number of the connecting IP
# and create a header containing ASN data for bayes tokenization.
# See plugin's POD docs for usage info.
#
# loadplugin Mail::SpamAssassin::Plugin::ASN

# ImageInfo - rules to match metadata of image attachments
#
loadplugin Mail::SpamAssassin::Plugin::ImageInfo


I hope this helps!

Ken
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
I'd suggest running spamassassin directly from the command line with
the -D and --lint options to see if that provides more detail about
what exactly is going wrong. This is going to give you a lot of
output so you'll probably want to run it like:

spamassassin -D --lint 2>&1 | less


On Sun, 10 Feb 2019, Ken Wright wrote:

> I've been trying to set up an email server and I want to use
> Spamassassin to prevent it from becoming Spam Central.  I've installed
> SA and spamass-milter, but when I try to restart it after customizing
> the config files, I get this:
>
> Job for spamassassin.service failed because the control process exited
> with error code.
> See "systemctl status spamassassin.service" and "journalctl -xe" for
> details.
>
> So I checked journalctl and got this:
>
> -- Unit spamassassin.service has begun starting up.
> Feb 08 02:19:31 grace spamd[6289]: logger: removing stderr method
> Feb 08 02:19:32 grace spamd[6314]: Timeout::_run: check: no loaded
> plugin implements 'check_main': cannot scan!
> Feb 08 02:19:32 grace spamd[6314]: Check that the necessary '.pre' files
> are in the config directory.
> Feb 08 02:19:32 grace spamd[6314]: At a minimum, v320.pre loads the
> Check plugin which is required.
> Feb 08 02:19:32 grace spamd[6289]: child process [6314] exited or timed
> out without signaling production of a PID file: exit 255 at
> /usr/sbin/spamd line 3034.
> Feb 08 02:19:32 grace systemd[1]: spamassassin.service: Control process
> exited, code=exited status=255
> Feb 08 02:19:32 grace systemd[1]: spamassassin.service: Failed with
> result 'exit-code'.
> Feb 08 02:19:32 grace systemd[1]: Failed to start Perl-based spam filter
> using text analysis.
> -- Subject: Unit spamassassin.service has failed
>
> At a friend's suggestion I also checked the mail.log and got this:
>
> Feb  8 02:19:25 grace spamd[6144]: logger: removing stderr method
> Feb  8 02:19:26 grace spamd[6172]: Timeout::_run: check: no loaded
> plugin implements 'check_main': cannot scan!
> Feb  8 02:19:26 grace spamd[6172]: Check that the necessary '.pre' files
> are in the config directory.
> Feb  8 02:19:26 grace spamd[6172]: At a minimum, v320.pre loads the
> Check plugin which is required.
> Feb  8 02:19:26 grace spamd[6144]: child process [6172] exited or timed
> out without signaling production of a PID file: exit 255 at
> /usr/sbin/spamd line 3034.
>
> Yes, v320.pre loads the Mail::SpamAssassin::Plugin::Check module, which
> is installed and up to date.  I've just about run out of ideas.  Anyone
> have any?
>
> Sorry this is so long, but I didn't want to omit any pertinent information.
>
> Ken Wright,
> pulling his hair out.
>

--
Public key #7BBC68D9 at | Shane Williams
http://pgp.mit.edu/ | System Admin - UT CompSci
=----------------------------------+-------------------------------
All syllogisms contain three lines | shanew@shanew.net
Therefore this is not a syllogism | www.ischool.utexas.edu/~shanew
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On 2/11/19 7:23 PM, shanew@shanew.net wrote:
> I'd suggest running spamassassin directly from the command line with
> the -D and --lint options to see if that provides more detail about
> what exactly is going wrong.  This is going to give you a lot of
> output so you'll probably want to run it like:
>
> spamassassin -D --lint 2>&1 | less
>
Whew, that's a lot of output!  I didn't see any obvious errors, and it
does say it's loading the Mail::SpamAssassin::Plugin::Check module
(along with several others).  Is there anything in particular I should
be looking for?

Ken,
grateful for all the help so far!
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On 11 Feb 2019, at 20:24, Ken Wright wrote:

> it does say it's loading the Mail::SpamAssassin::Plugin::Check module

This is evidence that one or more of the following is true about spamd:

1. It is using a different SpamAssassin config than you use from the
command line
2. It is using a different perl executable than you use from the command
line (e.g. perlbrew)
3. It is using a different perl library path than you use from the
command line (e.g. local::lib)



--
Bill Cole
bill@scconsult.com or billcole@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Available For Hire: https://linkedin.com/in/billcole
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On 2/11/19 9:33 PM, Bill Cole wrote:
> On 11 Feb 2019, at 20:24, Ken Wright wrote:
>
>> it does say it's loading the Mail::SpamAssassin::Plugin::Check module
>
> This is evidence that one or more of the following is true about spamd:
>
> 1. It is using a different SpamAssassin config than you use from the
> command line
> 2. It is using a different perl executable than you use from the
> command line (e.g. perlbrew)
> 3. It is using a different perl library path than you use from the
> command line (e.g. local::lib)
>
I'm still kind of a n00b, so... how can I tell which?  I have no GUI on
the server, so everything is from the command  line.

Ken
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On 11 Feb 2019, at 21:40, Ken Wright wrote:

> On 2/11/19 9:33 PM, Bill Cole wrote:
>> On 11 Feb 2019, at 20:24, Ken Wright wrote:
>>
>>> it does say it's loading the Mail::SpamAssassin::Plugin::Check
>>> module
>>
>> This is evidence that one or more of the following is true about
>> spamd:
>>
>> 1. It is using a different SpamAssassin config than you use from the
>> command line
>> 2. It is using a different perl executable than you use from the
>> command line (e.g. perlbrew)
>> 3. It is using a different perl library path than you use from the
>> command line (e.g. local::lib)
>>
> I'm still kind of a n00b, so... how can I tell which?  I have no GUI
> on
> the server, so everything is from the command  line.

OK, so you'd probably know if you had installed perlbrew or otherwise
rigged up a way that you could accidentally run different perl
executables from systemd and from the command line. So #2 is *probably*
eliminated. Simplest solid check: look at the first line (starting with
'#!') of the spamassassin script and of spamd (which is also a Perl
script) and confirm that they are identical and DO NOT use /bin/env or
/usr/bin/env to find perl. If they are not identical, then you probably
have issues #1 and #2 together. If they use the env trick, they may be
finding different perl executables.

#1 is only likely if you have installed SpamAssassin in multiple ways,
e.g. from the distribution's package for it and from source or using
CPAN. If you have stuck strictly to using the standard packages for SA
and Perl and the various Perl modules that SA depends on, you would have
a hard time creating this issue without trying very hard. If you have
tried installing SA and/or its dependencies "by hand" or using CPAN
instead of using the prebuilt packages, clean up that mess and reinstall
from packages. A bespoke artisanal installation is inappropriate for
someone who claims to be "kind of a n00b."

#3 is actually not unlikely. I don't know if Ubuntu 18 does it, but I
know that the EL7 family of distributions have instituted local::lib as
a default, which means that an interactive login gets $PERL5LIB set to
look in ~/perl5/ for installed modules. A service started out of
systemd won't have that. If you've somehow managed to install SA under
~/perl5/ then spamd won't find it. You can just run "echo $PERL5LIB" to
see if your login has that set.

One way to debug this would be to add "-D all" to the OPTIONS parameter
in /etc/default/spamassassin and try starting it. This should spew a
lot of debug output into the log, which you can compare to what you got
from running spamassassin from the command line with '-D' to look for
discrepancies in where it is looking for config files and libraries.

--
Bill Cole
bill@scconsult.com or billcole@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Available For Hire: https://linkedin.com/in/billcole
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On 2/11/19 11:42 PM, Bill Cole wrote:
> On 11 Feb 2019, at 21:40, Ken Wright wrote:
>
>> On 2/11/19 9:33 PM, Bill Cole wrote:
>>> On 11 Feb 2019, at 20:24, Ken Wright wrote:
>>>
>>>> it does say it's loading the Mail::SpamAssassin::Plugin::Check module
>>>
>>> This is evidence that one or more of the following is true about spamd:
>>>
>>> 1. It is using a different SpamAssassin config than you use from the
>>> command line
>>> 2. It is using a different perl executable than you use from the
>>> command line (e.g. perlbrew)
>>> 3. It is using a different perl library path than you use from the
>>> command line (e.g. local::lib)
>>>
>> I'm still kind of a n00b, so... how can I tell which?  I have no GUI on
>> the server, so everything is from the command  line.
>
> OK, so you'd probably know if you had installed perlbrew or otherwise
> rigged up a way that you could accidentally run different perl
> executables from  systemd and from the command line. So #2 is
> *probably* eliminated. Simplest solid check: look at the first line
> (starting with '#!') of the spamassassin script and of spamd (which is
> also a Perl script) and confirm that they are identical and DO NOT use
> /bin/env or /usr/bin/env to find perl. If they are not identical, then
> you probably have issues #1 and #2 together.  If they use the env
> trick, they may be finding different perl executables.
I haven't installed perlbrew or anything like that, as far as I know. 
Where would I find the two scripts you mentioned?
> #1 is only likely if you have installed SpamAssassin in multiple ways,
> e.g. from the distribution's package for it and from source or using
> CPAN. If you have stuck strictly to using the standard packages for SA
> and Perl and the various Perl modules that SA depends on, you would
> have a hard time creating this issue without trying very hard. If you
> have tried installing SA and/or its dependencies  "by hand"  or using
> CPAN instead of using the prebuilt packages, clean up that mess and
> reinstall from packages. A bespoke artisanal installation is
> inappropriate for someone who claims to be "kind of a n00b."
I installed SA from the Ubunto repositories only.  I have, however,
installed a few modules (such as Geo::IP) from CPAN, after starting with
the debug flag indicated there were a few uninstalled modules (such as
Geo::IP).  Repeating the debug start showed all those modules installed,
so I don't think that's the issue.
> #3 is actually not unlikely. I don't know if Ubuntu 18 does it, but I
> know that the EL7 family of distributions have instituted local::lib
> as a default, which means that an interactive login gets $PERL5LIB set
> to look in  ~/perl5/ for installed modules. A service started out of
> systemd won't have that. If you've somehow managed to install SA under
> ~/perl5/ then spamd won't find it. You can just run "echo $PERL5LIB"
> to see if your login has that set.
I ran "echo $PERL5LIB" with and without sudo.  In both cases all I got
was a new line.
> One way to debug this would be to add "-D all" to the OPTIONS
> parameter in  /etc/default/spamassassin and try starting it. This
> should spew a lot of debug output into the log, which you can compare
> to what you got from running spamassassin from the command line with
> '-D' to look for discrepancies in where it is looking for config files
> and libraries.

I notice the path shown for SA doesn't include /etc/spamassassin, which
is where all the .pre files are.  Is this it?  Am I just not finding the
necessary .pre files?

Ken
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
Also check that the actual spamassassin config directory is
/etc/spamassassin and that there is a symlink at /etc/mail/spamassassin
-> /etc/spamassassin

If not, create it with ln -s /etc/spamassassin /etc/mail/spamassassin


On 2019/02/12 08:14, Ken Wright wrote:
> On 2/11/19 11:42 PM, Bill Cole wrote:
>> On 11 Feb 2019, at 21:40, Ken Wright wrote:
>>
>>> On 2/11/19 9:33 PM, Bill Cole wrote:
>>>> On 11 Feb 2019, at 20:24, Ken Wright wrote:
>>>>
>>>>> it does say it's loading the Mail::SpamAssassin::Plugin::Check module
>>>> This is evidence that one or more of the following is true about spamd:
>>>>
>>>> 1. It is using a different SpamAssassin config than you use from the
>>>> command line
>>>> 2. It is using a different perl executable than you use from the
>>>> command line (e.g. perlbrew)
>>>> 3. It is using a different perl library path than you use from the
>>>> command line (e.g. local::lib)
>>>>
>>> I'm still kind of a n00b, so... how can I tell which?  I have no GUI on
>>> the server, so everything is from the command  line.
>> OK, so you'd probably know if you had installed perlbrew or otherwise
>> rigged up a way that you could accidentally run different perl
>> executables from  systemd and from the command line. So #2 is
>> *probably* eliminated. Simplest solid check: look at the first line
>> (starting with '#!') of the spamassassin script and of spamd (which is
>> also a Perl script) and confirm that they are identical and DO NOT use
>> /bin/env or /usr/bin/env to find perl. If they are not identical, then
>> you probably have issues #1 and #2 together.  If they use the env
>> trick, they may be finding different perl executables.
> I haven't installed perlbrew or anything like that, as far as I know.
> Where would I find the two scripts you mentioned?
>> #1 is only likely if you have installed SpamAssassin in multiple ways,
>> e.g. from the distribution's package for it and from source or using
>> CPAN. If you have stuck strictly to using the standard packages for SA
>> and Perl and the various Perl modules that SA depends on, you would
>> have a hard time creating this issue without trying very hard. If you
>> have tried installing SA and/or its dependencies  "by hand"  or using
>> CPAN instead of using the prebuilt packages, clean up that mess and
>> reinstall from packages. A bespoke artisanal installation is
>> inappropriate for someone who claims to be "kind of a n00b."
> I installed SA from the Ubunto repositories only.  I have, however,
> installed a few modules (such as Geo::IP) from CPAN, after starting with
> the debug flag indicated there were a few uninstalled modules (such as
> Geo::IP).  Repeating the debug start showed all those modules installed,
> so I don't think that's the issue.
>> #3 is actually not unlikely. I don't know if Ubuntu 18 does it, but I
>> know that the EL7 family of distributions have instituted local::lib
>> as a default, which means that an interactive login gets $PERL5LIB set
>> to look in  ~/perl5/ for installed modules. A service started out of
>> systemd won't have that. If you've somehow managed to install SA under
>> ~/perl5/ then spamd won't find it. You can just run "echo $PERL5LIB"
>> to see if your login has that set.
> I ran "echo $PERL5LIB" with and without sudo.  In both cases all I got
> was a new line.
>> One way to debug this would be to add "-D all" to the OPTIONS
>> parameter in  /etc/default/spamassassin and try starting it. This
>> should spew a lot of debug output into the log, which you can compare
>> to what you got from running spamassassin from the command line with
>> '-D' to look for discrepancies in where it is looking for config files
>> and libraries.
> I notice the path shown for SA doesn't include /etc/spamassassin, which
> is where all the .pre files are.  Is this it?  Am I just not finding the
> necessary .pre files?
>
> Ken
>
--
Kind Regards,

Evan Booyens
Linux Systems Engineer
Hetzner (Pty) Ltd

SA Contact Centre: 0861 0861 08
International: +27 21 970 2000



Website: hetzner.co.za <http://www.hetzner.co.za>
Disclaimer: hetzner.co.za/email-disclaimer
<http://www.hetzner.co.za/email-disclaimer>
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On 2/12/19 1:33 AM, Evan Booyens wrote:
>
> Also check that the actual spamassassin config directory is
> /etc/spamassassin and that there is a symlink at
> /etc/mail/spamassassin -> /etc/spamassassin
>
> If not, create it with ln -s /etc/spamassassin /etc/mail/spamassassin
>
Just checked.  The symlink is there.  Would that it had been that easy!

Ken
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
Hi Ken

My only other fix would be to specify the config path in
/etc/default/spamassassin at the OPTIONS="" section - add in
"--configpath=/etc/spamassassin " at the start of the configs.

Hope it helps.

On 2019/02/12 08:38, Ken Wright wrote:
> On 2/12/19 1:33 AM, Evan Booyens wrote:
>> Also check that the actual spamassassin config directory is
>> /etc/spamassassin and that there is a symlink at
>> /etc/mail/spamassassin -> /etc/spamassassin
>>
>> If not, create it with ln -s /etc/spamassassin /etc/mail/spamassassin
>>
> Just checked.  The symlink is there.  Would that it had been that easy!
>
> Ken
>
--
Kind Regards,

Evan Booyens
Linux Systems Engineer
Hetzner (Pty) Ltd

SA Contact Centre: 0861 0861 08
International: +27 21 970 2000



Website: hetzner.co.za <http://www.hetzner.co.za>
Disclaimer: hetzner.co.za/email-disclaimer
<http://www.hetzner.co.za/email-disclaimer>
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On 2/12/19 1:56 AM, Evan Booyens wrote:
>
> Hi Ken
>
> My only other fix would be to specify the config path in
> /etc/default/spamassassin at the OPTIONS="" section - add in
> "--configpath=/etc/spamassassin " at the start of the configs.
>
> Hope it helps.
>
I checked, and it's already there.  Thanks for trying!

Ken
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On Tue, 12 Feb 2019 08:33:09 +0200
Evan Booyens wrote:

> Also check that the actual spamassassin config directory is
> /etc/spamassassin and that there is a symlink
> at /etc/mail/spamassassin -> /etc/spamassassin
>
> If not, create it with ln -s /etc/spamassassin /etc/mail/spamassassin

What's the point of that? SpamAssassin itself only needs one of them.
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
It seems to be a legacy setting in Ubuntu for backwards compatibility...

On 2019/02/12 15:45, RW wrote:
> On Tue, 12 Feb 2019 08:33:09 +0200
> Evan Booyens wrote:
>
>> Also check that the actual spamassassin config directory is
>> /etc/spamassassin and that there is a symlink
>> at /etc/mail/spamassassin -> /etc/spamassassin
>>
>> If not, create it with ln -s /etc/spamassassin /etc/mail/spamassassin
> What's the point of that? SpamAssassin itself only needs one of them.
--
Kind Regards,

Evan Booyens
Linux Systems Engineer
Hetzner (Pty) Ltd

SA Contact Centre: 0861 0861 08
International: +27 21 970 2000



Website: hetzner.co.za <http://www.hetzner.co.za>
Disclaimer: hetzner.co.za/email-disclaimer
<http://www.hetzner.co.za/email-disclaimer>
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On 12 Feb 2019, at 1:14, Ken Wright wrote:

> On 2/11/19 11:42 PM, Bill Cole wrote:
>> On 11 Feb 2019, at 21:40, Ken Wright wrote:
>>
>>> On 2/11/19 9:33 PM, Bill Cole wrote:
>>>> On 11 Feb 2019, at 20:24, Ken Wright wrote:
>>>>
>>>>> it does say it's loading the Mail::SpamAssassin::Plugin::Check
>>>>> module
>>>>
>>>> This is evidence that one or more of the following is true about
>>>> spamd:
>>>>
>>>> 1. It is using a different SpamAssassin config than you use from
>>>> the
>>>> command line
>>>> 2. It is using a different perl executable than you use from the
>>>> command line (e.g. perlbrew)
>>>> 3. It is using a different perl library path than you use from the
>>>> command line (e.g. local::lib)
>>>>
>>> I'm still kind of a n00b, so... how can I tell which?  I have no
>>> GUI on
>>> the server, so everything is from the command  line.
>>
>> OK, so you'd probably know if you had installed perlbrew or otherwise
>> rigged up a way that you could accidentally run different perl
>> executables from  systemd and from the command line. So #2 is
>> *probably* eliminated. Simplest solid check: look at the first line
>> (starting with '#!') of the spamassassin script and of spamd (which
>> is
>> also a Perl script) and confirm that they are identical and DO NOT
>> use
>> /bin/env or /usr/bin/env to find perl. If they are not identical,
>> then
>> you probably have issues #1 and #2 together.  If they use the env
>> trick, they may be finding different perl executables.
> I haven't installed perlbrew or anything like that, as far as I
> know. 
> Where would I find the two scripts you mentioned?

Running 'which spamassassin' will give you the full path to the
spamassassin script that you are running. The full path to the spamd
being run by systemd should be /usr/sbin/spamd if the Debian package
hasn't been mangled, and you can see for sure in the "ExecStart " line
in the unit file for SpamAssassin:
/etc/systemd/system/spamassassin.service (if that exists) or
/lib/systemd/systemd/spamassassin.service


>> #1 is only likely if you have installed SpamAssassin in multiple
>> ways,
>> e.g. from the distribution's package for it and from source or using
>> CPAN. If you have stuck strictly to using the standard packages for
>> SA
>> and Perl and the various Perl modules that SA depends on, you would
>> have a hard time creating this issue without trying very hard. If you
>> have tried installing SA and/or its dependencies  "by hand"  or
>> using
>> CPAN instead of using the prebuilt packages, clean up that mess and
>> reinstall from packages. A bespoke artisanal installation is
>> inappropriate for someone who claims to be "kind of a n00b."
> I installed SA from the Ubunto repositories only.  I have, however,
> installed a few modules (such as Geo::IP) from CPAN, after starting
> with
> the debug flag indicated there were a few uninstalled modules (such as
> Geo::IP).  Repeating the debug start showed all those modules
> installed,
> so I don't think that's the issue.

Maybe we need to see the whole output from a debug start attempt and
from a command-line interactive 'spamassassin --lint -D' run.

[...]
>> One way to debug this would be to add "-D all" to the OPTIONS
>> parameter in  /etc/default/spamassassin and try starting it. This
>> should spew a lot of debug output into the log, which you can compare
>> to what you got from running spamassassin from the command line with
>> '-D' to look for discrepancies in where it is looking for config
>> files
>> and libraries.
>
> I notice the path shown for SA doesn't include /etc/spamassassin,
> which
> is where all the .pre files are.  Is this it?  Am I just not finding
> the
> necessary .pre files?

Possible, but unlikely since running the spamassassin script doesn't
have the same problem. There are multiple directory paths that SA uses
for .cf and .pre files but as long as you don't have a single
self-consistent installation, you should be seeing the same files in all
SA tools.

I have thought of 2 more possible issues that could cause this without
mangled/diverse installations of Perl and/or SA:

4. Restrictive permissions on the directory where the system-wide local
config files reside (/etc/spamassassin) or on the files inside it which
prevent the user running spamd from reading the files.

5. Spurious config files in the per-user config directory
(~/.spamassassin) for the user running spamd.

Off the top of my head, I do not recall what user is used in the
Debian/Ubuntu package to run spamd.


--
Bill Cole
bill@scconsult.com or billcole@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Available For Hire: https://linkedin.com/in/billcole
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
On 2/12/19 9:53 AM, Bill Cole wrote:
> On 12 Feb 2019, at 1:14, Ken Wright wrote:
>
>> On 2/11/19 11:42 PM, Bill Cole wrote:
>>> On 11 Feb 2019, at 21:40, Ken Wright wrote:
>>>
>>>> On 2/11/19 9:33 PM, Bill Cole wrote:
>>>>> On 11 Feb 2019, at 20:24, Ken Wright wrote:
>>>>>
>>>>>> it does say it's loading the Mail::SpamAssassin::Plugin::Check
>>>>>> module
>>>>>
>>>>> This is evidence that one or more of the following is true about
>>>>> spamd:
>>>>>
>>>>> 1. It is using a different SpamAssassin config than you use from the
>>>>> command line
>>>>> 2. It is using a different perl executable than you use from the
>>>>> command line (e.g. perlbrew)
>>>>> 3. It is using a different perl library path than you use from the
>>>>> command line (e.g. local::lib)
>>>>>
>>>> I'm still kind of a n00b, so... how can I tell which?  I have no
>>>> GUI on
>>>> the server, so everything is from the command  line.
>>>
>>> OK, so you'd probably know if you had installed perlbrew or otherwise
>>> rigged up a way that you could accidentally run different perl
>>> executables from  systemd and from the command line. So #2 is
>>> *probably* eliminated. Simplest solid check: look at the first line
>>> (starting with '#!') of the spamassassin script and of spamd (which is
>>> also a Perl script) and confirm that they are identical and DO NOT use
>>> /bin/env or /usr/bin/env to find perl. If they are not identical, then
>>> you probably have issues #1 and #2 together.  If they use the env
>>> trick, they may be finding different perl executables.
>> I haven't installed perlbrew or anything like that, as far as I know. 
>> Where would I find the two scripts you mentioned?
>
> Running 'which spamassassin' will give you the full path to the
> spamassassin script that you are running. The full path to the spamd
> being run by systemd should be /usr/sbin/spamd if the Debian package
> hasn't been mangled, and you can see for sure in the "ExecStart " line
> in the unit file for SpamAssassin: 
> /etc/systemd/system/spamassassin.service (if that exists) or
> /lib/systemd/systemd/spamassassin.service
>
Okay, I checked.  Both Spamassassin and spamd start with #!/usr/bin/perl
-T -w.  No env variables.
>
>>> #1 is only likely if you have installed SpamAssassin in multiple ways,
>>> e.g. from the distribution's package for it and from source or using
>>> CPAN. If you have stuck strictly to using the standard packages for SA
>>> and Perl and the various Perl modules that SA depends on, you would
>>> have a hard time creating this issue without trying very hard. If you
>>> have tried installing SA and/or its dependencies  "by hand"  or using
>>> CPAN instead of using the prebuilt packages, clean up that mess and
>>> reinstall from packages. A bespoke artisanal installation is
>>> inappropriate for someone who claims to be "kind of a n00b."
>> I installed SA from the Ubunto repositories only.  I have, however,
>> installed a few modules (such as Geo::IP) from CPAN, after starting with
>> the debug flag indicated there were a few uninstalled modules (such as
>> Geo::IP).  Repeating the debug start showed all those modules installed,
>> so I don't think that's the issue.
>
> Maybe we need to see the whole output from a debug start attempt and
> from a command-line interactive 'spamassassin --lint -D' run.
>
> [...]
>>> One way to debug this would be to add "-D all" to the OPTIONS
>>> parameter in  /etc/default/spamassassin and try starting it. This
>>> should spew a lot of debug output into the log, which you can compare
>>> to what you got from running spamassassin from the command line with
>>> '-D' to look for discrepancies in where it is looking for config files
>>> and libraries.
>>
>> I notice the path shown for SA doesn't include /etc/spamassassin, which
>> is where all the .pre files are.  Is this it?  Am I just not finding the
>> necessary .pre files?
>
> Possible, but unlikely since running the spamassassin script doesn't
> have the same problem. There are multiple directory paths that SA uses
> for .cf and .pre files but as long as you don't have a single
> self-consistent installation, you should be seeing the same files in
> all SA tools.
>
> I have thought of 2 more possible issues that could cause this without
> mangled/diverse installations of Perl and/or SA:
>
> 4. Restrictive permissions on the directory where the system-wide
> local config files reside (/etc/spamassassin) or on the files inside
> it which prevent the user running spamd from reading the files.
>
No, everybody has "read" permission.
> 5. Spurious config files in the per-user config directory
> (~/.spamassassin) for the user running spamd.
>
> Off the top of my head, I do not recall what user is used in the
> Debian/Ubuntu package to run spamd.
>
The user is spamd, and there are no per-user rules there.

Ken
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
Success!

I got so frustrated I reformatted the hard drive and started over.  This
time, after installing SA and before any tweaking, I tried to start it,
and it worked.  So I started checking after every tweak, so I could find
where the problem lay.  Turns out the Options line in /etc/spamassassin
had a glitch, so I tweaked it a bit and tried again.  Joy!

My sincere thanks to everyone who tried to help.  I'm sure this won't be
the last time I need advice!

Ken
Re: Having trouble getting Spamassassin to work on Ubuntu Server 18.10 [ In reply to ]
Glad you found the issue.

Your trouble shooting approach was spot on with the step by step
tweaking and checks.

Thanks for keeping us updated :)

Evan

On 2019/02/13 02:00, Ken Wright wrote:
> Success!
>
> I got so frustrated I reformatted the hard drive and started over.  This
> time, after installing SA and before any tweaking, I tried to start it,
> and it worked.  So I started checking after every tweak, so I could find
> where the problem lay.  Turns out the Options line in /etc/spamassassin
> had a glitch, so I tweaked it a bit and tried again.  Joy!
>
> My sincere thanks to everyone who tried to help.  I'm sure this won't be
> the last time I need advice!
>
> Ken
>
--
Kind Regards,

Evan Booyens
Linux Systems Engineer
Hetzner (Pty) Ltd

SA Contact Centre: 0861 0861 08
International: +27 21 970 2000



Website: hetzner.co.za <http://www.hetzner.co.za>
Disclaimer: hetzner.co.za/email-disclaimer
<http://www.hetzner.co.za/email-disclaimer>