apt-get install error

Ok, have figured this out…

  1. When trying to install anything using apt-get, I would get the following error:

    Setting up spamassassin (3.3.2-5+deb7u1) …
    dpkg: error processing spamassassin (–configure):
    subprocess installed post-installation script returned error exit status 1
    Setting up libdpkg-perl (1.16.14) …
    Errors were encountered while processing:
    E: Sub-process /usr/bin/dpkg returned an error code (1)

  2. I had to dig into the /var/lib/dpkg/info/spamassassin.postinst file, to find this command generates the error:

    su debian-spamd -c "sa-update --gpghomedir /var/lib/spamassassin/sa-update-keys …

  3. The debian-spamd user already existed, but I had the login shell set to /bin/false, so the su just returned exitcode 1

  4. Once I changed the shell to /bin/sh, apt-get install worked

  5. I did get this warning:

    Setting up spamassassin (3.3.2-5+deb7u1) …
    gpg: WARNING: unsafe permissions on homedir `/var/lib/spamassassin/sa-update-keys’
    Starting SpamAssassin Mail Filter Daemon: spamd.

  6. But I ran the following, and cleared that up:

    chmod -R 700 /etc/spamassassin
    chmod -R 700 /var/lib/spamassassin