I am getting the below errors while executing the yum or rpm command. **error: rpmdb: BDB0113 Thread/process 22448/139817567954752 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: Error: rpmdb open failed** I believe this was happening because of corrupted RPM DB. I have tried to execute yum or rpm commands after rebuilding the RPM database. On that time, it works properly. But after some days, the same error occurs again Let me know how to fix this permanently. Thanks in Advance, You can remove the corrupted RPM database and rebuild with the following commands. First, make a backup just in case: ``` mkdir /tmp/rpm-backup cp -a /var/lib/rpm/__db* /tmp/rpm-backup/ ``` Remove the old database: ``` rm -fv /var/lib/rpm/__db.[0-9]* ``` Clean and rebuild the rpm database: ``` rpm --quiet -qa rpm --rebuilddb yum clean all ``` As the db is often corrupted by an interrupted or failed package install, you may also want to run: ``` rm -rf /var/cache/yum ``` The above will free up any space taken by orphaned updates. ## Sources [redhat - Red Hat - Berkeley DB library - Corrupted DB - Server Fault](https://serverfault.com/questions/1035305/red-hat-berkeley-db-library-corrupted-db)