Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

1 Answer 1

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:

{ "verifydb", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR|POPT_ARGFLAG_DOC_HIDDEN),
    &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 at 16:53

Your Answer

 
discard

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.