Copyright 2021 Simon Quantrill, All Rights Reserved

Failed RPM database

Tue 13 January 2015

RPM database screwed RPM the package manager of Red Hat sometimes goes a bit wierd, the database becomes bad the way to clear it is as such: A simple check for the database is:

rpm -qa –qf ‘%{name}-%{version}-%{release}.%{arch}.rpm\n’

If this fails to complete or hangs then it is a good guess that the RPM database is corrupted follow the below procedure.

  1. First take a backup of the rpm database

cd /var/lib

tar cvf rpmbackup.tar

gzip rpmbackup.tar

  1. Try first to rebuild the database (you can go direct to step 3! if you don’t have much time or enjoy rpm)

rpm -vv —rebuilddb

  1. In the event that this hangs or fails

rm -f __db*

rpm -vv —rebuilddb

DO NOT remove any of the other files in the rpm directory otherwise you have a really big problem as you will have to re create the rpm database and the installed packages will be lost this is not a good situation to be in!!!

on the top