If the previous installation attempt is terminated abruptly or failed due to unexpected error, the rpm tool fails to remove database locks. Then on, attempt of a new rpm installation fails due to the stale database locks.
In the worst case scenario, rpm command misbehaves like hangs, segmentation faults. In all these cases, you should first manually remove any stale locks present in “/var/lib/rpm” directory.
[root@techpulp ~]# rm -f /var/lib/rpm/__db*
If you still face the same problem, your rpm database is corrupted and it is time to rebuild or repair your database. However beforeyou attempts to rebuild the database, you must first take a backup of existing database.