If you run yum update on your centOS and get an error like this:
1 2 3 4 |
rpmdb: Program version 4.2 doesn't match environment version error: db4 error(22) from dbenv->open: Invalid argument error: cannot open Packages index using db3 - Invalid argument (22) error: cannot open Packages database in /var/lib/rpm |
You can fix this eror with this command:
1. Check for processes holding the rpm database open:
1 |
lsof | grep /var/lib/rpm |
If it finds any, kill -9 them all.
2. Delete any temporary DB files:
1 |
rm -fv /var/lib/rpm/__* |
3. Rebuild your RPM database:
1 |
rpm --rebuilddb -v -v |
If you still have problems, a reboot is probably quickest, then repeat steps 2 and 3 above.