Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 4 down vote accepted

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.

share|improve this answer
Awesome! Thanks. – eewanco Aug 6 '14 at 16:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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