#875958 sa-compile: The package fails to run sa-compile

Package:
sa-compile
Source:
spamassassin
Submitter:
Bernard
Date:
2021-04-16 19:57:02 UTC
Severity:
normal
Tags:
#875958#5
Date:
2017-09-16 14:15:12 UTC
From:
To:
The only purpose of the package is to run the program sa-compile.

For this is contains a single command line in postint (post installation
scripts)

like: su - debian-spamd -c sa-compile
The program line should be "su debian-spamd -c sa-compile" (I think).

sa-compile compiles rules in /var/lib/spamassassin/compiled. Directory and
files should be owned by debian-spamd.debian-spamd.

Anyway, it fails and as a result spamassassin cannot be installed
(configuration fails).

#875958#14
Date:
2017-09-16 14:44:21 UTC
From:
To:
Can you send a complete transcript of a failing 'apt install sa-compile'
run?

Thanks
noah

#875958#19
Date:
2017-09-16 14:32:10 UTC
From:
To:
Dropping this to severity 'normal', because I don't think this is
widespread. 3.4.1-6 was released 11 months ago and this is the first
report of it being completely broken.

root@stretch:~# apt install sa-compile
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  binutils cpp cpp-6 gcc gcc-6 libasan3 libatomic1 libc-dev-bin libc6-dev
  libcc1-0 libcilkrts5 libgcc-6-dev libgomp1 libisl15 libitm1 liblsan0 libmpc3
  libmpfr4 libmpx2 libquadmath0 libtsan0 libubsan0 linux-libc-dev make
  manpages manpages-dev re2c
Suggested packages:
  binutils-doc cpp-doc gcc-6-locales gcc-multilib autoconf automake libtool
  flex bison gdb gcc-doc gcc-6-multilib gcc-6-doc libgcc1-dbg libgomp1-dbg
  libitm1-dbg libatomic1-dbg libasan3-dbg liblsan0-dbg libtsan0-dbg
  libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg glibc-doc
  make-doc man-browser
The following NEW packages will be installed:
  binutils cpp cpp-6 gcc gcc-6 libasan3 libatomic1 libc-dev-bin libc6-dev
  libcc1-0 libcilkrts5 libgcc-6-dev libgomp1 libisl15 libitm1 liblsan0 libmpc3
  libmpfr4 libmpx2 libquadmath0 libtsan0 libubsan0 linux-libc-dev make
  manpages manpages-dev re2c sa-compile
0 upgraded, 28 newly installed, 0 to remove and 0 not upgraded.
Need to get 29.7 MB of archives.
After this operation, 121 MB of additional disk space will be used.
Do you want to continue? [Y/n]
...
Setting up sa-compile (3.4.1-6) ...
Running sa-compile (may take a long time)
Processing triggers for libc-bin (2.24-11+deb9u1) ...
root@stretch:~# echo $?
0

I am not sure what could be causing the observed issue on your system.

noah

#875958#24
Date:
2017-12-12 16:56:10 UTC
From:
To:
The problem seems to occur only if you have script(s) in /etc/profile.d.

On the last upgrade to 9.3 Stretch, we experienced this issue. Also, see
comment by Vagnerr at
https://askubuntu.com/questions/422264/how-to-debug-dpkg-configure-error-in-subprocess-post-installation
describing this problem from May 2015.

"I had a similar issue to you. With the installer just flat failing.
Mine turned out to be an issue with installing the latest version from
debian-backports for wheezy. It turned out that they changed the post
install script to have a 'su - $OWNER -c "sa-update ...' call which did
a full login shell exec to /bin/sh which was incompatible with our
/etc/profile and /etc/profile.d files. removing the '-' making it "su
$OWNER -c ...." fixed it for me – Vagnerr May 16 '15 at 14:43"

I can confirm that removal of the file in /etc/profile.d fixed the problem.

The file in question is /var/lib/dpkg/info/sa-compile.postinst, line 10,
which reads:

su - $OWNER -c "sa-compile --quiet"

Here is the relevant portion of the transcript from our upgrade
highlighting the issue with /etc/profile.d.

Setting up spamassassin (3.4.1-6+deb9u1) ...
Installing new version of config file /etc/cron.daily/spamassassin ...
Installing new version of config file /etc/spamassassin/65_debian.cf ...
-su: 19: /etc/profile.d/lcx_all_users_aliases.sh: Syntax error: "(" 
unexpected
dpkg: error processing package spamassassin (--configure):
  subprocess installed post-installation script returned error exit status 2
Setting up zsh (5.3.1-4+b2) ...
Setting up libicu57:amd64 (57.1-6+deb9u1) ...
Setting up iproute2 (4.9.0-1+deb9u1) ...
Setting up linux-image-4.9.0-4-amd64 (4.9.65-3) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.9.0-4-amd64
W: initramfs-tools configuration sets
RESUME=UUID=e4df7c74-843d-4e43-a7de-8c97d1469f24
W: but no matching swap device is available.
I: The initramfs will attempt to resume from /dev/vda2
I: (UUID=bf035740-4836-4088-835d-84bd43a5cd05)
I: Set the RESUME variable to override this.
/etc/kernel/postinst.d/zz-update-grub:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.9.0-4-amd64
Found initrd image: /boot/initrd.img-4.9.0-4-amd64
Found linux image: /boot/vmlinuz-4.9.0-3-amd64
Found initrd image: /boot/initrd.img-4.9.0-3-amd64
done
Processing triggers for libc-bin (2.24-11+deb9u1) ...
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
Processing triggers for systemd (232-25+deb9u1) ...
Setting up libsqlite3-0:amd64 (3.16.2-5+deb9u1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up libpython2.7-minimal:amd64 (2.7.13-2+deb9u2) ...
Setting up openssh-client (1:7.4p1-10+deb9u2) ...
Setting up spamc (3.4.1-6+deb9u1) ...
Setting up libpython2.7-stdlib:amd64 (2.7.13-2+deb9u2) ...
Setting up libdbus-1-3:amd64 (1.10.24-0+deb9u1) ...
Setting up python2.7-minimal (2.7.13-2+deb9u2) ...
Setting up iproute (1:4.9.0-1+deb9u1) ...
Setting up python2.7 (2.7.13-2+deb9u2) ...
Setting up openssh-sftp-server (1:7.4p1-10+deb9u2) ...
Setting up libpython2.7:amd64 (2.7.13-2+deb9u2) ...
Setting up libpython2.7-dev:amd64 (2.7.13-2+deb9u2) ...
Setting up dbus (1.10.24-0+deb9u1) ...
A reboot is required to replace the running dbus-daemon.
Please reboot the system when convenient.
Setting up python2.7-dev (2.7.13-2+deb9u2) ...
Setting up openssh-server (1:7.4p1-10+deb9u2) ...
Processing triggers for libc-bin (2.24-11+deb9u1) ...
Errors were encountered while processing:
  spamassassin
  sa-compile

#875958#29
Date:
2018-01-22 21:16:53 UTC
From:
To:
I ran into this problem as well and I found this way to get spamassassin
installed.

While installing spamassassin using apt-get install; the user-id
debian-spamd is created and given the /bin/sh - shell.
After I changed the shell to /bin/bash and issued the "apt-get install
spamassassin" again; the package(s) got installed normally without an
error.

sa-compile throws an error when started as user debian-spamd and using
the "sh" - shell and this binary is started during the installation,
hence the installation failure...

If the installation script creates the user with the "bash" - shell it
might solve this broken installation.

#875958#34
Date:
2018-03-05 11:41:23 UTC
From:
To:
Hi,

Fred de Brouwer schrob:

So there's a bashism somewhere, and it needs to be fixed.

Since "LinuxChix SysAdmin" reports having issues due to local scripts in
/etc/profile.d/ , can you please check whether you have those too? And
if so, if they contain nonportable code? Looking at the output of "sh"
and "sh -l" and "su - debian-spamd -s /bin/sh -c true" might show issues.

If that's indeed the problem, you need to fix those scripts to either
use only posix features, or make the offending parts conditional on
"[ -n "$BASH_VERSINFO" ]". Otherwise, all user accounts with a non-bash
posix login shell will have issues, not just debian-spamd.

If you don't have local shell startup files, then we need to hunt for a
bashism in debian's files.

HTH,
    Jan

#875958#39
Date:
2020-03-20 22:14:57 UTC
From:
To:
This bug still exists in stable, my debian-spamd user is using /usr/sbin/nologin as a shell.
#875958#44
Date:
2021-04-16 19:45:33 UTC
From:
To:
I had the same issue :

Running sa-compile (may take a long time)
This account is currently not available.
dpkg: error processing package sa-compile (--configure):
  installed sa-compile package post-installation script subprocess
returned error exit status 1
Errors were encountered while processing:
  sa-compile


to fix in /etc/passwd

old:

debian-spamd:x:111:118::/var/lib/spamassassin:/usr/sbin/nologin

new:

debian-spamd:x:111:118::/var/lib/spamassassin:/bin/bash


I had tried moving /etc/profile.d out of the way , that did not fix the
error here.


we are using debian stable

# apt show sa-compile
Package: sa-compile
Version: 3.4.2-1+deb10u3