If one of the DB files is partially corrupted and it is still readable by /usr/lib/rpm/rpmdb_dump, you can reload the DB file and rebuild db.#tested in Centos 5.5
$ ls /var/lib/rpmBasenames __db.001 __db.003 Filemd5s Installtid Packages Provideversion Requireversion Sigmd5Conflictname __db.002 Dirnames Group Name Providename Pubkeys Requirename Sha1header Triggername$ file /var/lib/rpm/Packages/var/lib/rpm/Packages: Berkeley DB (Hash, version 8, native byte-order)
$cd /var/lib/rpm
If one of the DB files is completely corrupted and it is not readable by rpmdb_dump, you have to restore from backup,$rm -f __db*$mv Packages Packages.orig$/usr/lib/rpm/rpmdb_dump Packages.orig | /usr/lib/rpm/rpmdb_load Packages$/usr/lib/rpm/rpmdb_verify Packages#if you got this error: db_verify: PANIC: fatal region error detected; run recovery
#make sure /var/lib/rpm/__db.* are cleaned
#It is unlikely to rebuilddb if rpmdb_verify fails
$rpm -v –rebuilddb
$cd /var/lib/rpm
$cp Packages Packages.bak#simulate a damaged RPM DB file
$ >Packages$ cp Packages.bak Packages# Simply restoring from backup file won’t work
#file verification is successful
$ /usr/lib/rpm/rpmdb_verify Packages#but any rpm operation fails
$rpm -qaerror: rpmdbNextIterator: skipping h# 294 Header V3 DSA signature: BAD, key ID e8562897
#Even “rpm –rebuilddb” fails
$rm -f __db.*$rpm –rebuilddberror: rpmdbNextIterator: skipping h# 294 Header V3 DSA signature: BAD, key ID e8562897
#Notice the error about signature: BAD? The Pubkeys have to be cleaned as well.
$ mv Pubkeys Pubkeys.bak#all good after removing Pubkeys file, a new Pubkeys is generated automatically on “rpm –rebuilddb”
$ rm -f __db.*$ rpm –rebuilddb$ rpm -qa | head -2man-pages-2.39-15.el5_4bash-3.2-24.el5
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.