Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SpamAssassin sa-learn errors

Discussion in 'E-mail Discussions' started by jdcopelin, Jan 11, 2017.

Tags:
  1. jdcopelin

    jdcopelin Member

    Joined:
    Mar 14, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    151
    Hi All,
    Sorry if this is posted in the wrong section or has already been covered, I could not find a similar problem when I did a search.

    The problem I am having is when I run sa-learn either directly from the command line or as a cron job I get an error relating to " /usr/local/cpanel/Cpanel/Mail/SpamAssassin/Plugin/P0f.pm: syntax error at /usr/local/cpanel/Cpanel/JS/Variations.pm line 20". I tried looking up this error on the SpamAssassin pages directly and found nothing, but as the path relates to cPanel thought it might be something cPanel has added and not a part of SpamAssassin as such and hence my posting here today.

    As far as I can tell, the error first started appearing in the cron output on the 15 December. I don't know if that date is significant but it's strange that the timestamp of /usr/local/cpanel/Cpanel/JS/Variations.pm is about 15 minutes before the first cron job that showed this error which could point to a bug in that file (updated during a cPanel update)? My server is running WHM 60.0 (build 28).

    Any help getting this fixed would be appreciated, I have root access to the server if required.

    The full output is as follows:

    Code:
    [EMAIL]xyz@domain.co.uk[/EMAIL] [~/mail/domain.co.uk/abc/.spam/cur]# sa-learn --spam ./123.456.server.example.com\,S\=3542\,W\=3615\:2\,Sc
    Bareword found where operator expected at /usr/local/cpanel/Cpanel/JS/Variations.pm line 20, near "$filename =~ s{/js2"
      (Might be a runaway multi-line // string starting on line 19)
            (Missing operator before js2?)
    plugin: failed to parse plugin /usr/local/cpanel/Cpanel/Mail/SpamAssassin/Plugin/P0f.pm: syntax error at /usr/local/cpanel/Cpanel/JS/Variations.pm line 20, near "$filename =~ s{/js2"
    Global symbol "$filename" requires explicit package name at /usr/local/cpanel/Cpanel/JS/Variations.pm line 21.
    Global symbol "$replace_extension" requires explicit package name at /usr/local/cpanel/Cpanel/JS/Variations.pm line 21.
    Global symbol "$filename" requires explicit package name at /usr/local/cpanel/Cpanel/JS/Variations.pm line 22.
    Unmatched right curly bracket at /usr/local/cpanel/Cpanel/JS/Variations.pm line 23, at end of line
    syntax error at /usr/local/cpanel/Cpanel/JS/Variations.pm line 23, near "}"
    Compilation failed in require at /usr/local/cpanel/Cpanel/Locale.pm line 19.
    BEGIN failed--compilation aborted at /usr/local/cpanel/Cpanel/Locale.pm line 19.
    Compilation failed in require at /usr/local/cpanel/Cpanel/Net/P0f.pm line 14.
    BEGIN failed--compilation aborted at /usr/local/cpanel/Cpanel/Net/P0f.pm line 14.
    Compilation failed in require at /usr/local/cpanel/Cpanel/Mail/SpamAssassin/Plugin/P0f.pm line 52.
    BEGIN failed--compilation aborted at /usr/local/cpanel/Cpanel/Mail/SpamAssassin/Plugin/P0f.pm line 53.
    Compilation failed in require at /usr/local/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin/PluginHandler.pm line 108.
    
    Learned tokens from 0 message(s) (1 message(s) examined)
    Many thanks in advance,
    Jonathan
     
    #1 jdcopelin, Jan 11, 2017
    Last edited by a moderator: Jan 11, 2017
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,424
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello Jonathan,

    Could you verify if the issue persists when using the full path to the sa-learn binary offered with cPanel? For example, you'd replace "sa-learn" with:

    Code:
    /usr/local/cpanel/3rdparty/bin/sa-learn
    Thank you.
     
  3. jdcopelin

    jdcopelin Member

    Joined:
    Mar 14, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    151
    Hello,

    If I use the path:
    Code:
    /usr/local/cpanel/3rdparty/bin/sa-learn
    there are no errors.

    However, if I use:
    Code:
    /usr/local/bin/sa-learn
    or
    /usr/bin/sa-learn
    
    I get the same errors as just calling sa-learn with no path.

    Not sure if this is any help:
    Code:
    ll /usr/local/cpanel/3rdparty/bin/sa-learn
    lrwxrwxrwx 1 root root 48 Jun  6  2016 /usr/local/cpanel/3rdparty/bin/sa-learn -> /usr/local/cpanel/3rdparty/perl/522/bin/sa-learn*
    
    ll /usr/local/bin/sa-learn
    -r-xr-xr-x 1 root root 45284 Jan 29  2012 /usr/local/bin/sa-learn*
    
    ll /usr/bin/sa-learn
    lrwxrwxrwx 1 root root 21 Jun 20  2015 /usr/bin/sa-learn -> ../local/bin/sa-learn*
    
    ll /usr/local/cpanel/3rdparty/perl/522/bin/sa-learn
    -rwxr-xr-x 1 root root 45714 Aug 17 19:23 /usr/local/cpanel/3rdparty/perl/522/bin/sa-learn*
    
    I am not an expert on Linux file linking but it seemed to me that there were two sa-learn "executables" so I did this to confirm:
    Code:
    # /usr/bin/sa-learn -V
    SpamAssassin version 3.3.1
    # /usr/local/cpanel/3rdparty/perl/522/bin/sa-learn -V
    SpamAssassin version 3.4.1
    
    This server just has cPanel (on CentOS 6) and I don't do any manual installs/updates so should the existence of the dual-versions happen?
    Can I safely link the /usr/bin version to the cpanel/3rdparty one? Sorry I don't have root access to another server to compare it to.

    Thanks in advance for your assistance,
    Jonathan
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,424
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You should uninstall the system's SpamAssassin package and use the one provided with cPanel instead. The following command should list the existing SpamAssassin RPMs installed on the system:

    Code:
    rpm -qa|grep -i spam
    Could you let us know the output from this command?

    Thank you.
     
  5. :-)

    :-) Registered

    Joined:
    Oct 23, 2015
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Minneapolis MN
    cPanel Access Level:
    Root Administrator
    I am also experiencing this issue. And have the duplicate installs on my cpanel server.

    Running that command on my server yields:

    # rpm -qa|grep -i spam
    cpanel-perl-522-Mail-SpamAssassin-3.004001-13.cp1156.x86_64
    #

    If there is only supposed to be one installed version, what is the best way to get rid of the incorrect one?
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,424
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    The output suggests a manually compiled version of SpamAssassin on the system. You'd need to browse to the directory where you manually compiled SpamAssassin and use the "make uninstall" command to remove it. Once you do that, you may also want to run the following command to make sure the version installed with cPanel is properly installed:

    Code:
    /scripts/check_cpanel_rpms
    Thank you.
     
  7. :-)

    :-) Registered

    Joined:
    Oct 23, 2015
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Minneapolis MN
    cPanel Access Level:
    Root Administrator
    All well and good, except I have not manually installed SpamAssassin on this system. And other than the staff at the hosting center, I am the only person here who has the access and ability to install packages on the server since it initially went online. The staff at the hosting center claimed, when asked about this dual install long ago, that all of their cpanel servers have the dual installation of SpamAssassin - that it comes that way with the initial cpanel installation, and that it is not safe to remove the extra install. The dual install goes back years (2012?), but only became overly problematic with a recent cpanel automatic upgrade.

    I searched the server but found no evidence of any manual SpamAssassin compilation directory. And thus no place where one could do the "make uninstall" that you recommend.

    Further suggestions welcome and appreciated.
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,424
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you open a support ticket using the link in my signature so we can take a closer look at the system? You can post the ticket number here so we can update this thread with the outcome.

    Thank you.
     
  9. jdcopelin

    jdcopelin Member

    Joined:
    Mar 14, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    151
    Hello,
    Sorry for the late reply I get the same output as the other user posted:

    Code:
    root@lion [~]# rpm -qa|grep -i spam
    cpanel-perl-522-Mail-SpamAssassin-3.004001-13.cp1156.x86_64
    I do not install any software on this server nor compile anything.
    Thanks for your continued assistance.
    Regards,
    Jonathan
     
  10. :-)

    :-) Registered

    Joined:
    Oct 23, 2015
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Minneapolis MN
    cPanel Access Level:
    Root Administrator
    Support ticket 8181337 opened.
     
  11. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,424
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    To update, it was determined the additional SpamAssassin installation came from the custom image used during the cPanel installation process. Removing or disabling those third-party binaries and then using the following path addresses the issue:

    Code:
    /usr/local/cpanel/3rdparty/bin/sa-learn
    Thank you.
     
Loading...

Share This Page