
Before I get to the problem, here’s the interesting part. If you list the files in /var/lib/rpm/ you will see the flat berkeley database files, but not all of them. And I didn’t notice there was one missing until I went to fix it. I’m not sure what caused/causes this, but I found a pretty simple solution.
I googled this problem before I tried to fix it, and I found some old posts here and there about manually rebuilding the database should be used only after rebooting because it should correct itself after you delete the database files. I think it just runs the rebuild for you if you don’t do it yourself. I didn’t have any problems with my method, but your mileage may vary.
[root@desktop01 ~]# yum
rpmdb: Thread/process 2407/3079034560 failed: Thread died in Berkeley DB library
error: db4 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 - (-30974)
error: cannot open Packages database in /var/lib/rpm
/usr/lib/python2.6/site-packages/yum/config.py:884: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
raise Errors.YumBaseError(”Error: ” + e.message)
CRITICAL:yum.main:Error: rpmdb open failed
[root@desktop01 ~]#
If you delete the __db files in /var/lib/rpm/ and rebuild the database, it seems to be fine. But check out that empty file __db.000
[root@desktop01 ~]# rm /var/lib/rpm/__db*
rm: remove regular empty file `__db.000′? y
rm: remove regular file `__db.001′? y
rm: remove regular file `__db.002′? y
rm: remove regular file `__db.003′? y
rm: remove regular file `__db.004′? y
[root@srv01 rpm]# rpm –rebuilddb
[root@desktop01 ~]#
After running yum at least once, the _db files will be there again, but not __db.000, so I don’t know what happened or why, but there, I fixed it.
[root@desktop05 rpm]# rm __db.000
rm: cannot remove `__db.000′: No such file or directory
[root@desktop05 rpm]#