Saturday, January 02, 2010

Ubuntu : Fix : “subprocess pre-removal script returned error exit status 2″ Error

Symptoms
I after installing a bunch of software and then crashed half way, they didn't get to be configured.

You recieve an error saying something along the lines

subprocess pre-removal script returned error exit status 2

Re installing the packages do not help.
You cannot uninstall the packages.

Tried using the following commands and it didn't resolve the errors of partial installs.
  • dpkg --configure -a
  • sudo aptitude –configure -a
  • sudo apt-get install -f

Resolution
You have to remove the offending packages from the "dpkg" status file.

1) Back up the status file
sudo cp /var/lib/dpkg/status /home/yourplace/status.old


2) Edit the file
gksudo gedit /var/lib/dpkg/status

3) Search for the offending packages and remove the whole paragraph to do with that package.
NOTE: Make sure there is a just ONE space between paragraphs

4) Save the file

5) Run "Synaptic Package Manager".
You will find the packages removed, you can now install them again with no errors.

Final Thoughts
The packages that I was installing that failed on me due to a pre mature crash was, "Empathy, Pingus and Konversation".

There was around 4 packages that related to Empathy and 2 from Pingus that failed. Thanks to help of a blog (See references), I managed to fix those :)

Seeing this resolution working, made me a feel that the community will some day improve the package manager to automate the cleaning of damaged packages in the "status" file.

Oh and this issue happend to be me in Xubuntu yet I am sure it be similar with other distros.

References

Odzangba Kafui Dake’s Blog

No comments: