Handling RPM "dependency hell"

An easy way to install RPMs along with associated dependencies is to use yum (Yellow dog Updater, Modified) or apt for RPM. Of the two products, I would recommend using yum, as it has a smaller code base than apt for RPM, it is written in python (similar to Red Hat's anaconda installer), and it makes upgrading to new Red Hat releases relatively easy (apt for RPM has a dist-upgrade feature, but I have never tried it).

Red Hat Linux's up2date command will also install Red Hat's RPMs along with dependencies. However, up2date is not as flexible in incorporating third-party RPMs, such as those at freshrpms.net.


Older notes on apt for RPM

The following instructions will install apt from freshrpms.net with Red Hat Linux 8.0.

rpm -Uvh http://ftp.freshrpms.net/pub/freshrpms/psyche/apt/apt-0.5.4cnc9-fr1.i386.rpm

Update the list of available RPMs:
apt-get update

Upgrade your system to the latest package versions:
apt-get upgrade

I run apt-get update and apt-get upgrade daily on non-critical systems. Although I think Red Hat's quality assurance with updated packages is outstanding, you may not wish to upgrade RPMs automatically on a production system.

Root crontab entry to update your system daily:
# Update system
0 4 * * * /usr/bin/apt-get update && /usr/bin/apt-get upgrade -y

Search for installable packages with a regular expression (regex):
apt-cache search regex

Install a package and associated dependencies:
apt-get install package

Remove a package:
apt-get remove package

Display information about a package:
apt-cache show package

If you see "The following packages have been kept back" when running apt-get upgrade, it means that an additional package needs to be installed in order to upgrade the package. Run apt-get -f install package to upgrade the package.

Example:

The following packages have been kept back
  iptables perl

# apt-get -f install iptables perl
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
  kernel#2.4.20-20.7 perl-CGI perl-CPAN perl-DB_File perl-NDBM_File
  perl-suidperl
The following packages will be upgraded
  iptables perl
The following NEW packages will be installed:
  kernel#2.4.20-20.7 perl-CGI perl-CPAN perl-DB_File perl-NDBM_File
  perl-suidperl
2 packages upgraded, 6 newly installed, 0 removed and 1 not upgraded.
Need to get 20.6MB of archives.
After unpacking 33.2MB of additional disk space will be used.
Do you want to continue? [Y/n] Y


Older notes on rpmdb-redhat package

The above procedure works well if the RPM is part of the Red Hat Linux distribution or a third-party package maintainer like freshrpms.net. However, if you are installing an RPM from another source, you may have to manually determine which packages satisfy dependencies.

Note: the following example was written when using Red Hat Linux 7.2.

First of all, make sure you have the rpmdb-redhat package installed:
 
rpm -q rpmdb-redhat
rpmdb-redhat-7.2-0.20010924

If you do not have the package installed, install it using apt with apt-get install rpmdb-redhat.

In this example, I will install the Cheops RPM from ftp://ftp.marko.net/pub/cheops/RPMS/cheops-0.59a-1.i386.rpm

First, I'll use rpm -Uvh to install the RPM:
 
rpm -Uvh cheops-0.59a-1.i386.rpm
error: failed dependencies:
libgdk.so.1 is needed by cheops-0.59a-1
libglib.so.1 is needed by cheops-0.59a-1
libgtk.so.1 is needed by cheops-0.59a-1

In this case, I am missing three dependencies (shared libraries) necessary for installing the cheops RPM. We can use RPM's --redhatprovides flag to determine which Red Hat-supplied RPMs would satisfy these dependencies:

rpm --redhatprovides libgdk.so.1
gtk+10-1.0.6-10
rpm --redhatprovides libglib.so.1
glib10-1.0.6-10
rpm --redhatprovides libgtk.so.1
gtk+10-1.0.6-10

The missing dependencies are contained within the gtk+10 and glib10 RPMs. Install the two RPMs with the apt-get install gtk+10 glib10 command.

Verify that the packages are installed:
 
rpm -q glib10 gtk+10
glib10-1.0.6-10
gtk+10-1.0.6-10

We can now install the Cheops RPM:
rpm -Uvh cheops-0.59a-1.i386.rpm
Preparing... ########################################### [100%]
1:cheops ########################################### [100%]

Back to brandonhutchinson.com.

Last modified: 11/04/2003