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!


49 Comments on “rpmdb: Lock table is out of available locker entries”

You can track this conversation through its atom feed.

  1. RPM Database Rebuild at S C ^ 2 says:

    [...] 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. major says:

    Glad I was able to help!

  3. suvi says:

    It’s really helpful. :-)

  4. Schenker says:

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

  5. 6log » Blog Archive says:

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

  6. Aniraka says:

    This tip is very helpful

  7. CFusion says:

    hi,
    worked very good with me

    thanks alot

  8. CHernández says:

    Worked fine!!

    Thanks

  9. greenpossum says:

    Another thanks from me!

  10. Gael says:

    Thanks from me as well :-)

  11. Allen says:

    Did the job for me as well, thanks!

  12. evilrouters.net » Blog Archive » rpmdb: Lock table is out of available locker entries says:

    [...] 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. major says:

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

  14. Emil says:

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

  15. Jim says:

    You the man. Many thanks.

  16. Piero Bacarella says:

    Great!! Now it works! :-)

  17. Farid Saad says:

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

  18. informe says:

    Precious major :)

  19. Dario says:

    Did the trick, thanks!

  20. Sebastien says:

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

  21. eric greer says:

    Thank you!

  22. major says:

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

  23. bramvera says:

    u rock!! fixing my stressful yum server

  24. Cyber-Surfer says:

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

  25. Noob says:

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

  26. SagittariusA says:

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

  27. Trophaeum says:

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

  28. Kyle says:

    @Trophaeum:

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

  29. oilcanharry says:

    “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. Steph says:

    Thanks a lot it helps me a lot :)

  31. daniel says:

    muchas gracias desde chile. thanks

  32. wildbill says:

    Thx! this really helps

  33. Matt says:

    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. Daniel says:

    Many thanks, you saved my night :)

    Daniel

  35. rpmdb: Lock table is out of available locker entries says:

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

  36. Conchur says:

    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. Mark Krenz says:

    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.

  38. NOB says:

    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

  39. vaLntine says:

    RHEL Sucks but Rackerhacker r0x it. Thanks for the tip.

  40. tom3k says:

    thanks for the tip!

  41. major says:

    Wow, I’m really glad I wrote this post. :-)

  42. milano says:

    Brilliant! Thank you!

  43. Marco says:

    Brilliant! Helped in avoiding a complete reinstall!… ;-)

  44. Philip Lowman says:

    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…

  45. chussenot says:

    working for me too ! thanks a lot !

  46. picca says:

    Yay! Thank you very much! Yum sucks really hard.

  47. Major Hayden says:

    picca – Glad I could help.

    The actual culprit is rpm, but it manifests itself in yum since yum relies on rpm to operate. ;-)

  48. Gavin says:

    Thanks saved me alot of head scratching.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">