Ubuntu Package Emergency Rescue
I now have a comfortable experience dealing with broken package installations on KUbuntu, especially in the light of my recent Gutsy upgrade. So I’ve assembled a small list of simple commands that can save your life (and saved a lot of my time more than once). Those should work just as well on Ubuntu.
The first one is THE magic command. Like any magic, it’s not for everyone to see and doesn’t belong to the graphical world of adept updates. It’s closer to the core but simple and effective nonetheless. So next time adept craps on you saying an upgrade has been aborted right in the middle of it because it could potentially corrupt your package database and leaves you with only half of the packages installed (which might not corrupt your database but is very likely to break your system), try this baby:
[source:java]
sudo dpkg –configure –pending
[/source]
It works everytime. Almost. Because sometimes the package itself is completely messed up (say adept felt like downloading it right when it restarted the network for example) and dpkg will list it as in error. What you need then is:
[source:java]
sudo dpkg -f install
[/source]
The ‘-f’ is not for force but for fix, which makes you feel more secure. Like somehow a nice developer felt your state of misery in front of a completely broken system and gave some of his time to save a lot of yours. Thanks man.
Once everything is fixed, you’re ready to give that update another try. I now tend to prefer the command line version as it always works, even if X11 or KDE are completely upside down:
[source:java]
apt-get update
apt-get upgrade
[/source]
Now that you know all there is to know to restore your system I’m going to tell you how to increase chaos and upgrade automatically to KUbuntu Gutsy. If you like to be close to the metal you can also directly edit your sources to use gutsy repositories but I think the automated update goes through some additional healthy cleaning. It’s beta stuff at the moment so be warned (as far as I can tell, Bluetooth has been broken this morning):
[source:java]
kdesu “adept_manager –version-upgrade”
[/source]
One last thing: when I upgraded, one of the packages needed to restart a few services. I clicked on yes a bit too quickly (mea culpa). In the list of the services was KDM. The KDE desktop manager. Which caused KDE to restart. Killing the upgrade halfway through. Leaving me in a world of pain. Well, woud have without the help of dpkg. So check those little dialogs very well.
Matthieu Riou on September 28th 2007 in Uncategorized
