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
dnf 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.