SUG: Automatic RPM database verification and repair

Jim Cornette fc-cornette at insight.rr.com
Thu Nov 30 03:18:51 UTC 2006


Tony Nelson wrote:
> I have written a script to automatically verify and repair the RPM database
> each day, called rpm_verify_db, at
> <http://georgeanelson.com/rpm-verifydb.htm>.
> 
> The RPM database is vital to the maintenace of Fedora or any Redhat-branch
> Linux.  Yum uses it for updates.  Nothing ever checks it for corruption,
> until RPM finally complains.  I personally could not upgrade to FC6 because
> of silent corruption, so I wrote this package.
> 
> RPM's developer, Jeff Johnson, believes that RPM database corruption is so
> extremely rare that it is not worth checking for, and he also notes that
> the check that I am using is inadequate.  It is, however, the best /check/
> available in RPM.  It can fail to detect problems that RPM may report when
> doing transactions that update the RPM database.  See the thread at
> Redhat's rpm-list, "SUG: Automatic RPM database verification and repair".
> 
> RPM may be able to rebuild the database if corruption is found (by RPM, or
> by my package, or by running "rpm --verifydb" by hand).  To rebuild the RPM
> database, run "rpm --rebuilddb" as root (which is what my package does).
> However, --rebuilddb simply rebuilds the database; it does not say whether
> there were errors in the old database, so it is not itself a /check/ of the
> database.


Thanks for the effort! I will try your package since running
rpm --verifydb just gave me a return of the below pasted error. This is 
on the development version for reference.

  rpm --verifydb
rpmdb: Page 3: hash page has bad prev_pgno
rpmdb: /var/lib/rpm/Group: DB_VERIFY_BAD: Database verification failed
error: db4 error(-30975) from db->verify: DB_VERIFY_BAD: Database 
verification failed
[root at cornette-dell-hdb ~]# locate __db
/var/lib/rpm/__db.000
/var/lib/rpm/__db.001
/var/lib/rpm/__db.002
/var/lib/rpm/__db.003
[root at cornette-dell-hdb ~]# rm /var/lib/rpm/__db*
rm: remove regular empty file `/var/lib/rpm/__db.000'? y
rm: remove regular file `/var/lib/rpm/__db.001'? y
rm: remove regular file `/var/lib/rpm/__db.002'? y
rm: remove regular file `/var/lib/rpm/__db.003'? y
[root at cornette-dell-hdb ~]# rpm --rebuilddb
[root at cornette-dell-hdb ~]# rpm --verifydb
[root at cornette-dell-hdb ~]#

Afterwards, it comes back clean.

Jim

-- 
Prototype designs always work.
		-- Don Vonada




More information about the users mailing list