RPM Database Indices Corrupt

In response to the error message

error: cannot open Packages database in /var/lib/rpm
error: cannot open Packages index using db3 - Invalid argument (22)
error: db4 error(22) from dbenv->open: Invalid argument
no packages
rpmdb: Program version 4.2 doesn't match environment version

do

mv /var/lib/rpm/__* /tmp ; rpm --rebuilddb

The database indices have become unreadable, for the reason given, and need to be rebuilt. In the above command we move the previous versions to /tmp and allow them to be deleted later if they aren’t needed. Wildcats and BOFHs may wish to simply rm(1) the indices.

2 Comments

  1. Hi,
    Just wanted to thankyou for this tip I found via google. On RHEL 3 AS it fixed my issue but the Database to move is under /var/lib/rpm.

    Cheers Chris

    Sydney Australia

Comments are closed.