[Debian] Error: subprocess post-removal script returned error exit status xx

This error message may appear if you are unlucky enough to install a damaged or badly designed package and then want to remove it. Now that your package manager is “stuck” you must fix the situation by hand.

Go to the directory /var/lib/dpkg/info and list every scripts related to the faulty package ls .* <package_name>.

Depending the precise error modify the appropriate script (prerm or postrm). Sometime changing /bin/sh -e by /bin/sh could be enough. Other time you must comment the ‘faulty’ line. Worst case scenario place an exit 0 at the second line.

Leave a Reply

Your email address will not be published. Required fields are marked *