Posted by: Odzangba | October 14, 2009

How to Fix “subprocess pre-removal script returned error exit status 2″ Error

UPDATE: Thanks to Msz Junk for pointing out the typos in the file paths.

What I really should have done was to link to khattam’s article because he did a pretty good job of describing the solution to this error but for my own archives, here goes…. I upgraded my box to Karmic Koala this evening and for some reason, ubiquity-frontend-kde flipped and borked the package management system. When I tried to open Synaptic, I got this:

Click to view a screenshot of Synaptic's error message

So I tried

sudo aptitude –configure -a


sudo apt-get install -f

and even tried messing with these:



but the system wouldn’t budge. Then I found khattam’s article and realized I was looking in the wrong files. To solve this error, close all package management software, and back up and edit the /var/lib/dpkg/status file with the following commands:

sudo cp /var/lib/dpkg/status /var/log/dpkg/status.old

gksudo gedit /var/lib/dpkg/status

Here comes the dicey part. Search for the package causing all this brouhaha and delete its entry. Please be very careful here and make sure you leave a blank line between the package entries below or above the deleted package entry. Here are screenshots of my file before and after selecting the appropriate package description entry.


If you did this right you should be able to open Synaptic and remove the offending package (if you don’t want it any more) or re-install it.I don’t understand why the developers couldn’t cook up a more graceful way for dpkg to show its displeasure.


  1. I received the following error:

    E: /var/cache/apt/archives/python-gst0.10_0.10.14-1ubuntu1_i386.deb: subprocess new pre-removal script returned error exit status 1

    I looked at all the google errors didn’t help at all. Then looked closely at how dpkg worked.

    I found out that the deb files are in archive format (ar).

    So I unpacked the deb file with:

    ar x python-gst0.10_0.10.14-1ubuntu1_i386.deb

    and got the following files:
    -rw-r–r– 1 root root 3579 2009-10-27 12:25 control.tar.gz
    -rw-r–r– 1 root root 501047 2009-10-27 12:25 data.tar.gz
    -rw-r–r– 1 root root 4 2009-10-27 12:25 debian-binary

    I tarred xzvf the files and got lots of files but especially
    the file called “prerm” ie. pre-removal script.

    So it appears this script crapped out but why.

    Inside it looks at the current python version.

    I had previously mistakenly thought I can set the version of python I can use by using ubuntu’s update-alternatives command:

    update-alternatives (8) – maintain symbolic links determining default commands

    Bad news it broke some assumptions in this prerm script file! I removed the symbolic link from the update-alernative command and just relinked python to python2.5 binary and the dpkg appears now to work. Phew looks like every problem in the deb infrastructure is probably caused by non-robust code in script files and/or in my case there are too many ways to change the system without understanding some of the consequences.

  2. Thank you, I had this problem and your post helped me.
    Sucessfull operation.

  3. thanks. need the info how to disable a package lost after two updates !!

  4. Thanks. This worked.

    One small rectification though: your code
    sudo cp /var/log/dpkg/status /var/log/dpkg/status.old

    gksudo gedit /var/log/dpkg/status

    should be (lib instead of log)

    sudo cp /var/lib/dpkg/status /var/lib/dpkg/status.old

    gksudo gedit /var/lib/dpkg/status

  5. Thank you so much! This error happened with my Flash installation so I was without Flash for days until I found this fix.

  6. Thanks for the tips. Worked like a charm! I had a half-configured mdadm. I’m not running RAID, so I guess I can live without that package anyway.

  7. god damn it…
    why aren’t you ranked number one in Google with this !!!!

    I spent like hours testing all other kind of tricks that did not work

    THANKS A LOT !!!

  8. Thank you very much for this! It saved my day!

    I have only experience with RPM packages and this deb thing is very new to me. I thought that I would have to start from scratch again…

  9. Thanks. This did the job.

  10. Thanks soooo much this worked on my new installation of Mint. You’re a saint!

  11. Great 😉

  12. great tutorial, really helped! worked perfectly for me for the spoonwep removal. real pain in the ass. keep up the good work 😀

  13. Thanks for this!

  14. Thanks A MILLION!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Thanks also to MSZ JUNK, for the rectification.
    So rarely do I get a solution that actually works. You da man (or woman)!!!!!!!!!

  15. […] Share this:ShareEmailRedditPrintStumbleUponFacebookTwitterDiggLike this:LikeBe the first to like this post.   […]

  16. like magic

  17. This was exactly what I was looking for my bad icinga-common installation.

    Thank you a million times!

    keep it up.

    lg from berlin/germany


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: