Here is a python script that can analyse a rpmdb and also help
determining the status of an installed machine:
- /var/lib/rpm/Packages contains all data, the other rpmdb
files contain duplicate data for easier access.
/var/lib/rpm/Packages is checked against the data in the
other files.
- rpm header have a sha1 checksum for most of the data. With
some nifty lookup you can verify this sha1 sum and thus most
of the data to not be corrupted.
- A few smaller checks can be done like dependency checking,
are packages with an unusual arch installed, which non-kernel
packages have more than one package installed etc.
- You can choose to check rpmdb against yum repositories to
check which installed packages are not included in yum repos
or which packages differ in rpmdb.
- You can even check rpmdb files from other archs or copy them
from some other machine to verify them. All checks work for
non-root users.
The python script is available at
http://people.redhat.com/laroche/pyrpm/pyrpm.py
You can call it with:
./pyrpm.py --checkrpmdb
or for the more advanced yum repositories check (you then need
urlgrabber and libxml2-python to be installed):
./pyrpm.py -c /etc/yum.conf --checkrpmdb
Let me know if you have questions about this tool, have ideas
about further checks that can be added or have problems using
it. (Especially if you have real broken rpmdb files on some of
your machines, I'd like to hear if some checks could be improved. ;-)
greetings,
Florian La Roche