
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]#
Hi i am facing the same problem , i an not able to install any rpm through rpm commands or yum .
when i run rpm -ivh package name i got below error :
error: can’t create transaction lock on /var/lib/rpm/__db.000
even i am not able to remove the /var/lib/rpm then __db.00* file
i got the below error :=
[root@Rajnish rpm]# rm -rf __db.00*
rm: cannot remove `__db.001′: Permission denied
rm: cannot remove `__db.002′: Permission denied
rm: cannot remove `__db.003′: Permission denied
[root@Rajnish rpm]#
i am using centos 5.4 for Detaill :-
uname -a
Linux Rajnish 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
any suggestion . how can i get out from here .
Check to make sure the files are not set immutable. If they are, then not even root can delete them.
$ lsattr __* -------------e- __db.000 -------------e- __db.001 -------------e- __db.002 -------------e- __db.003 -------------e- __db.004
If there’s an “i” in the mix with those dashes, then that file is immutable and you’ll need to remove the flag.
$ sudo chattr -i __db.004
You should not be using “-rf” for everything you delete. These db files are not directories, there’s no point in deleting recursively. The real problem is when you delete the wrong thing on accident and it starts recursively removing more stuff.
1:40 pm
Thanks, worked great :)