How To Fix “Error: database disk image is malformed” On CentOS / Fedora

Today I have been trying to update my CentOS 6.5 virtual machine using command “yum update”.

# yum update

Sample output:

Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: centos.aol.in
 * epel: epel.mirror.net.in
 * extras: centos.aol.in
 * remi: mirror.smartmedia.net.id
 * remi-php55: mirror.smartmedia.net.id
 * rpmforge: mirrors.ispros.com.bd
 * rpmfusion-free-updates: mirror.smartmedia.net.id
 * rpmfusion-nonfree-updates: mirror.smartmedia.net.id
 * updates: centos.aol.in
Error: database disk image is malformed

I got a weird error “Error: database disk image is malformed” and my system didn’t get updated.

How do I solve this error?

It was very simple. After a couple of hours hunting for a solution, I got a working solution from Fedora Forums.

To get rid of this above error, enter the following command From Terminal:

# yum clean dbcache

Then I tried again to update the system with the command:

# yum update

Sample output:

Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: centos.aol.in
 * epel: epel.mirror.net.in
 * extras: centos.aol.in
 * remi: mirror.smartmedia.net.id
 * remi-php55: mirror.smartmedia.net.id
 * rpmforge: mirrors.ispros.com.bd
 * rpmfusion-free-updates: mirror.smartmedia.net.id
 * rpmfusion-nonfree-updates: mirror.smartmedia.net.id
 * updates: centos.aol.in
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package bind-libs.i686 32:9.8.2-0.17.rc1.el6_4.6 will be updated
---> Package bind-libs.i686 32:9.8.2-0.23.rc1.el6_5.1 will be an update
---> Package bind-utils.i686 32:9.8.2-0.17.rc1.el6_4.6 will be updated
---> Package bind-utils.i686 32:9.8.2-0.23.rc1.el6_5.1 will be an update
---> Package irqbalance.i686 2:1.0.4-6.el6 will be updated
---> Package irqbalance.i686 2:1.0.4-8.el6_5 will be an update
---> Package java-1.6.0-openjdk.i686 1:1.6.0.0-1.66.1.13.0.el6 will be updated
---> Package java-1.6.0-openjdk.i686 1:1.6.0.0-3.1.13.1.el6_5 will be an update
---> Package java-1.7.0-openjdk.i686 1:1.7.0.45-2.4.3.4.el6_5 will be updated
---> Package java-1.7.0-openjdk.i686 1:1.7.0.51-2.4.4.1.el6_5 will be an update
---> Package kernel.i686 0:2.6.32-431.5.1.el6 will be installed
---> Package kernel-firmware.noarch 0:2.6.32-431.3.1.el6 will be updated
---> Package kernel-firmware.noarch 0:2.6.32-431.5.1.el6 will be an update
---> Package kernel-headers.i686 0:2.6.32-431.3.1.el6 will be updated
---> Package kernel-headers.i686 0:2.6.32-431.5.1.el6 will be an update
---> Package mysql.i686 0:5.5.35-1.el6.remi will be updated
---> Package mysql.i686 0:5.5.36-1.el6.remi will be an update
---> Package mysql-libs.i686 0:5.5.35-1.el6.remi will be updated
---> Package mysql-libs.i686 0:5.5.36-1.el6.remi will be an update
---> Package mysql-server.i686 0:5.5.35-1.el6.remi will be updated
---> Package mysql-server.i686 0:5.5.36-1.el6.remi will be an update
---> Package nss.i686 0:3.15.3-3.el6_5 will be updated
---> Package nss.i686 0:3.15.3-6.el6_5 will be an update
---> Package nss-sysinit.i686 0:3.15.3-3.el6_5 will be updated
---> Package nss-sysinit.i686 0:3.15.3-6.el6_5 will be an update
---> Package nss-tools.i686 0:3.15.3-3.el6_5 will be updated
---> Package nss-tools.i686 0:3.15.3-6.el6_5 will be an update
---> Package openldap.i686 0:2.4.23-32.el6_4.1 will be updated
---> Package openldap.i686 0:2.4.23-34.el6_5.1 will be an update
---> Package p11-kit.i686 0:0.18.5-2.el6 will be updated
---> Package p11-kit.i686 0:0.18.5-2.el6_5.2 will be an update
---> Package p11-kit-trust.i686 0:0.18.5-2.el6 will be updated
---> Package p11-kit-trust.i686 0:0.18.5-2.el6_5.2 will be an update
---> Package perf.i686 0:2.6.32-431.3.1.el6 will be updated
---> Package perf.i686 0:2.6.32-431.5.1.el6 will be an update
---> Package perl-Compress-Raw-Bzip2.i686 0:2.021-136.el6 will be updated
---> Package perl-Compress-Raw-Bzip2.i686 0:2.052-1.el6.rf will be an update
---> Package php.i686 0:5.5.8-1.el6.remi will be updated
---> Package php.i686 0:5.5.9-2.el6.remi will be an update
---> Package php-bcmath.i686 0:5.5.8-1.el6.remi will be updated
---> Package php-bcmath.i686 0:5.5.9-2.el6.remi will be an update
---> Package php-cli.i686 0:5.5.8-1.el6.remi will be updated
---> Package php-cli.i686 0:5.5.9-2.el6.remi will be an update
---> Package php-common.i686 0:5.5.8-1.el6.remi will be updated
---> Package php-common.i686 0:5.5.9-2.el6.remi will be an update
---> Package php-gd.i686 0:5.5.8-1.el6.remi will be updated
---> Package php-gd.i686 0:5.5.9-2.el6.remi will be an update
---> Package php-gmp.i686 0:5.5.8-1.el6.remi will be updated
---> Package php-gmp.i686 0:5.5.9-2.el6.remi will be an update
---> Package php-mbstring.i686 0:5.5.8-1.el6.remi will be updated
---> Package php-mbstring.i686 0:5.5.9-2.el6.remi will be an update
---> Package php-mcrypt.i686 0:5.5.8-1.el6.remi will be updated
---> Package php-mcrypt.i686 0:5.5.9-2.el6.remi will be an update
---> Package php-mysqlnd.i686 0:5.5.8-1.el6.remi will be updated
---> Package php-mysqlnd.i686 0:5.5.9-2.el6.remi will be an update
---> Package php-pdo.i686 0:5.5.8-1.el6.remi will be updated
---> Package php-pdo.i686 0:5.5.9-2.el6.remi will be an update
---> Package php-pecl-zip.i686 0:1.12.3-1.el6.remi.5.5 will be updated
---> Package php-pecl-zip.i686 0:1.12.4-1.el6.remi.5.5 will be an update
---> Package php-process.i686 0:5.5.8-1.el6.remi will be updated
---> Package php-process.i686 0:5.5.9-2.el6.remi will be an update
---> Package php-recode.i686 0:5.5.8-1.el6.remi will be updated
---> Package php-recode.i686 0:5.5.9-2.el6.remi will be an update
---> Package php-tcpdf.noarch 0:6.0.053-1.el6.remi will be updated
---> Package php-tcpdf.noarch 0:6.0.059-1.el6.remi will be an update
---> Package php-tcpdf-dejavu-sans-fonts.noarch 0:6.0.053-1.el6.remi will be updated
---> Package php-tcpdf-dejavu-sans-fonts.noarch 0:6.0.059-1.el6.remi will be an update
---> Package php-tidy.i686 0:5.5.8-1.el6.remi will be updated
---> Package php-tidy.i686 0:5.5.9-2.el6.remi will be an update
---> Package php-xml.i686 0:5.5.8-1.el6.remi will be updated
---> Package php-xml.i686 0:5.5.9-2.el6.remi will be an update
---> Package phpMyAdmin.noarch 0:4.1.4-1.el6.remi will be updated
---> Package phpMyAdmin.noarch 0:4.1.7-1.el6.remi will be an update
---> Package python.i686 0:2.6.6-51.el6 will be updated
---> Package python.i686 0:2.6.6-52.el6 will be an update
---> Package python-libs.i686 0:2.6.6-51.el6 will be updated
---> Package python-libs.i686 0:2.6.6-52.el6 will be an update
---> Package tzdata.noarch 0:2013i-1.el6 will be updated
---> Package tzdata.noarch 0:2013i-2.el6 will be an update
---> Package tzdata-java.noarch 0:2013i-1.el6 will be updated
---> Package tzdata-java.noarch 0:2013i-2.el6 will be an update
---> Package wget.i686 0:1.12-1.8.el6 will be updated
---> Package wget.i686 0:1.12-1.11.el6_5 will be an update
---> Package yum-plugin-fastestmirror.noarch 0:1.1.30-14.el6 will be updated
---> Package yum-plugin-fastestmirror.noarch 0:1.1.30-17.el6_5 will be an update
---> Package yum-plugin-security.noarch 0:1.1.30-14.el6 will be updated
---> Package yum-plugin-security.noarch 0:1.1.30-17.el6_5 will be an update
---> Package yum-utils.noarch 0:1.1.30-14.el6 will be updated
---> Package yum-utils.noarch 0:1.1.30-17.el6_5 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                     Arch   Version                    Repository  Size
================================================================================
Installing:
 kernel                      i686   2.6.32-431.5.1.el6         updates     26 M
Updating:
 bind-libs                   i686   32:9.8.2-0.23.rc1.el6_5.1  updates    891 k
 bind-utils                  i686   32:9.8.2-0.23.rc1.el6_5.1  updates    181 k
 irqbalance                  i686   2:1.0.4-8.el6_5            updates     38 k
 java-1.6.0-openjdk          i686   1:1.6.0.0-3.1.13.1.el6_5   updates     42 M
 java-1.7.0-openjdk          i686   1:1.7.0.51-2.4.4.1.el6_5   updates     27 M
 kernel-firmware             noarch 2.6.32-431.5.1.el6         updates     13 M
 kernel-headers              i686   2.6.32-431.5.1.el6         updates    2.8 M
 mysql                       i686   5.5.36-1.el6.remi          remi       5.8 M
 mysql-libs                  i686   5.5.36-1.el6.remi          remi       778 k
 mysql-server                i686   5.5.36-1.el6.remi          remi        10 M
 nss                         i686   3.15.3-6.el6_5             updates    826 k
 nss-sysinit                 i686   3.15.3-6.el6_5             updates     40 k
 nss-tools                   i686   3.15.3-6.el6_5             updates    368 k
 openldap                    i686   2.4.23-34.el6_5.1          updates    267 k
 p11-kit                     i686   0.18.5-2.el6_5.2           updates     93 k
 p11-kit-trust               i686   0.18.5-2.el6_5.2           updates     68 k
 perf                        i686   2.6.32-431.5.1.el6         updates    2.9 M
 perl-Compress-Raw-Bzip2     i686   2.052-1.el6.rf             rpmforge   101 k
 php                         i686   5.5.9-2.el6.remi           remi-php55 2.5 M
 php-bcmath                  i686   5.5.9-2.el6.remi           remi-php55  46 k
 php-cli                     i686   5.5.9-2.el6.remi           remi-php55 2.5 M
 php-common                  i686   5.5.9-2.el6.remi           remi-php55 1.0 M
 php-gd                      i686   5.5.9-2.el6.remi           remi-php55  65 k
 php-gmp                     i686   5.5.9-2.el6.remi           remi-php55  39 k
 php-mbstring                i686   5.5.9-2.el6.remi           remi-php55 950 k
 php-mcrypt                  i686   5.5.9-2.el6.remi           remi-php55  37 k
 php-mysqlnd                 i686   5.5.9-2.el6.remi           remi-php55 253 k
 php-pdo                     i686   5.5.9-2.el6.remi           remi-php55 104 k
 php-pecl-zip                i686   1.12.4-1.el6.remi.5.5      remi-php55 273 k
 php-process                 i686   5.5.9-2.el6.remi           remi-php55  50 k
 php-recode                  i686   5.5.9-2.el6.remi           remi-php55  24 k
 php-tcpdf                   noarch 6.0.059-1.el6.remi         remi       1.8 M
 php-tcpdf-dejavu-sans-fonts noarch 6.0.059-1.el6.remi         remi        84 k
 php-tidy                    i686   5.5.9-2.el6.remi           remi-php55  42 k
 php-xml                     i686   5.5.9-2.el6.remi           remi-php55 196 k
 phpMyAdmin                  noarch 4.1.7-1.el6.remi           remi       4.7 M
 python                      i686   2.6.6-52.el6               updates     74 k
 python-libs                 i686   2.6.6-52.el6               updates    5.3 M
 tzdata                      noarch 2013i-2.el6                updates    448 k
 tzdata-java                 noarch 2013i-2.el6                updates    147 k
 wget                        i686   1.12-1.11.el6_5            updates    482 k
 yum-plugin-fastestmirror    noarch 1.1.30-17.el6_5            updates     28 k
 yum-plugin-security         noarch 1.1.30-17.el6_5            updates     38 k
 yum-utils                   noarch 1.1.30-17.el6_5            updates    102 k

Transaction Summary
================================================================================
Install       1 Package(s)
Upgrade      44 Package(s)

Total download size: 154 M
Is this ok [y/N]:

Voila! The error is gone now!