Fix "subprocess installed post-removal script returned error exit status ..." when installing/removing/updating a package with apt

Posted Over 8 years ago. Visible to the public.

If you get an error like:

subprocess installed post-removal script returned error exit status 78

when installing/removing/updating a package with apt you should check the postinst, postrm, prerm, ... script in /var/lib/dpkg/info/.

For example in my case I had a problem when removing varnish:

Removing varnish (4.0.3-2~trusty) ...
dpkg: error processing package varnish (--remove):
 subprocess installed post-removal script returned error exit status 78
Errors were encountered while processing:
 varnish

So I checked the /var/lib/dpkg/info/varnish.postrm for exit 78 and found the following:

[...]
        if test -e /var/lib/varnish; then

                rm -r /var/lib/varnish > /dev/null 2>&1 || exit 78
        fi
[...]

This directory couldn't get removed because there was a mount to /var/lib/varnish/. After I've unmounted it, it could get successfully removed.

Last edit
Over 8 years ago
Kim Klotz
License
Source code in this card is licensed under the MIT License.
Posted by Kim Klotz to makandra dev (2015-10-13 21:21)