reinstall spamassassin (broken perl)

spamassassin was broken on my Ubuntu 20.10 and I can't reinstall it.

I have done

dpkg --purge spamassassin sa-compile spamc
deluser --remove-all-files debian-spamd
apt update
apt upgrade
apt install spamassassin

and I get errors:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  sa-compile spamc
Suggested packages:
  razor libdbi-perl pyzor libencode-detect-perl libgeoip2-perl libnet-patricia-perl
  libbsd-resource-perl
The following NEW packages will be installed
  sa-compile spamassassin spamc
0 to upgrade, 3 to newly install, 0 to remove and 0 not to upgrade.
Need to get 0 B/1,235 kB of archives.
After this operation, 4,902 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Selecting previously unselected package spamassassin.
(Reading database ... 271754 files and directories currently installed.)
Preparing to unpack .../spamassassin_3.4.5~pre1-3_all.deb ...
Unpacking spamassassin (3.4.5~pre1-3) ...
Selecting previously unselected package sa-compile.
Preparing to unpack .../sa-compile_3.4.5~pre1-3_all.deb ...
Unpacking sa-compile (3.4.5~pre1-3) ...
Selecting previously unselected package spamc.
Preparing to unpack .../spamc_3.4.5~pre1-3_amd64.deb ...
Unpacking spamc (3.4.5~pre1-3) ...
Setting up spamc (3.4.5~pre1-3) ...
Setting up spamassassin (3.4.5~pre1-3) ...
Adding system user `debian-spamd' (UID 131) ...
Adding new group `debian-spamd' (GID 136) ...
Adding new user `debian-spamd' (UID 131) with group `debian-spamd' ...
Not creating home directory `/var/lib/spamassassin'.
Insecure dependency in sprintf while running with -T switch at /usr/lib/x86_64-linux-gnu/perl/5.30/Con
fig.pm line 62.
Compilation failed in require at /usr/lib/x86_64-linux-gnu/perl/5.30/lib.pm line 6.
BEGIN failed--compilation aborted at /usr/lib/x86_64-linux-gnu/perl/5.30/lib.pm line 6.
Compilation failed in require at /usr/bin/sa-update line 36.
BEGIN failed--compilation aborted at /usr/bin/sa-update line 36.
dpkg: error processing package spamassassin (--configure):
 installed spamassassin package post-installation script subprocess returned error exit status 255
dpkg: dependency problems prevent configuration of sa-compile:
 sa-compile depends on spamassassin; however:
  Package spamassassin is not configured yet.

dpkg: error processing package sa-compile (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates it's a follow-up error from a previous fa
ilure.
      Processing triggers for man-db (2.9.3-2) ...
Processing triggers for systemd (246.6-1ubuntu1.4) ...
Errors were encountered while processing:
 spamassassin
 sa-compile
E: Sub-process /usr/bin/dpkg returned an error code (1)

How to install the Ubuntu package spamassassin now?

I have also checked this (on another machine): install 20.04 LTS, upgrade to 20.10, install spamassassin, it works, so the problem is with proper cleaning.

The working installation has Perl v5.30.3 while the non working has v5.30.0 (although it is up to date according to apt update).

Perl version inconsistency on the non working Ubuntu:

sudo cpan
/usr/bin/cpan: Perl lib version (5.30.3) doesn't match executable     '/usr/bin/perl' version (5.30.0) at /usr/lib/x86_64-linux-gnu/perl/5.30/Config.pm line 62.

Compilation failed in require at /usr/share/perl/5.30/CPAN.pm line 44.

How do I update install Perl


At /usr/lib/x86_64-linux-gnu/perl/5.30/Config.pm line 62, I have replaced 5.30.3 by 5.30.0.

span runs but I had to kill it after hours of tests and it has not updated /usr/bin/perl.

apt install spamassassin succeeds.

Finally, I have replaced perl 5.30.0 by 5.30.3 copied from the other working installation and restored /usr/lib/x86_64-linux-gnu/perl/5.30/Config.pm.

Both binaries have exactly the same size 3478464 bytes.

Actually perl5.30.3 was already in /usr/bin so renaming it perl would have been enough.

After installing spamassassin, spamd produced an error at line 62 of /usr/lib/x86_64-linux-gnu/perl-base/Config.pm.

sudo apt reinstall perl-base updated (the version number in) /usr/lib/x86_64-linux-gnu/perl-base/Config.pm.