I've been trying to update standard packages on my Ubuntu box. There's literally nothing extra on this box except for VirtualBox for some Windows stuff I run. Here's one output:

$ sudo apt-get update
[...]
$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 libgail-3-0 : Depends: libgtk-3-0 (= 3.6.0-0ubuntu3.2) but 3.6.0-0ubuntu3.1 is installed
 libgtk-3-0 : Depends: libgtk-3-common (= 3.6.0-0ubuntu3.1) but 3.6.0-0ubuntu3.2 is installed
 libgtk-3-bin : Depends: libgtk-3-0 (>= 3.6.0-0ubuntu3.2) but 3.6.0-0ubuntu3.1 is installed

And another with the -f option:

$ sudo apt-get -f upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages will be upgraded:
  libgtk-3-0 overlay-scrollbar-gtk3
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
26 not fully installed or removed.
Need to get 0 B/2,397 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 203437 files and directories currently installed.)
Preparing to replace libgtk-3-0:amd64 3.6.0-0ubuntu3.1 (using .../libgtk-3-0_3.6.0-0ubuntu3.2_amd64.deb) ...
Unpacking replacement libgtk-3-0:amd64 ...
dpkg: error processing /var/cache/apt/archives/libgtk-3-0_3.6.0-0ubuntu3.2_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules', which is also in package ibus-gtk3:amd64 1.4.1-7ubuntu1
Preparing to replace overlay-scrollbar-gtk3:amd64 0.2.16+r357-0ubuntu1 (using .../overlay-scrollbar-gtk3_0.2.16+r357-0ubuntu1.1_amd64.deb) ...
Unpacking replacement overlay-scrollbar-gtk3:amd64 ...
dpkg: error processing /var/cache/apt/archives/overlay-scrollbar-gtk3_0.2.16+r357-0ubuntu1.1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/gtk-3.0/modules', which is also in package libcanberra-gtk3-module:amd64 0.29-0ubuntu2
Errors were encountered while processing:
 /var/cache/apt/archives/libgtk-3-0_3.6.0-0ubuntu3.2_amd64.deb
 /var/cache/apt/archives/overlay-scrollbar-gtk3_0.2.16+r357-0ubuntu1.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Here's the output for apt-cache policy for all packages concerned: pastebin d3YcjPmJ. All seem to be from the official quantal and quantal-updates release channel and an official mirror.

I've also tried sudo apt-get -f install, sudo apt-get dist-upgrade and sudo apt-get clean && sudo rm -r /var/cache/apt/archives/, but all lead to the same error.


Ok, if you are still experiencing this problem, it happens because some package won't work if the versions of their peers aren't the same.

libgail-3-0 : Depends: libgtk-3-0 (= 3.6.0-0ubuntu3.2) but 3.6.0-0ubuntu3.1 is installed
libgtk-3-0 : Depends: libgtk-3-common (= 3.6.0-0ubuntu3.1) but 3.6.0-0ubuntu3.2 is installed
libgtk-3-bin : Depends: libgtk-3-0 (>= 3.6.0-0ubuntu3.2) but 3.6.0-0ubuntu3.1 is installed

As you can see libgail-3-0 requires libgtk-3-0 to be 3.6.0-0ubuntu3.2 but libgtk-3-0 requires libgtk-3-common to be 3.6.0-0ubuntu3.1 a diference of .1 versions. So, since libgtk-family can't be of different versions, apt-get gets an expectacular dependency error. So how to solve this? We use the hold package status:

echo "libgtk-3-bin hold" | sudo dpkg --set-selections
echo "libgtk-3-0 hold" | sudo dpkg --set-selections

With this, you can upgrade normally until the dependency conflicts get resolved in the Ubuntu repositories.

Once you feel that you can allow upgrades, just run:

echo "libgtk-3-bin install" | sudo dpkg --set-selections
echo "libgtk-3-0 install" | sudo dpkg --set-selections

Another option is to force versions to being installed:

sudo apt-get update
sudo apt-get install libgtk-3-0=3.6.0-0ubuntu3.1 libgtk-3-common=3.6.0-0ubuntu3.1 libgtk-3-0=3.6.0-0ubuntu3.1

This will tell apt-get to install everything using the same version number.