Debian – Unmet dependencies after using a backports repository

aptbackportsdebiandependencies

I have added a backport repository to apt's sources.list to get an application:

deb http://ftp.uk.debian.org/debian/ wheezy-backports main

Long story short: I did not manage to install the application properly so I gave up and removed that line from my sources.list.

But since then apt is a mess. For some reasons, gnome has been partially uninstalled in the process (I played with synaptic and aptitude and apparently made a mistake) but I can't reinstall it:

sudo apt-get install gnome

....

The following packages have unmet dependencies:
gnome : Depends: gnome-core (= 1:3.4+7+deb7u1) but it is not going to be installed
     Depends: nautilus-sendto (>= 3.0) but it is not going to be installed
     Depends: gimp (>= 2.8) but it is not going to be installed
     Depends: hamster-applet (>= 2.91.3) but it is not going to be installed
     Depends: gnome-applets (>= 3.4) but it is not going to be installed
     Recommends: browser-plugin-gnash but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I have tried (in many different orders):

apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get clean
apt-get -f install gnome
apt-get install -f
dpkg --configure -a

but none of these worked.

I have also run sudo dpkg --get-selections | awk '{if ($2 == "hold") print $0;}' to find out more about the held packages but it returns nothing.


EDIT 1 – additional information

$ sudo apt-get -f install

Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ sudo apt-cache policy gnome-core nautilus-sendto gimp hamster-applet gnome-applets gnome

gnome-core:
  Installed: (none)
  Candidate: 1:3.4+7+deb7u1
  Version table:
     1:3.4+7+deb7u1 0
        500 http://ftp.uk.debian.org/debian/ wheezy/main amd64 Packages
nautilus-sendto:
  Installed: (none)
  Candidate: 3.0.3-2+b1
  Version table:
     3.0.3-2+b1 0
        500 http://ftp.uk.debian.org/debian/ wheezy/main amd64 Packages
gimp:
  Installed: (none)
  Candidate: 2.8.2-2+deb7u1
  Version table:
     2.8.2-2+deb7u1 0
        500 http://ftp.uk.debian.org/debian/ wheezy/main amd64 Packages
        500 http://security.debian.org/ wheezy/updates/main amd64 Packages
        100 /var/lib/dpkg/status
hamster-applet:
  Installed: (none)
  Candidate: 2.91.3+git20120514.b9fec3e1-1
  Version table:
     2.91.3+git20120514.b9fec3e1-1 0
        500 http://ftp.uk.debian.org/debian/ wheezy/main amd64 Packages
gnome-applets:
  Installed: (none)
  Candidate: 3.4.1-3
  Version table:
     3.4.1-3 0
        500 http://ftp.uk.debian.org/debian/ wheezy/main amd64 Packages
gnome:
  Installed: (none)
  Candidate: 1:3.4+7+deb7u1
  Version table:
     1:3.4+7+deb7u1 0
        500 http://ftp.uk.debian.org/debian/ wheezy/main amd64 Packages

EDIT 2 – dpkg-l

~$ sudo dpkg -l gnome-core nautilus-sendto gimp hamster-applet gnome-applets gnome
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                              Version                       Architecture                  Description
+++-=================================================-=============================-=============================-=======================================================================================================
rc  gimp                                              2.8.2-2+deb7u1                amd64                         The GNU Image Manipulation Program
un  gnome                                             <none>                                                      (no description available)
un  gnome-applets                                     <none>                                                      (no description available)
un  nautilus-sendto                                   <none>                                                      (no description available)
dpkg-query: no packages found matching gnome-core
dpkg-query: no packages found matching hamster-applet

EDIT 3 – apt-get policy

$ sudo apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg/main amd64 Packages
     release o=apt.postgresql.org,a=wheezy-pgdg,n=wheezy-pgdg,l=PostgreSQL for Debian/Ubuntu repository,c=main
     origin apt.postgresql.org
 500 http://www.deb-multimedia.org/ testing/non-free amd64 Packages
     release v=None,o=Unofficial Multimedia Packages,a=testing,n=jessie,l=Unofficial Multimedia Packages,c=non-free
     origin www.deb-multimedia.org
 500 http://www.deb-multimedia.org/ testing/main amd64 Packages
     release v=None,o=Unofficial Multimedia Packages,a=testing,n=jessie,l=Unofficial Multimedia Packages,c=main
     origin www.deb-multimedia.org
 500 http://downloads-distro.mongodb.org/repo/debian-sysvinit/ dist/10gen amd64 Packages
     release v=dist,o=10gen,a=10gen,n=dist,l=10gen,c=10gen
     origin downloads-distro.mongodb.org
 500 http://security.debian.org/ wheezy/updates/main Translation-en
 500 http://security.debian.org/ wheezy/updates/main amd64 Packages
     release v=7.0,o=Debian,a=stable,n=wheezy,l=Debian-Security,c=main
     origin security.debian.org
 500 http://ftp.uk.debian.org/debian/ wheezy/main Translation-en
 500 http://ftp.uk.debian.org/debian/ wheezy/main amd64 Packages
     release v=7.4,o=Debian,a=stable,n=wheezy,l=Debian,c=main
     origin ftp.uk.debian.org
Pinned packages:

Best Answer

After some discussion in chat, it became clear that the problem was that

apt-get install gnome

did not work on an apparently normal wheezy system. The install attempt exited with the errors given in the question.

The culprit turned out to be www.deb-multimedia.org. After removing the deb-multimedia lines from sources.list, the install proceeded successfully.

The problem was not that the deb-multimedia lines were in sources.list, but that the deb-multimedia were not at a lower priority. For anyone reading this, be aware that the deb-multimedia maintainer does not attempt to keep compatibility with Debian, so having those sources available at the same priority as the Debian archive may cause problems. More generally, this is a good defensive measure for any third party repositories which do not pin themselves at a lower priority server-side. Putting the deb-multimedia sources at a low priority like 1 should not cause any problems in normal usage. A stanza like

Package: *
Pin: origin www.deb-multimedia.org
Pin-Priority: 1

in /etc/apt/preferences should suffice.

Related Question