Wuuut, yum broke on my Centos 7 container ! For me this error :


error: rpmdb: BDB0113 Thread/process 10680/140044063065920 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Happened cause I ran out of memory, not completely OOM, but close enough to be an issue. (I had ~60mb free) I could not run any yum command, I tried yum clean all but that failed, also rpm –rebuilddb did not work. In the end I had to manually remove the databases and rebuild from scratch.  (it sounds worse than it is)

So first I moved the databases to a temp location

mv /var/lib/rpm/__db* /tmp

(I had 3, .001-.003) Then I did a clean all, that worked, and I finished off doing an update, that did quit allot of updates. (woops)

yum clean all
yum update -y

After I verified everything worked I cleaned up my tmp :

rm -i /tmp/__db*

Extra tip, finding what processess use most memory :

top -o %MEM

(mysql and php where the biggest RAM eaters)