How To Fix Broken Packages In Ubuntu Or Debian

sudoaptgetinstallmthrfckr

PPA’s: Silver Sword Or Golden Band-Aid

So, you just had to go overboard with your PPA’s, didn’t you?  The lure of bleeding-edge software was just to great for you to be able to stick with the tried-and-true software that was already available in your existing repositories.  Not even backports could sate your need to run with the pack.

PPA’s in Ubuntu are a great way to get software you would otherwise have to wait for.  Ubuntu, which is on a 6-month release cycle, always has relatively up-to-date software for your general consumption, but when you just can’t wait for the next release, PPA’s provide a good channel for properly packaged updates.  That’s not the only audience for PPA’s.  A very ‘elite‘ few of us take on the challenge of using an LTS release, taking it from start to finish (3 years).  In my case, I have Ubuntu 10.04 running on my laptop, which is getting up there in age and cannot handle anything newer.  Though Canonical claims to support the release for 3 years– and they do– getting up-to-date software, even something as fundamental as a web-browser, can be a real challenge.  Here we are, only 2 years in the release of Ubuntu 10.04 and most of the software updates that are not critical, have dried up.  I still run the latest Google Chrome and many others, but not the full monty.

But you must be careful…  Adding a PPA channel to your system is stupidly simple, but once you’ve done it and you’re not properly versed in Debian package management, you may have destroyed your system.  In my case, I had been running the latest VLC 2.0 in Kubuntu 11.10.  I got this software from a PPA channel just so that I could try out the experimental Blu-Ray support.  Little did I know (well, actually, I knew what I was getting into) I would break my package manager.

Let’s Get Busy

First, when you are on Launchpad learning about the PPA you are going to add, READ THE DESCRIPTION!  The version of VLC I installed came from Nate Muench’s (Mink) PPA.  There is a very clear and friendly warning at the top.

THIS PPA MIGHT BREAK OTHER PACKAGES (it shouldn’t (since they’re backported with minimal changes), but someone recommended that I should note it anyways)

Of course I say to myself, “meh, whatever.  I want VLC 2.0 and I want to install it with apt, so… I’m just gonna do it”.  And I did.

First off, let me touch on the problem here.  PPAs pose little risk to your system when they contain only a couple of packages.  Say you want the latest release of snes9x-gtk for a little Super Mario World action.  That’s just fine.  This PPA on the other hand comes with dozens of packages that are all multimedia related, and all backported from 12.04 beta.  For me, it broke many things.  It’s really a good idea to stay away from PPAs that support a large set of dependencies.  Now, the process…

Identify The Affected Packages

For me, the package that broke was DeVeDe.  We use this a lot around the house, so having it broken is a big no-no.  The first thing I did was uninstall DeVeDe.  Upon trying to install it again, it failed, saying that it needed ‘mencoder’.  Now there is a trail to follow.

First I uninstalled DeVeDe, VLC and mencoder.  Now that the offending packages are gone, we need to destroy the PPA and downgrade all the packages that it upgraded.

1. Install ppa-purge
sudo apt-get install ppa-purge

2. Purge the PPA.
sudo ppa-purge ppa:n-muench/vlc

Now, not only is the ppa going away, all of the affected packages are being downgraded. Sit back and watch the show for a few minutes, and when it’s finished, we’ll resume.

3. Update your sources.list
sudo apt-get update

4. Clean any partial packages left behind during the wreckage.
sudo apt-get autoclean

5. Clean your apt-cache! This is important if you want apt to continue behaving at the command-line.
sudo apt-get clean

6. Remove any packages that are no longer necessary.
sudo apt-get autoremove

7. Enjoy not having to reinstall your OS!

Some Thoughts

You’re not likely to catch me using Mac OS X.  Why?  I like my freedom, and I’ll have it at almost any cost.  I won’t get that with Mac OS X, but I do aim to give it a little credit right now.  The idea of package management is certainly a good one, but it is not perfect my any means.  Too many things to break, and it would take a very advanced user to maintain one without breaking it across several Ubuntu releases.  I successfully did this from Ubuntu 7.10 to 9.10 at one point, and how I made it that way seems to be sheer luck.  I’ve never been able to operate fully with what’s available in the official repositories.  Mac OS X takes a much simpler approach.  Most applications are distributed in a .app file, which is essential just an archive of an application and almost all of it’s dependencies.  Having a lot of apps on Mac OS X sure does eat up your disk space, but it’s worth it to be able to manage application in the most straight-forward way possible.  Sure, you might have 2 applications that use the same library and one app uses a version that’s a little deprecated, but what’s wrong with that?  It all just works.

 


Dean Howell

Dean Howell has over a decade of experience with Linux and nearly 2 decades of experience with computers in general. Currently, Dean is Editor-in-chief of The Powerbase and also works for one of the world's largest providers of Linux-based NVRs.

Related posts

  • http://twitter.com/almehdin Daniel Sandman

    I think you are completely wrong on the “bundle the dependencies with app” thingy. One is that linux need to be run on everything… even small devices. Changing this would make that very hard. It’s not just Mac but Windows too uses that approach. It would break with traditional Linux in a way i wouldn’t call it Linux anymore. One of the main features with Linux is not to have this kind of bloat.

    Also the problem you are describing is not a very big problem. Especially on a Debian based system. It almost never happens. As long as you don’t try to update at system dependable package like libc or similar. That is a package that almost everything else rely upon and changing that without changing all the others would thus break the system. It would be like using WinXP explorer.exe on Win7. The system also warn you about this and often don’t allow it.. so you will need to force the change. It’s a user error that not many users do.

    • Tim

      It may not be a “big problem” to most people, but it has happened to me many times, largely because the software I want to install requires an updated version of such and such… and then I remove the software and forget to take out the additional dependencies that it installed. The OSX solution “just works” and is great for a friendly Desktop environment.

      That said, Linux by its nature is flexible. I see no reason why a Desktop OS, such as Ubuntu, couldn’t move to something more along the OSX method. I’d welcome a distribution to try such an approach. It would, however, increase the amount of bandwidth required to install software and thus be more expensive to host the repo’s. But then again, it would also promote software developers simply hosting their own software as a self-contained package.

    • http://www.digifail.com/ Tom Nardi

      I would say it depends on the application.

      If it’s a small application, statically compiling in the dependencies might only bring it’s total size up a few MBs over the dynamically linked version. The advantage of not having to worry about mismatched dependencies on your user’s system or providing distribution-specific packages far outweigh the small bump in filesize in such a case. This is a win for the developer as well as the user.

      Now if you are talking about ALL the packages on a system, or maybe more specifically, the ones that come from the official repositories, then that’s another story. If a package and it’s dependencies are available in your distribution’s repositories, then there is no reason they should be static.

  • someguy

    This article has nothing to do with Debian since PPA is not for Debian at all. Perhaps consider removing the mention of Debian from your title.

    • lordpenguin

      someguy, if you’re using Debian, can can still use all the functions of apt to fix your system as described in the article.

      • someguy

        None of the commands ‘fix’ anything.

        sudo apt-get install ppa-purge
        sudo ppa-purge ppa:n-muench/vlc
        - These are not available on Debian

        sudo apt-get update
        - This is not a ‘fix’ for anything, just an update to the available packages.

        sudo apt-get autoclean
        - This is not a ‘fix’ for anything, it simply removes packages from /var/cache/apt/archives

        sudo apt-get clean
        - This is not a ‘fix’ for anything, it also removes packages from /var/cache/apt/archives

        sudo apt-get autoremove
        - This is not a ‘fix’ for anything, it simply removes packages that are no longer needed.

        • lordpenguin

          When changing the head-gasket on your car, removing the valve cover doesn’t fix anything. Wiping the old corroded oil mess from the seal doesn’t fix anything either. Hell, placing the new head gasket in the old one’s place doesn’t fix anything.

          Once you complete all those tasks, your car is fixed.

  • Pingback: Links 6/4/2012: KDE 5.0 Wishlist, Fedora 17 Delays | Techrights

  • Ted

    Thanks for the step by step instructions. I am a total non-geek running linux. I like to do reckless things and break my OS. Now that my son is running a minecraft server on one of my Linux boxes, I can’t break that OS on a whim. I now have a way out.

    Don’t worry about the negative comments. There is a reason normal people stay away from the Linux forums.

  • Pingback: Linux News » How To Fix Broken Packages In Ubuntu Or Debian

  • http://fraaargh.wordpress.com/ Francois Marot

    The problem with OS X approch is that if a vulnerability is discovered in a library, you have to upgrade all the programms that were installed that use this lib. If any programm is not maintained any more, no one will update it and youhave a vulnerability on your computer. By sharing libs, you gain in security.

  • Steffen

    You can install software the MacOSX way also on any UNIX system. You just have all the libraries shipping with your binary. And many extra-distributional software providers do that. The explicit dependencies of one package on another is something extra that the distribution-makers are very happy about. It is not only about an increased efficiency and security. It has a social component as it brings the community of Open Source software developers together. The library developers know about who is using their developments which makes them happier per se. Also, they may get in contact about new features and there is always only a little difference between extending a library’s functionality in your own little program or to submit that code to the library developer to have that included with a next version for the benefit of all.

  • James LaBarre

    And what about those occasions where the package is *so* broken you can’t even uninstall it? Where you can’t run apt-get -f install, or apt-get purge ? I’ve encountered that a few times, and this article says nothing about how to fix that.

    It just so happens, though, I know a rather crude fix for that. If you go to /var/lib/dpkg/info/, you can then delete all the script and info files for the package. Then when you run the removal command it will just say it couldn’t find the package info and presumes it’s uninstalled. Sure, it doesn’t remove the files in the package, but it allows the package manager to go forward, and *then* you can work at restoring the working versions of whatever broke.

  • Pingback: How To Fix Broken Packages In Ubuntu Or Debian | Debian-News.net - Your one stop for news about Debian

  • Pingback: How To Fix Broken Packages In Ubuntu Or Debian | Ubuntu-News - Your one stop for news about Ubuntu

  • Pingback: How To Fix Broken Packages In Ubuntu Or Debian | Build Future Repository

  • http://www.facebook.com/lemler3 Jesse Gables

    i wish this was around win i had 8.10 rofl

  • Pingback: How To Fix Broken Packages In Ubuntu Or Debian | Debian News

  • Pingback: | linuxin.ro

  • Pingback: How To Fix Broken Packages In Ubuntu Or Debian | Build Future Repository

  • Pingback: Cinnamon Goes 2D, Diminishes Mate's Relevance

  • DJ Rainiuska

    Thx it worked!

  • Juvenal A. Silva Jr

    Just to clarify some things about your comment regarding MacOS X way of
    software install/development. MacOS X applications are supposed to link
    (dynamically) against MacOS X SDK that comes with Xcode (its IDE). If
    the developer chooses to add non standard libraries to his application,
    (s)he still has the option of package the library as a shared Framework
    (which is like a public shared library in Apple’s vocabulary) and
    provide an installation script which places the Framework inside the
    proper system Framework directory. This will make the Framework
    available to any other application that whishes to use it. The problem
    with software that packs everything together (binaries/libraries) in a single bundle, is because it uses non standard libraries, and/or the developer is lazy to handle them separately. It’s in any way a limitation of the MacOS X system, as there are a wide and really usefull set of standard libraries (Cocoa, CoreFoundation, CoreData, CoreAnimatiom, CoreVideo, CoreAudio, OpenGL, OpenAL, Quicktime, Quartz, etc) to link your app against on the SDK.
    I’m a long term Linux (toolchain) and Mac OS X developer. Most of the kind of applications that includes libraries into its own application are the ones that were “ported” from another system (Linux and other UNIXes like). I may understand the motivation to reuse an application code over platforms, but it’s not, in any way a problem with the target system, just lazyness of the developer… ;-)

Top