Tuesday, January 02, 2018

Recovering from Currepted RPM Database

RPM Package
(Image Source: https://www.taringa.net/posts/linux/16751463/Crear-repositorio-de-paquetes-RPM-fedora.html)


I had to interrupted the DNF command in my Fedora 27 Workstation at very initial state. This ended up with corrupting RPM database with following output.

[root@localhost ~]# dnf update -y
error: rpmdb: BDB0113 Thread/process 2779/140691506923328 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
Error: Error: rpmdb open failed
[root@localhost ~]#


I used following commands to resolve issue.

Step 1: Move the corrupted database

[root@localhost ~]# mv /var/lib/rpm/__db* /tmp/
[root@localhost ~]#

Step 2: Rebuilding the RPM database

[root@localhost ~]# rpm --rebuilddb
[root@localhost ~]#

Step 3: Performing a cleanup

[root@localhost ~]# dnf clean all
106 files removed
[root@localhost ~]#


After these steps DNF is back to action.


No comments: