As a result of an intaller problem (see bug #6914), we wound up with a Redhat 6.1 system where the RPM database thought that a number of RPMs were installed twice (and when I say 'installed twice', I don't mean with seperate version numbers; I mean with identical version numbers and everything). It was remarkably hard and tedious to deal with the situation, because: - rpm --rebuilddb did nothing to clean up the duplicates - you cannot 'rpm -e' them; rpm reports that your attempt to remove them matches more than one thing. - rpm -Uvh --replacepkgs on such a duplicated RPM does not stamp out the duplication (although at least it doesn't make it worse) - there are no other good tools for dealing with this in the rpm arsenal that are obvious. To deal with this, we had to go through the tedious step of forcefully downgrading each RPM to the 6.0 version (which purged both entries, since they were from 6.1), and then upgrading it to the 6.1 version again. All just to play with the database. Rpm databases do become damaged from time to time. I think that rpm badly needs a better set of tools to deal with this than 'rpm --rebuilddb' (especially when it only deals with some things, and does nothing about others).
Rpm already has such tools: 1) Removing all occurences of a package (e.g. foo) in the database (no files deleted): rpm -e --allmatches --justdb foo 2) Adding just the header for a package to the database (no files added): rpm -i --justdb foo*.rpm In practice, using the tools is often more complicated than reinstalling everything.