
I just had to solve one of those problems where no amount of internet searches found someone with the exact same problem as me, who had solved it.
Having finally got there, I thought I'd write it up. I'll find it again in the future. But it may just be that there are others with a similar enough problem that this helps.
My situation
I run a web server that also handles inbound email. It runs Almalinux 9, and has Postfix as it's MTA. I use spamassassin for spam filtering.
I wanted to take advantage of some crowd tools to improve how spamassassin works.
I had installed pyzor and had been running it without any problems.
But I wanted to install two further hashed lookup tools, that complement rather than replace pyzor: dcc and razor.
I installed both before I found the problem, but I think it was razor that caused the problem.
To install razor, you have to first install the razor-agents-sdk, and then the razor-agents. I'm pretty sure the first email in my logs that triggered the problem I'm about to describe happened after I installed razor-agents-sdk, but before I installed or configured razor-agents. Both those tools are installed with a perl makefile, so they are installing perl libraries and routines.
The Problem
After installing dcc and razor, spamassassin --lint
(the command you run to check that spamassassin is configured without any problems) returned an error
Subroutine File::Spec::Unix::canonpath redefined at /usr/share/perl5/XSLoader.pm line 111.
Subroutine File::Spec::Unix::catdir redefined at /usr/share/perl5/XSLoader.pm line 111.
Subroutine File::Spec::Unix::catfile redefined at /usr/share/perl5/XSLoader.pm line 111.
That same error was appearing in /var/log/procmail.log
every time an incoming email was being processed.
It was only a warning, but was clogging up log files so I wanted to fix it.
The Solution
Here's how I solved it (not just what I finally did). If your problem is similar, but not exactly the same, maybe these debugging steps will help you find what you need to do.
I kind of worked out that the File::Spec library was installed twice, and so was occuring twice in the perl path, and set out trying to see if that was indeed the case.
- Find the perl path where perl will look for modules:
perl -e "print qq(@INC)"
- The result was
/usr/local/lib64/perl5/5.32 /usr/local/share/perl5/5.32 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5
- I then looked through each of those directories in turn. A number had a
File
directory (namespace). - 2 of them had a file in that
File
folder namedSpec.pm
, with a subfolder namedSpec
. - So, routines like
File::Spec::Unix::canonpath
were being defined twice.- The timestamp on
Spec.pm
in/usr/local/lib64/perl5/5.32/File/
was Sep 1 2004. It had version ($VERSION = '0.90';
). - The timestamp in
/usr/lib64/perl5/vendor_perl/File
was Feb 11 2022 and had version 3.78 (our $VERSION = '3.78';
).
- The timestamp on
- So I moved the older one out of the perl path.
spamassassin --lint
was now fine.
Why the installer for razor (presumably) had installed a second copy of that library, I've no idea, and I don't frankly need to find out. The razor agent has not had a commit for a very long time, so it's not actively maintained, and there will be environment changes that the author couldn't have foreseen.
The important thing for my purposes was that I'd found the duplicate declaration, and removed one of them. No more messages in the logs.
Thanks
Thanks, reading this gave me enough info to fix my system.
I suspect also a razor install lib issue, although mine was in /usr/local/lib/x86_64-linux-gnu/perl
Fixed the issue though :)
Subroutine File::Spec::Unix::canonpath redefined at /usr/lib/x86_64-linux-gnu/perl-base/XSLoader.pm line 112
Thanks!
For newbies (like me), look here for the used commands
In your CLI:
"find -wholename *File/Spec.pm"
-> gives you the locations of the files and folders.
-> Go into each folder and get their date with:
"ls --full-time Spec.pm"
-> Compare the dates. one should be from 2004 like mentioned above.
-> When you have found the old one, renaming them with "mv" has been sufficient in my case to fix the error:
"mv Spec.pm OLD_Spec.pm"
"mv Spec OLD_Spec"
-> now check spamassassin again
"sa-update" or "spamassassin --lint"
Thanks for the actual bash commands
I'm sure that will help people less familiar with the command line.
Ubuntu 24.04 LTS
With Pyzor/Razor installed in Ubuntu 24.04.2 i renamed a file and a folder in /usr/local/lib/x86_64-linux-gnu/perl/5.38.2/File:
Sep 1 2004 OLD_Spec.pm
OLD_Spec/ <-- this one also containing old 2004 files
In my case this output also polluted the result of nagios commands like /usr/local/nagios/libexec/check_smart -d /dev/sda -i ata
Had the same issue on Fedora 41. thanks!