If up2date throws some horrible Python errors and rpm says "rpmdb: Lock table is out of available locker entries", you can restore your system to normality with the following:
The errors:
rpmdb: Lock table is out of available locker entries error: db4 error(22) from db->close: Invalid argument error: cannot open Packages index using db3 - Cannot allocate memory (12) error: cannot open Packages database in /var/lib/rpm
Make a backup of /var/lib/rpm in case you break something:
tar cvzf rpmdb-backup.tar.gz /var/lib/rpm
Remove the Berkeley databases that rpm uses:
rm /var/lib/rpm/__db.00*
Make rpm rebuild the databases from scratch (may take a short while):
rpm --rebuilddb
Now, check rpm to make sure everything is okay:
rpm -qa | sort
Why does this happen?
When rpm accesses the Berkeley database files, it makes temporary locker entries within the tables while it searches for data. If you control-c your rpm processes often, this issue will occur much sooner because the locks are never cleared.
Update: As of February 2009, this post received five times the visits of my next most popular post. This situation must happen very often!












Glad I was able to help!
It's really helpful.
Thanks! That helped me too! Great description and solve of the problem!
This tip is very helpful
hi,
worked very good with me
thanks alot
Worked fine!!
Thanks
Another thanks from me!
Thanks from me as well
Did the job for me as well, thanks!
I'm really glad to hear that this fix has helped so many people!
Great stuff, thank you very much. Saved my day
You the man. Many thanks.
Great!! Now it works!
Thanks Major, great stuff!! Now back to the original problem I was trying to solve....
Precious major
Did the trick, thanks!
Thanks a lot for this, saved me a lot of time !
Thank you!
Thanks for all of the feedback! I'm glad I was able to help everyone out of this annoying situation!
u rock!! fixing my stressful yum server
Thanks.. Solved the problem.. unlike the gits over at CPanel.net....
Thanks for this article, help fixed the problem for me
Thanks a lot ! You saved another guy !
and herein lies why i hate rpm distros, oh well, at least its an easy fix!
@Trophaeum:
Because other package management tools don't use DBs that could have locking issues?
"tar cvzf rpmdb-backup.tar.gz /var/lib/rpm"
Now which file(s) do I delete that I backed up? Is it...
__db.001
__db.002
__db.003
Thanks.
Thanks a lot it helps me a lot
muchas gracias desde chile. thanks
Thx! this really helps
Thanks for the fix, I'm not sure if this was the case with other people, and the reason why it started showing up more frequently recently, but my server uptime is nearing 3 years and this problem just showed up. Could be totally unrelated!
Many thanks, you saved my night
Daniel
Thanks for this, fixed one of our servers that was failing to run a cPanel EasyApache update. Tips like these are invaluable to desperate Googlers!
A long time ago on a much older version of RedHat (7.x or 8.x series I think), this would happen quite often and you'd have to rebuild the database all the time. For a while, its been fine, now suddenly I'm running into this problem again on RHEL 5 systems. Maybe its a bug regression or something.
If you have to implement a published change in time and you suddenly face
this problem you are very happy, indeed, to find this working solution.
Thanks a lot
RHEL Sucks but Rackerhacker r0x it. Thanks for the tip.
thanks for the tip!
Wow, I'm really glad I wrote this post.
Brilliant! Thank you!
Brilliant! Helped in avoiding a complete reinstall!...
Thank you for posting this helpful workaround, but this seems an unacceptable flaw in the RPM/YUM stack.
Why YUM and/or RPM can't simply remove the stale entries in this Lock table before the RPM DB becomes unusable is beyond me...
working for me too ! thanks a lot !
Yay! Thank you very much! Yum sucks really hard.
picca - Glad I could help.
The actual culprit is rpm, but it manifests itself in yum since yum relies on rpm to operate.
Thanks saved me alot of head scratching.
I can see you've heard this before, but thanks for the wisdom. You rock! Worked like a charm.
Thanks, that was really helpful...
Thanks dude,
It was really Helpfull