Sunday, June 12, 2016

Linux : Yum rpmdb: damaged header Problem

While trying to get the latest chrome working on my machine, the yum process crashed. It just wouldn't work. first I tried to clean the yum cache.

[root@paragcentosvm ~]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning repos: base epel extras google-chrome updates
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@paragcentosvm ~]# 
but it did not seem to work. It would just show me the following error:
[parag@paragcentosvm:/home/parag/Downloads]sudo yum update firefox
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Update Process
Loading mirror speeds from cached hostfile
epel/metalink                                                                                                                                                | 4.8 kB     00:00     
 * base: centos.mirror.net.in
 * epel: epel.mirror.net.in
 * extras: centos.mirror.net.in
 * updates: centos.mirror.net.in
base                                                                                                                                                         | 3.7 kB     00:00     
http://centos.mirror.net.in/centos/6.8/os/x86_64/repodata/ad3a307dfd95da4d7a7aad136162378d18ead7271010822806902dfa3edb55f2-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 18 - "transfer closed with 4902072 bytes remaining to read"
Trying other mirror.
base/primary_db                                                                                                                                              | 4.7 MB     00:02     
epel                                                                                                                                                         | 4.3 kB     00:00     
epel/primary_db                                                                                                                                              | 5.8 MB     00:06     
http://centos.mirror.net.in/centos/6.8/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 18 - "transfer closed with 3435 bytes remaining to read"
Trying other mirror.
extras                                                                                                                                                       | 3.4 kB     00:00     
extras/primary_db                                                                                                                                            |  36 kB     00:00     
google-chrome                                                                                                                                                |  951 B     00:00     
google-chrome/primary                                                                                                                                        | 1.8 kB     00:00     
google-chrome                                                                                                                                                                   3/3
http://centos.mirror.net.in/centos/6.8/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 18 - "transfer closed with 3456 bytes remaining to read"
Trying other mirror.
updates                                                                                                                                                      | 3.4 kB     00:00     
updates/primary_db                                                                                                                                           | 732 kB     00:00     
error: rpmdb: damaged header #1703 retrieved -- skipping.
Resolving Dependencies
--> Running transaction check
---> Package firefox.x86_64 0:38.1.0-1.el6.centos will be updated
---> Package firefox.x86_64 0:45.2.0-1.el6.centos will be an update
--> Processing Dependency: nss >= 3.21.0 for package: firefox-45.2.0-1.el6.centos.x86_64
--> Processing Dependency: nspr >= 4.11.0 for package: firefox-45.2.0-1.el6.centos.x86_64
--> Running transaction check
---> Package nspr.x86_64 0:4.10.8-1.el6_6 will be updated
--> Processing Dependency: nspr = 4.10.8-1.el6_6 for package: nspr-devel-4.10.8-1.el6_6.x86_64
---> Package nspr.x86_64 0:4.11.0-1.el6 will be an update
---> Package nss.x86_64 0:3.19.1-3.el6_6 will be updated
--> Processing Dependency: nss = 3.19.1-3.el6_6 for package: nss-sysinit-3.19.1-3.el6_6.x86_64
--> Processing Dependency: nss = 3.19.1-3.el6_6 for package: nss-devel-3.19.1-3.el6_6.x86_64
--> Processing Dependency: nss(x86-64) = 3.19.1-3.el6_6 for package: nss-tools-3.19.1-3.el6_6.x86_64
---> Package nss.x86_64 0:3.21.0-8.el6 will be an update
--> Processing Dependency: nss-util >= 3.21.0 for package: nss-3.21.0-8.el6.x86_64
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.21)(64bit) for package: nss-3.21.0-8.el6.x86_64
--> Running transaction check
---> Package nspr-devel.x86_64 0:4.10.8-1.el6_6 will be updated
---> Package nspr-devel.x86_64 0:4.11.0-1.el6 will be an update
---> Package nss-devel.x86_64 0:3.19.1-3.el6_6 will be updated
---> Package nss-devel.x86_64 0:3.21.0-8.el6 will be an update
--> Processing Dependency: pkgconfig(nss-util) >= 3.21.0 for package: nss-devel-3.21.0-8.el6.x86_64
---> Package nss-sysinit.x86_64 0:3.19.1-3.el6_6 will be updated
---> Package nss-sysinit.x86_64 0:3.21.0-8.el6 will be an update
---> Package nss-tools.x86_64 0:3.19.1-3.el6_6 will be updated
---> Package nss-tools.x86_64 0:3.21.0-8.el6 will be an update
---> Package nss-util.x86_64 0:3.19.1-1.el6_6 will be updated
---> Package nss-util.x86_64 0:3.21.0-2.el6 will be an update
--> Running transaction check
---> Package nss-util-devel.x86_64 0:3.19.1-1.el6_6 will be updated
---> Package nss-util-devel.x86_64 0:3.21.0-2.el6 will be an update
error: rpmdb: damaged header #1703 retrieved -- skipping.
error: rpmdb: damaged header #1703 retrieved -- skipping.
error: rpmdb: damaged header #1703 retrieved -- skipping.
To fix the issue I ran the following commands, to repair the corrupted yum  metadata files/db.

[parag@paragcentosvm:/home/parag]sudo rm -f /var/lib/rpm/__db*
[parag@paragcentosvm:/home/parag]sudo rpm --rebuilddb
[parag@paragcentosvm:/home/parag]
And everything just became normal again.

No comments:

Interview Question Preperation : Find longest subarray whose sum is equal to K

Software Engineering Practice interview question Given a array of N elements. Find the length of Longest Subarray whose sum is equal to give...