Previous Section  < Day Day Up >  Next Section

Recipe 3.13. Resolving Debian Dependency Conflicts

3.13.1 Problem

A program will not install because of dependency problems, or apt-get dist-upgrade leaves held packages behind and you need to clean them up.

3.13.2 Solution

There are several different commands to try; this recipe lists them in the order you should try them.

Suppose libpam-modules is the problem package, and it won't upgrade:

# apt-get install libpam-modules

...

The following packages have unmet dependencies:

  libpam-modules: Depends: libdb3 (>= 3.2.9-19.1) but 3.2.9-19 is to be installed

E: Broken packages

If you are running a mixed system, first try specifying the version:

# apt-get install -t stable libpam-modules

If that doesn't help, or you are not running a mixed system, try Debian's conflict resolver:

# apt-get -f install

Then run:

# dpkg —configure -a

Then run this one again:

# apt-get -f install

If it reports:

Reading Package Lists... Done

Building Dependency Tree... Done

0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

That means it failed. Next, test what happens if you delete the existing libpam-modules:

# apt-get remove —dry-run libpam-modules

Reading Package Lists... Done

Building Dependency Tree... Done

The following packages will be REMOVED:

  adduser adminmenu apache at base-config courier-imap courier-imap-ssl courier-pop 

courier-pop-ssl cron cupsys cupsys-driver-gimpprint dict-elements dict-foldoc dict-gcide 

dict-jargon dict-vera dict-wn dictd gdm2...

....

WARNING: The following essential packages will be removed

This should NOT be done unless you know exactly what you are doing!

  login libpam-modules (due to login)

In this instance, it's going to take almost a system rebuild to correct the dependency conflict. Most times, there are only a few packages involved. In that case, delete the least important ones first, until all dependency conflicts are resolved, and then reinstall any that are needed.

If apt-get -u dist-upgrade shows any held packages, it is best to eliminate them. Packages are held because of dependency conflicts that apt cannot resolve. Try this command to find and repair the conflicts:

# apt-get -o Debug::pkgProblemResolver=yes dist-upgrade

If it cannot fix the conflicts, it will exit with:

0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

Delete the held packages one by one, running dist-upgrade each time, until there are no more held packages. Then reinstall any needed packages. Be sure to use the —dry-run option, so that you are fully informed of consquences:

# apt-get remove —dry-run libsdl-perl

3.13.3 Discussion

These sorts of dependency conflicts are rare on single-release systems. Users of mixed systems run into them more often. The best prevention is to be very selective about what you install—when you first install Debian, take the time to select all the packages you want individually.

3.13.4 See Also

    Previous Section  < Day Day Up >  Next Section