fixing rpmdb error on fedora 27

dnf is a default command line to manage software on newer versions of fedora,in some cases when we kill the dnf process or an upgrade is interrupted there is a possibility of rpmdb currouption.

on my laptop when i killed the dnf process and reran update it was showing error error: rpmdb: BDB0113 Thread/process 3874/139621429724480 failed to fix the issue we need to rebuld the rpmdb.

1.cause of issue (kill 9 signal to dnf process a good example why not to use kill 9)

kill -9 3874
[1]- Killed dnf upgrade -y

2.Update the application cache

#dnf update -y

error: rpmdb: BDB0113 Thread/process 3874/139621429724480 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

Rebuilding rpm database with rpmdb

#sudo rpmdb --rebuilddb

Updating packages

#sudo dnf upgrade -y
Last metadata expiration check: 0:08:45 ago on Tue 13 Mar 2018 07:46:49 PM IST.
Dependencies resolved.
==============================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================
Upgrading:
cldr-emoji-annotation noarch 32.90.0_1-1.fc27 updates 3.8 M

Transaction Summary
==============================================================================================================================================================
Upgrade 1 Package