rpmdb: Lock table is out of available locker entries

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!

37 Responses

  1. [...] did some research, and I found this guy’s website. Very helpful indeed, and a fellow RHCE. His tips did the trick. I’m going to spell [...]

  2. Glad I was able to help!

  3. It’s really helpful. :-)

  4. Thanks! That helped me too! Great description and solve of the problem!

  5. [...] source: Racker Hacker [...]

  6. This tip is very helpful

  7. hi,
    worked very good with me

    thanks alot

  8. Worked fine!!

    Thanks

  9. Another thanks from me!

  10. Thanks from me as well :-)

  11. Did the job for me as well, thanks!

  12. [...] So, what to do? Google, of course! Fortunately, major over at Racker Hacker encountered this same issue about a year and a half ago and has already provided the fix for us: [...]

  13. I’m really glad to hear that this fix has helped so many people!

  14. Great stuff, thank you very much. Saved my day :D

  15. You the man. Many thanks.

  16. Great!! Now it works! :-)

  17. Thanks Major, great stuff!! Now back to the original problem I was trying to solve….

  18. Precious major :)

  19. Did the trick, thanks!

  20. Thanks a lot for this, saved me a lot of time !

  21. Thank you!

  22. Thanks for all of the feedback! I’m glad I was able to help everyone out of this annoying situation!

  23. u rock!! fixing my stressful yum server

  24. Thanks.. Solved the problem.. unlike the gits over at CPanel.net….

  25. Thanks for this article, help fixed the problem for me :)

  26. Thanks a lot ! You saved another guy ! ;-)

  27. and herein lies why i hate rpm distros, oh well, at least its an easy fix!

  28. @Trophaeum:

    Because other package management tools don’t use DBs that could have locking issues?

  29. “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.

  30. Thanks a lot it helps me a lot :)

  31. muchas gracias desde chile. thanks

  32. Thx! this really helps

  33. 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!

  34. Many thanks, you saved my night :)

    Daniel

  35. [...] 參考來源 : rpmdb: Lock table is out of available locker entries [...]

  36. 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!

  37. 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.

Leave a Reply