Tuesday, 9 February 2016

Recover corrupt rpm database on RHEL/Centos/Fedora

First thing take a backup of the existing rpm database. This is located in /var/lib/rpm. Depend on used distribution:

Now go to that dir /var/lib and take a backup of entire rpm dir as below:

[root@linuxcnf ~]# tar –cvzf rpm db.tar.gz rpm

And start rebuilding the rpm database likes below:

[root@linuxcnf ~]# cd /var/lib/rpm

[root@linuxcnf ~]# rm –f __db*   #Delete the present database

[root@linuxcnf ~]# rpm –rebuilddb –vv

Now once the above command finished work.  Then update rpm and other packages

[root@linuxcnf ~]# yum update

[root@linuxcnf ~]# yum install <package name>

[root@linuxcnf ~]# rpm –qa <package name>

Please check logs in case it spitting out other massages.

No comments:

Post a comment