apt-get how to fix very broken packages

I recently upgraded from Ubuntu 8.04.3 to Ubuntu 10.04 and things went well, except a few broken packages.

Apt-get / synaptic was very broken due to the flashplugin-nonfree.

sudo apt-get install -f
[clip]
dpkg: error processing flashplugin-nonfree (--remove):
Package is in a very bad inconsistent state – you should
reinstall it before attempting a removal.
Errors were encountered while processing:
flashplugin-nonfree
E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of realplayer:
realplayer depends on libstdc++5 (>= 1:3.3.4-1); however:
Package libstdc++5 is not installed.
dpkg: error processing realplayer (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
realplayer

Not looking very good … and forcing things did not help (same results with --remove --force-remove-reinstreq.


dpkg --remove --force-all flashplugin-nonfree
dpkg: warning: overriding problem because --force enabled:
Package is in a very bad inconsistent state - you should
reinstall it before attempting a removal.
(Reading database ... 239938 files and directories currently installed.)
Removing flashplugin-nonfree ...
update-alternatives: error: no alternatives for iceape-flashplugin.
update-alternatives: error: no alternatives for iceape-flashplugin.
dpkg: error processing flashplugin-nonfree (--remove):
subprocess installed pre-removal script returned error exit status 2
postinst called with argument `abort-remove'
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
flashplugin-nonfree

To fix the problem I needed to manually remove the package.

cd /var/lib/dpkg/info
sudo rm flashplugin-nonfree.*

Now remove the offending packages:

sudo dpkg --remove --force-remove-reinstreq flashplugin-nonfree
sudo dpkg --remove --force-remove-reinstreq realplayer

Voilà – apt-get is now fixed =)

This entry was posted in Linux. Bookmark the permalink.

35 Responses to apt-get how to fix very broken packages

  1. Pingback: Tweets that mention Shadows of epiphany » Blog Archive » apt-get how to fix very broken packages -- Topsy.com

  2. Before I began the upgrade from 8.04.3 to 10.04 I made sure I had backups of my important company files. My 8.04.3 Server went to 10.04 Server as slick as glass. Karmic remix to Lucid remix on my notebook went normally with no issues. The netbook will take some getting used to.

    I had the same bad experience with 8.04.3 Desktop laptop as you did and fussed around quite a bit with some similar fixes that didn’t remove the offending flashplugin-nonfree. I noticed that updates were broken also. However, since I had Karmic on a USB stick, I formatted the drive with Hardy to ext4 and was good to go with a Karmic install from the stick. Then I upgraded to Lucid and things are working properly again. Lots of hours lost, but at least it was over Saturday and Sunday.

    Now I’ve got hours more “fun” getting ssh working with rsync between my computer, the netbook and my server. Oh joy, but at least my files, Bash & Python scripts, e-mail, Wine-required programs are restored and are now back to working as I need them to be.

    In retrospect, perhaps I should have waited a few days from the release of Lucid.

  3. romario says:

    It worked! after all finally back to normal.
    Thank you.

  4. Pingback: Bodhi.Zazen: apt-get how to fix very broken packages | TuxWire

  5. Stuart says:

    I had to do the exact same thing after attempting to install the R statistics package (r-recommended) in Ubuntu 10.04, which gave me tcl8.5 that could be neither removed nor fully installed. I had to sudo rm /var/lib/dpkg/info/tcl8.5*, after which R successfully installed.

    I have not had to get dirty with installation like this before.

  6. Pingback: Links 3/5/2010: Lubuntu 10.04 Released; Peppermint OS Reviewed | Techrights

  7. Pingback: fix broken apt-get packages | Linux Shtuff

  8. bodhi.zazen says:

    @Dave Mawdsley – Aye. When updating ANY OS I advise backups and the readiness to perform a fresh install. On “production” servers I prefer to try upgrades on similar hardware (if possible) or an image in KVM / VirtualBox / VMWare first as a “dry run”. Once I work out all the “bugs” , then upgrade the production server.

  9. Nate says:

    Thanks for the tips. I suppose the only downside is I might have some dangling, unregistered binaries.

  10. bodhi.zazen says:

    @Nate – search for them (find or locate) and manually delete them if you wish.

    Search under the name of the package you had to manually remove.

  11. Found your post on the planet a while ago and managed finally to apply it in my Hardy>Lucid machine.

    apt-get was indeed fixed!

    Thank you very much :)

  12. bodhi.zazen says:

    @Rubén Romero – You are most welcome, glad it worked.

  13. Arneh Jain says:

    Found just what i needed.Thank you very much.

  14. Aamir Ali says:

    That worked. Thank you very much.

  15. David says:

    Thanks! I was stuck trying to remove a broken install of postgresql-7.4 and these steps finally fixed it for me.

  16. David says:

    Great!
    I tried to upgrade libgtk2.0-0 to install the last flashplugin (the one I have does not work in fullscreen)
    and then everything went wrong, synaptics was not working anymore and apt-get -f was trying to remove like 3 gb of packages.
    your trick did the job perfectly!
    Thanks!

  17. Jon says:

    After a full day of terrible, broken, regret and finally success, I could hug you. I don’t know how to be more clear than that.

    Thank you

  18. jesse saunders says:

    THANK YOU!!

    You fixed my system!

  19. Benjamin B. says:

    Wow, I’ve had all kinds of trouble after running Update Manager on my Ubuntu 10.10. In my case it was python-egenix-mxtools. I couldn’t do any updates or installs. It was rather frustrating and I couldn’t find any solutions, until now that I ran across this little article. Like the others have said, THANK YOU!!

  20. bodhi.zazen says:

    Benjamin B. – Glad it worked =)

  21. chandu_ycm says:

    it worked for me. update manager crashed while installing crossplatfomui.
    thank you,

  22. bodhi.zazen says:

    @chandu_ycm

    Glad the information helped.

  23. My system was damage during the upgrading from Ubuntu 9.04 to 10.04 by energy fail. When it come back, the git-core package was broken and nothing I’ve done can solve it, until I found this post.
    You save my day!
    Thank you!

  24. goodgod261 says:

    Thank you! With those instructions I finally managed to get rid of errors with half-installed Samba on my Nokia N900 :)

  25. Christopher Chancellor says:

    Thank you so much for this how-to! I was having issues with bandwidthd on 11.04, which was incompatible with Natty in the first place.

    This was a quick and easy fix to a frustrating problem.

  26. W.G. says:

    Thank you!

    Saved me from re-installing the system!

  27. wei2912 says:

    Thanks for this, it saved my life!

  28. Karma says:

    I have tried apt-get update –fix-missing. I have tried deleting the list files, I have tried fixing the broken source, I remove lonelycoder, but I am still unable to get past the below message. Any help would be very much appreciated!!!!! I’m ready to re-install, but have so much invested, I hate to start all over. Especially since Apple has quit signing my firmware. I do have ssh blobs saved :)

    Family-Room-Apple-TV:/var/lib root# apt-get update
    Get:1 http://www.lonelycoder.com hts Release.gpg [198B]
    Hit http://www.lonelycoder.com hts Release
    Err http://www.lonelycoder.com hts Release

    Get:2 http://www.lonelycoder.com hts Release [1782B]
    Ign http://www.lonelycoder.com hts Release
    Ign http://www.lonelycoder.com hts/main Packages
    Ign http://www.lonelycoder.com hts/main Packages
    Err http://www.lonelycoder.com hts/main Packages
    HTTP/1.1 404 Not Found
    Fetched 1980B in 4s (453B/s)
    W: GPG error: http://www.lonelycoder.com hts Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 944EFDEB195D7AA2
    W: Failed to fetch http://www.lonelycoder.com/debian/dists/hts/main/binary-iphoneos-arm/Packages.gz HTTP/1.1 404 Not Found

    E: Some index files failed to download, they have been ignored, or old ones used instead.

  29. bodhi.zazen says:

    @Karma : You are having a problem with a third party repository .

    You will need to contact the project directly and determine what changes the maintainer made to the repositories, looks as if they moved to git.

    Otherwise , edit your sources and remove or comment out those repositories.

    https://help.ubuntu.com/community/Repositories/Ubuntu

  30. Pingback: [Debian] Updating - issues

  31. Gabi says:

    Thank you! I had the same problem with pidgin-ppa on Debian. The package was broken, and then I couldn’t remove it by the traditional means and it broke apt completely. Now my apt is working again, thanks to you!

  32. bodhi.zazen says:

    @Gabi – you are most welcome.

  33. David says:

    Thanks,

    Able to remove package and reinstall properly .
    Much appreciated!

  34. Pingback: Udate and dependency

  35. Björn P says:

    Der Hinweis hat mir gerade eben sehr geholfen.
    Danke! You made my day… :)

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>