2

Yes, You read it right i actually want to corrupt RPMDB for testing purpose. I tried Googling it but all i got was to, how to rebuild it.

So at last i tried

rpm --rebuilddb

and killed the process in execution.

Then i verified by

usr/lib/rpm/rpmdb_verify /var/lib/rpm/Packages
echo $?
0

I need it output 1. which means that RPMDB is corrupt

1
  • 4
    Can't you just open it with a hex editor and change some bytes around?
    – Minix
    Commented May 8, 2015 at 10:55

1 Answer 1

0

I just corrupted my rpm database intentionally, or at least made it so rpm errors out, which is what I wanted to accomplish. Just zero out the __db.00* files.

# ls -l /var/lib/rpm/__db.00*
-rw-r--r-- 1 root root 0 Jan 15 17:13 /var/lib/rpm/__db.001
-rw-r--r-- 1 root root 0 Jan 15 17:13 /var/lib/rpm/__db.002
-rw-r--r-- 1 root root 0 Jan 15 17:13 /var/lib/rpm/__db.003

# rpm -q filesystem
error: db5 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages index using db5 - Resource temporarily unavailable (11)
error: cannot open Packages database in /var/lib/rpm
error: db5 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages database in /var/lib/rpm
package filesystem is not installed

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .