Reaching out to others! Free & Open Source Software, Kannada, L10n, L18n Data Science, Cloud Computing & more…

While working on Redhat based operating systems, its common to face few issues related to RPM. Rpm database gets corrupted. It might segfault, it might cause lots of issues while installing or updating packages.

First step to resolve RPM related issues is to rebuild the rpm database. This can be done by removing the __db files from /var/lib/rpm folder and then running the following command in console as root.

#rpm --rebuilddb

At times, this might not work and you might require some more verbose information. You can get it by adding -vv switch to above command as follows:

#rpm -vv --rebuilddb

Here is an example, I was not able to understand which package wass giving the following error.

#rpm --rebuilddb
error: rpmdbNextIterator: skipping h#909189228 blob size(11): BAD, 8 + 16 * il(1882857574) + dl(1769480289)

To identify the package, I had to run the same command in verbose mode to understand which package was resulting this error.

Following is the extract from the output which displayed the corrupted package.

adding “pure-ftpd” to Name index.
D: adding 46 entries to Basenames index.
D: adding “System Environment/Daemons” to Group index.
D: adding 17 entries to Requirename index.
D: adding 4 entries to Providename index.
D: adding 7 entries to Conflictname index.
D: adding 7 entries to Dirnames index.
D: adding 17 entries to Requireversion index.
D: adding 4 entries to Provideversion index.
D: adding 1 entries to Installtid index.
D: adding 1 entries to Sigmd5 index.
D: adding “3f19ec3bbf01667e0e7458df2c6d68f2765f91ba” to Sha1header index.
D: adding 46 entries to Filemd5s index.
error: rpmdbNextIterator: skipping h#909189228 blob size(11): BAD, 8 + 16 * il(1882857574) + dl(1769480289)
Killed

After looking at this, I thought of removing the above package to get it reinstalled. I did a query on the same package via rpm command

#rpm -qa  pure-ftpd

And found that the package has been installed humpty number of times. Again I ended up with an another issue here because I was unable to remove this package easily like any other rpm package.

To remove all the occurrences of the package from the RPM database, you can use the --allmatches switch as follows.

#rpm -e --allmatches --nodeps pure-ftpd

This command did work and successfully removed the package. Once this was taken care, packages started working fine. I was able to install other packages successfully.