Monday, November 12, 2012

I recently descended into endlessly broken apt and dpkg hell. Usually this is enough to get out of the woods:

sudo dpkg --configure -a
sudo apt-get -f install

but not this time. I also tried cleaning out the cache and re-downloading the packages, but no dice. Until this is fixed you can't install or remove any other packages. Here's a few things I tried and the errors I was getting:

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libutouch-grail1 libutouch-evemu1 libutouch-frame1 libutouch-geis1
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libc6-dev
Suggested packages:
glibc-doc
The following packages will be upgraded:
libc6-dev
1 upgraded, 0 newly installed, 0 to remove and 156 not upgraded.
1 not fully installed or removed.
Need to get 0 B/5,100 kB of archives.
After this operation, 2,048 B disk space will be freed.
Do you want to continue [Y/n]?
dpkg: dependency problems prevent configuration of libc6-dev:
libc6-dev depends on libc6 (= 2.15-0ubuntu10.2); however:
Version of libc6 on system is 2.15-0ubuntu10.3.
libc6-dev depends on libc-dev-bin (= 2.15-0ubuntu10.2); however:
Version of libc-dev-bin on system is 2.15-0ubuntu10.3.
dpkg: error processing libc6-dev (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
libc6-dev
E: Sub-process /usr/bin/dpkg returned an error code (1)

The solution was to put the offending package on hold:

# echo "libc6-dev hold" | dpkg --set-selections

then run:

# apt-get -f install

which removed a bunch of packages, including the offending broken one. I could then apt-get update and upgrade as normal. Hooray!

7 comments:

I encountered the same but the fix did not help. Not sure I did it correctly (i'm a command-line novice). Could you expand a bit on the dev hold and --set-selections parts a bit more? Would really appreciate it.