[Rpm-maint] How to "repair" /var/lib/rpm/Packages

Paul Nasrat pnasrat at redhat.com
Tue Mar 20 12:31:53 UTC 2007

On Mon, 2007-03-19 at 22:14 -0500, Zachary_Reneau at Dell.com wrote:
> Hi All,

Please note this is a list intended for development.

If you have a support contract you probably should to contact them to
assist in the recovery.

> I'm having an issue where 'rpm -qa' returns only a couple packages,
> not the full list of installed RPMs. I've
> done /usr/lib/rpm/rpmdb_verify, rpmdb_load, rpmdb_dump, rpm --initdb,
> rpm --rebuilddb and all that good stuff. It seems clear that there is
> nothing "wrong" with rpm, only that the list of installed RPMs is
> gone…

What exact process did you follow?  The process here is fairly well


If rpm is reporting that it only knows a few packages then you may have
to recreate the db.  Did you back up the "broken" rpmdb before taking
any action?  If so can you restore and repeat recovery with the above
instructions to see if is more complete.

If you do not have a backup still check you have a
valid /var/log/rpmpkgs logfile, copy that file to a working dir - eg

mkdir /var/tmp/recoverdb
cp /var/log/rpmpkgs /var/tmp/recoverdb
You'll have to get all the matching packages listed and place them in
the dir, you may be able to do this with yum-downloader or up2date.
cd /var/tmp/recoverdb
rpm -ivh --noscripts --notriggers --justdb rpmpkgs

This should use the pkg list as a manifest to RPM and just install the
headers to the db.


More information about the Rpm-maint mailing list