I need to verify that the RPM database (not an RPM, the database in /var/lib/rpm) is not corrupt or inconsistent, in a manner suitable for scripting (i.e. will return exit code 0 if good and something else if corrupt). I can use db_verify to verify the individual Berkeley databases, but suppose the individual Berkeley databases are totally valid and the inconsistency is across databases. I experimented by deleting (renaming) a database, and rpm -qa --dump was oblivious and rpm -Va just regenerated it with a warning. I suppose I could look for the string "warning:" in the output, but that seems unreliable. Besides I don't really want to verify the files, I want to verify the database. I've searched for OpenSuSE RPM-related packages and found nothing apropos. Any suggestions? I'd prefer something designed to do a thorough verification as opposed to just a dump.

1 Answer 1


There's an undocumented --verifydb flag that's been around since at least rpm-4.1.

See rpm/rpmdb.c:

    &mode, MODE_VERIFYDB, N_("verify database files"), NULL},

So rpm --verifydb should do exactly what you're looking for.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.