Troubleshoot problem with yum update and rebuild the rpm database

I have created a step by step approach to troubleshoot a problem with performing yum update and how to rebuild the rpm database.

I received and error while trying to update the Redhat Enterprise 5 server kernel using yum update. Looking at the output of yum update it seems that the dependency mkinitrd was missing.

# yum update
Loaded plugins: rhnplugin, security
Skipping security plugin, no data
Setting up Update Process
Resolving Dependencies
Skipping security plugin, no data
–> Running transaction check
—> Package kernel.i686 0:2.6.18-238.5.1.el5 set to be installed
–> Processing Dependency: mkinitrd >= 4.2.21-1 for package: kernel
–> Finished Dependency Resolution
kernel-2.6.18-238.5.1.el5.i686 from rhel-i386-server-5 has depsolving problems
–> Missing Dependency: mkinitrd >= 4.2.21-1 is needed by package kernel-2.6.18-238.5.1.el5.i686 (rhel-i386-server-5)
Error: Missing Dependency: mkinitrd >= 4.2.21-1 is needed by package kernel-2.6.18-238.5.1.el5.i686 (rhel-i386-server-5)
You could try using –skip-broken to work around the problem
You could try running: package-cleanup –problems
package-cleanup –dupes
rpm -Va –nofiles –nodigest

I tried the suggested fix by running the commands package-cleanup. But that did not resolve the problem. I then tried clear all yum cache and to re-synch with the Red Hat Network Satellite server. But yum update failed with the same error.

# rm -rf /var/cache/yum/*
# yum clean all
# rhn-profile-sync
# yum update

The next logical thing to do was to check and see if mkinitrd was installed, and it was.

# rpm -q mkinitrd
mkinitrd-5.1.19.6-68.el5

Now I was really puzzled, if the dependency was installed then was it healthy? Using the rpm –Va command I found out that mkinitrd was missing the dependency nash.

# rpm -Va mkinitrd
Unsatisfied dependencies for mkinitrd-5.1.19.6-68.el5.i386: config(mkinitrd) = 5.1.19.6-68.el5, nash = 5.1.19.6-68.el5, mkinitrd

Following the trail, I checked to see if nash was installed, and it was.

# rpm –q nash
nash-5.1.19.6-68.el5

Is nash healthy? No result means no fault found.

# rpm -Va nash

If mkinitrd claims that it is dependent on nash, then checking to see what requires nash should result in mkinitrd. But I did not receive any result back on the check.

# rpm -q –whatrequires nash

Now I was stumped, if mkinitrd says that it was dependant on nash, then why is nash not reporting that mkinitrd requires it? Using the rpm –q –whatrequires I checked to see what required mkinitrd.

# rpm -q –whatrequires mkinitrd
mkbootdisk-1.5.3-2.1
system-config-kdump-1.0.14-4.el5
kernel-2.6.18-194.17.1.el5

I compared the result of rpm –q –whatrequires nash to different installation of Redhat. Below is what the result should be.

# rpm -q –whatrequires nash
mkinitrd-5.1.19.6-68.el5

To sum it up, the kernel cannot be updated because it is missing the dependency mkinitrd. Mkinitrd is installed but not healthy because it is missing the dependency nash. Nash is installed and healthy which contradicts the former statement. Therefore there is nothing wrong with mkinitrd or nash, the problem then lies with the yum cache or rpm database. I already ran yum clean all to clear all yum cache and headers, it did not resolve the issue. The logical answer is that the rpm database is corrupted and requires a rebuild.

It may be beneficial to backup the current rpm databases before deleting. The rpm database are in /var/lib/rpm. It is also recommended that rebuidling be done in single user mode, although I did it successfully in init 3 run level.

Delete the lock files.

# rm –f /var/lib/rpm/__db*

Rebuild the database

# rpm –rebuilddb

You can also use the -vv option for verbose mode.

# rpm -vv –rebuilddb

About Andrew Lin

Hi, I have always wanted to creat a blog site but never had the time. I have been working in Information Technology for over 15 years. I specialize mainly in networks and server technologies and dabble a little with the programming aspects. Andrew Lin

View all posts by Andrew Lin →

Leave a Reply

Your email address will not be published. Required fields are marked *