• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Spamassassin's sa-compile and Mail::SpamAssassin::CompiledRegexp missing

tkalfaoglu

Silver Pleskian
Hi.. My new server's obsidian on Centos 8 came without the sa-compile binary.

Well, I copied it from the old server and compiled the spamassassin headers.
However, upon starting spamd complains of:

Can't locate Mail/SpamAssassin/CompiledRegexps/body_0.pm in @INC (you may need to install the Mail::SpamAssassin::CompiledRegexps:
:body_0 module) (@INC contains: /var/lib/spamassassin/compiled/5.026/3.004004 /var/lib/spamassassin/compiled/5.026/3.004004/auto lib /usr/share/perl5/vendor_perl /usr
/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at (eval 1948) line 1.


I tried a few CPAN commands, like install Mail::SpamAssassin::CompiledRegexps , but they all failed. Is there a correct way to enable compiled rules?

Many thanks, -turgut
 
SOLVED -- I simply wrote a two-liner...

Code:
PERL_MM_OPT='' sa-compile -D
cp -R /root/perl5/var/spamassassin/compiled/* /var/lib/spamassassin/compiled/

PS: Make sure to enable
Code:
loadplugin Mail::SpamAssassin::Plugin::Rule2XSBody

in the /etc/mail/spamassassin/local.cf
 
Don't copy the binary across servers. Just install the proper package. I'm guessing that you are on Debian or Ubuntu as it has its own package:

Code:
apt-get install sa-compile
 
Sorry I understand. I guess Redhat decided to remove it from the default spamassassin package that comes with the OS.
 
Had the same error on my...
OS: Ubuntu 20.04.5 LTS | Product: Plesk Obsidian 18.0.49

This is how the error looks like in the logfile (/var/log/mail.err):

Bash:
Feb 16 08:34:26 hosting spamc[98110]: connect to spamd on ::1 failed, retrying (#1 of 3): Connection refused
Feb 16 09:10:15 hosting spamd[116009]: Can't locate Mail/SpamAssassin/CompiledRegexps/body_neg2000.pm in @INC
 (you may need to install the Mail::SpamAssassin::CompiledRegexps::body_neg2000 module) (@INC contains:
 /var/lib/spamassassin/compiled/5.030/3.004004 /var/lib/spamassassin/compiled/5.030/3.004004/auto
 /usr/share/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 
/usr/lib/x86_64-linux-gnu/perl5/5.30 
/usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl 
/usr/lib/x86_64-linux-gnu/perl-base) at (eval 1969) line 1.


Seams the service is running and working..
Bash:
systemctl status spamassassin.service
● spamassassin.service - Perl-based spam filter using text analysis
     Loaded: loaded (/lib/systemd/system/spamassassin.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2023-02-16 09:10:16 CET; 2s ago
    Process: 116005 ExecStart=/usr/sbin/spamd -d --pidfile=/run/spamd.pid $OPTIONS (code=exited, status=0/SUCCESS)
   Main PID: 116009 (spamd)
      Tasks: 3 (limit: 154344)
     Memory: 113.5M

The mentioned package is already installed:
Bash:
apt-get install sa-compile
Reading package lists... Done
Building dependency tree
Reading state information... Done
sa-compile is already the newest version (3.4.4-1ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Also tried to enter the following in /etc/mail/spamassassin/local.cf without success.

Bash:
loadplugin Mail::SpamAssassin::Plugin::Rule2XSBody

Found this Post on a German speaking Website Linux: SpamAssassin Can't locate CompiledRegexps - Maffert.net and was able to fix the Problem!

This is what I did:
Bash:
# Checking if the packages are installed
sudo apt install re2c sa-compile

# Update and compile the SpamAssassin Rules
sa-update
sa-compile

# Restart SpamAssassin service
systemctl restart spamassassin.service

# Check if the error is still present
tail -f /var/log/maillog
tail -f /var/log/mail.err

Actually I also remove
Code:
loadplugin Mail::SpamAssassin::Plugin::Rule2XSBody
from /etc/mail/spamassassin/local.cf - seams this is not needed in any case.


It is what I see (in /var/log/maillog) now when the spamassissin.service is restarted:
Bash:
Feb 16 09:38:58 hosting spamd[130025]: spamd: server killed by SIGTERM, shutting down
Feb 16 09:38:58 hosting spamd[130370]: logger: removing stderr method
Feb 16 09:38:59 hosting spamd[130374]: zoom: able to use 405/405 'body_0' compiled rules (100%)
Feb 16 09:39:00 hosting spamd[130374]: spamd: server started on IO::Socket::IP [127.0.0.1]:783 (running version 3.4.4)
Feb 16 09:39:00 hosting spamd[130374]: spamd: server pid: 130374
Feb 16 09:39:00 hosting spamd[130374]: spamd: server successfully spawned child process, pid 130378
Feb 16 09:39:00 hosting spamd[130374]: spamd: server successfully spawned child process, pid 130379
Feb 16 09:39:00 hosting spamd[130374]: prefork: child states: IS
Feb 16 09:39:00 hosting spamd[130374]: prefork: child states: II



...looks good to me.
 
This is what I did:
Bash:
# Checking if the packages are installed
sudo apt install re2c sa-compile

# Update and compile the SpamAssassin Rules
sa-update
sa-compile

# Restart SpamAssassin service
systemctl restart spamassassin.service
Thanks!
this fixed it for me too on Ubuntu 20.04, Plesk 18.0.50 Update #2
 
Back
Top