If you've ever gotten this cryptic error using yum, you'll find that it's very difficult to pinpoint the cause. The message itself, "database disk image is malformed," refers to a corrupted sqlite file. However, the RPM and YUM systems use a variety of different such files; therefore finding the right one can be difficult.
The best thing to do, is to start by attempting to fix this using the available command line tool:
# yum clean all
This should solve the problem in most cases. If the problem continues, perhaps the RPM database files are corrupted. One of my previous articles talks about rebuilding these, but I will go over it again here:
The database files are located in "/var/lib/rpm" and are named __db.001 __db.002 etc... etc...
Delete those files:
# rm -f /var/lib/rpm/__db*
Rebuild the database:
# rpm --rebuilddb
Then try to clean the yum cache as per the above command and try your yum command again. If this continues to fail, try deleting your yum cache manually:
# rm -Rf /var/cache/yum
Now try the command again. This should have gotten rid of the last sqlite files yum could possibly use. The command should be able to rebuild all the databases correctly at this point.
Very useful post. Thank You.
ReplyDeleteI'm glad you found it useful.
DeleteThis saved my day. Thx.
ReplyDelete;-)
DeleteThanks for the tip!
ReplyDelete