To fix the issue do below
# killall -9 rpm
# ls -ltr
rpm -vv --rebuilddb
That is two underscore "_" characters before the "*" in the above command. You should be prompted if you want to delete the following files:
/var/lib/rpm/__db.001
/var/lib/rpm/__db.002
/var/lib/rpm/__db.003
Once the rebuild complete you will be able to run your commands succesfully .
I got below error while doing a rebuild
ReplyDeleterpm -vv --rebuilddb
D: rebuilding database /var/lib/rpm into /var/lib/rpmrebuilddb.20973
D: creating directory: /var/lib/rpmrebuilddb.20973
D: opening old database
D: opening database mode 0x0 in /var/lib/rpm
failed to open /var/lib/rpm/packages.rpm: No such file or directory