30

In short: I am trying to install spamassassin but dpkg returns only with:

dpkg: error processing spamassassin (--configure):
subprocess installed post-installation script returned error exit status 1

I have tried to find more information about what is going wrong but I cannot find anywhere any useful logging.

In /var/crash a spamassassin crashreport is generated but this gives only old dpkg errors and:

 Start-Date: 2014-02-17  19:18:13
 Commandline: apt-get install spamassassin
AptOrdering:
 spamassassin: Configure
 amavisd-new-postfix: Configure

Followed by dmesg logging from startup. Amavis gives an error because dependency spamassassin is not configured.

I checked the log files:

apt history.log
apt term.log
dpkg.log
syslog.log

but no additional information.

I tried dpkg -D with all possible octals but I find nothing useful about what could go wrong.

Lots of questions and possible solutions have been written about dpkg errors and many I have tried, but with no additional information I do not have the feeling I am getting anywhere.

Surely there must be somewhere a possibility to read what is going wrong or to crank up some logging so it will be logged?

3
  • You have to scroll up in your terminal and see the specific error, in the message you saw. To debug these, you have to see what the exact error was that triggered this.
    – Thomas Ward
    Feb 17, 2014 at 19:05
  • there should be a description in the terminal, have you looked into /var/log/spamassassin/spamd.log ?
    – kamil
    Feb 17, 2014 at 19:06
  • I have plowed through all logs, purged, redone installation in many different ways. All to find a bit more information about the error, but I can not find any. Spamd.log is not being made yet.
    – Requist
    Feb 17, 2014 at 19:26

3 Answers 3

24

Ok, I have found the solution for this problem. Thought I was unable to crank up the logging to get more data, the data already presented had the clue to the problem.

dpkg: error processing spamassassin (--configure):
subprocess installed post-installation script returned error exit status 1

says dpkg encountered an error processing spamassassin while running configure. Next line tels us the post-installation script did not finish correct.

In the /var/lib/dpkg/info dir we can locate the script files of dpkg, the file: spamassassin.postinst gives us the script file which generated the error.

Within this file we know we have to look at the code runned by configure:

if [ "$1" = "configure" ]; then

and after some debugging I found out the line:

su debian-spamd -c "sa-update --gpghomedir /var/lib/spamassassin/sa-update-keys \ --import /usr/share/spamassassin/GPG.KEY"

returned exit code 1 (run command @commandline and use echo $? next to get the exit code)

The problem was that the user debian-spamd already existed on my system but its login shell was /bin/false. Su-ing with /bin/false returns without any message but exitcode 1.

Adding -s /bin/sh to the command solved the problem though in the end I did alter the login shell of the user to stay in sync with future updates.

3
  • 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, 2015 at 14:43
  • 1
    I dont have exact problem but your debugging hints helped me lot! thanks!
    – chaosguru
    Sep 6, 2017 at 9:06
  • > Adding -s /bin/sh to the command To which command? May 12, 2020 at 14:18
16

Generally to debug such issues, you would edit /var/lib/dpkg/info/spamassassin.postinst (or .preinst, pr .prerm or .postrm; depending on which one is failing) and change #!/bin/sh at the top line to #!/bin/sh -x (same thing if it bash instead: just add -x)

That would provide you with line-by-line debug of shell script, so you could tell where it exits with non-zero code (causing the installation/upgrade to fail).

It would probably require at least some shell scripting skills to debug, though.

2
  • 1
    how to prevent dpkg -i xyz.deb from overriding the /var/lib/dpkg/info/xyz.postinst again after I edited it for debugging purposes? Everytime I edit it, dpkg will undo my edits :( Jun 29, 2020 at 21:41
  • 1
    @ElectRocnic you'd unpack .deb archive with ar(1), then use tar(1) to unpack control.tar.gz contained within, and then edit .postinst and other control scripts to your liking, and use tar and ar to repack back .deb file. Alternatively, get the source (with apt-get source or like) and edit postinst files and and rebuild package with debuild(1) or similar. Jul 1, 2020 at 11:43
1

Here, like the previous answer, we see how to add debugging code, (e.g., "set -x") to an /var/lib/dpkg/info/* file, BUT without having it get overwritten just before execution!:

  # dpkg --unpack /var/cache/apt/archives/grub-pc_2.06-2_amd64.deb
  ... edit /var/lib/dpkg/info/grub-pc.postinst ...
  # dpkg --configure grub-pc

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .