Dave's Brain

Browse - computer tips - restore corrupt rpm database

Date: 2009nov20
OS: RedHat, Fedora, CentOS

Q.  Oh no! my rpm database is corrupt and rpm and not do anything.
How can I recover it?

A.  The first thing to try is:

	rpm --rebuilddb

But if that doesn't work, as a last resort you can notice that
almost every package makes a folder in /usr/share/doc
Doing:

	ls /usr/share/doc

is almost the same as using rpm to list your current packages!
So again, as a last restore (don't blame me if it blows up your machine),
you can do:

	rpm --initdb

	cd /usr/share/doc

	yum install `/bin/ls`

I actually did this once and it didn't turn out too badly.
If you find out a better way please leave a comment.
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2010, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.