A broken rpmdb can happen when packages are updated outside of rpm / yum being notified and therefore the rpmdb being in an inconsistent state or if the partition where your rpmdb resides runs out of disk space.
This is the error I'm getting:
error: rpmdb: BDB0113 Thread/process 6245/139652028413760 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
Fixing it is very simple. First, create a backup of the current rpmdb just in case things go sideways:
[root@server ~]# tar -cvpJf /var/tmp/rpmdb_$(date +%F).tar.xz /var/lib/rpm/__db.*
Now that you have a backup, remove the rpmdb files:
[root@server ~]# rm -f /var/lib/rpm/__db.*
With the rpmdb deleted, go ahead and rebuild rpm's db:
[root@server ~]# rpm --quiet -qa
[root@server ~]# rpm --rebuilddb
After the rebuild is done, clear the cache to ensure no old cruft is causing errors:
[root@server ~]# dnf clean all
[root@server ~]# rm -rf /var/cache/dnf
Rerun the transaction that was causing the errors in the first place:
[root@server ~]# dnf -y --refresh update
The transaction should now go through and dnf / rpm should work as expected.
Feel free to comment and / or suggest a topic.
Comments
Post a Comment