Recently, my Debian "sid" boxen developed a problem during a routine update/upgrade process. There was some incompatibility among the various programs I'd installed for a local LAMP test kitchen. I'm not using it, so I tried to remove the whole mess, but I kept getting a message like this at the end of every aptitude
command, regardless of what programs were involved.
root@britomartis:/home/rebecca# aptitude remove php5-mysqlnd
The following packages will be REMOVED:
php5-mysqlnd
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 495 kB will be freed.
(Reading database ... 123342 files and directories currently installed.)
Removing php5-mysqlnd ...
/var/lib/dpkg/info/php5-mysqlnd.prerm: 9: /var/lib/dpkg/info/php5-mysqlnd.prerm: php5dismod: not found
dpkg: error processing php5-mysqlnd (--remove):
subprocess installed pre-removal script returned error exit status 127
Errors were encountered while processing:
php5-mysqlnd
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
After a couple of weeks' Googling and reading, I happened on Force Uninstall a package in Debian/Ubuntu:
The solution is to head over to /var/lib/dpkg/info and find the package in question. There should be a file with .prerm at the end of it. In the case of xulrunner-1.9 the file is called xulrunner-1.9.prerm. Edit the file and change it's contents so it just says:
#!/bin/sh
set -e
After that the standard command will work:
I did that--I edited /var/lib/dpkg/info/php5-mysqlnd
, so that it had just those two lines, and was rewarded with this:
root@britomartis:~# aptitude remove php5-mysqlnd
The following packages will be REMOVED:
php5-mysqlnd
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 495 kB will be freed.
(Reading database ... 123342 files and directories currently installed.)
Removing php5-mysqlnd ...
Current status: 0 broken [-1], 0 updates [-1].