Ubuntu – Broken Package Manager? The suggested “apt-get -f install” is failing!


I don't really know what happened… I clicked "install updates" in the update manager window, it failed, and next thing I know I can't apt-get install any packages, it just suggests I try apt-get -f install, which fails with the following message.

doug@doug-lubuntu:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
The following packages will be upgraded:
1 upgraded, 0 newly installed, 0 to remove and 30 not upgraded.
5 not fully installed or removed.
Need to get 0 B/52.5 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: error processing libcupsimage2:i386 (--configure):
 libcupsimage2:i386 1.5.3-0ubuntu1 cannot be configured because libcupsimage2:amd64 is in a different version (1.5.3-0ubuntu2)
dpkg: error processing libcupsimage2 (--configure):
 libcupsimage2:amd64 1.5.3-0ubuntu2 cannot be configured because libcupsimage2:i386 is in a different version (1.5.3-0ubuntu1)
No apport report written because the error message indicates its a followup error from a previous failure.
dpkg: dependency problems prevent configuration of ia32-libs-multiarch:i386:
 ia32-libs-multiarch:i386 depends on libcupsimage2; however:
  Package libcupsimage2:i386 is not configured yet.
dpkg: error processing ia32-libs-multiarch:i386 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ia32-libs:
 ia32-libs depends on ia32-libs-multiarch; however:
  Package ia32-libs-multiarch is not installed.
  Package ia32-libs-multiarch:i386 is not configured yet.
dpkg: error processing ia32-libs (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of skype:
 skype depends on ia32-libs; however:
  Package ia32-libs is not configured yet.
dpkg: error processing skype (--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:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Can someone out there help me get my package manager working?

Best Answer

Usually this happens when mismatched package versions are hand-installed with dpkg or gdebi without some of the dependencies having a resolution. (dpkg/gdebi and other .deb level tools will try to install a package where dependencies are unmet, leaving it in the half-installed "unconfigured" state, which apt considers to be broken. apt, software center, synaptic, and other high-level package management will usually catch these errors from reading the dependencies before installing the package and stop you before you break things, unless the error happens late in the installation, such as what happens when a package in the repository is broken and tries to write files owned by another package)

So long as the packages causing the error are not system critical and can be removed without causing a huge cascade of dependency problems, the quickest way to resolve an error like that that apt-get can't resolve on it's own is to back the offending packages out until apt-get -f install is able to take care of the problem, then apt-get update, apt-get upgrade, and finally try what you were doing again through apt-get.

In your case, I'd start by backing out libcupsimage2:i386 ia32-libs-multiarch:i386 and skype:

apt-get remove libcupsimage2:i386  ia32-libs-multiarch:i386 ia32-libs skype

If the situation is more complex, and creates huge cascades of failed dependencies, then the alternative is to figure out from the dependency messages what went wrong and try to specify a solution by naming the packages necessary to resolve the dependency problem. Usually these sort of situations arise from mixing packages from multiple repositories such as backports or PPAs, and you solve them by specifying a particular version of a package that wouldn't normally be considered by apt because of pinning, or by explicitly telling apt-get to go back to versions in the official repository (apt-get will not downgrade a package to solve a broken situation unless explicitly told to do so - so if you installed a newer version of a library by hand, and packages on the system have a dependency on the specific version, you have to update one or downgrade the other until the dependency mess is resolved.)

Related Question