YUM (Yellowdog Updater, Modified) is the default, high-level tool for Linux package management on RPM (RedHat Package Manager) based Linux distributions such as Red Hat Enterprise Linux (RHEL), CentOS as well as older versions of Fedora Linux, just to mention but a few.


It works just like an apt-get command or the relatively new apt command; it can be used to install new packages, remove old packages and query installed and/or available packages. It can also be used to update a system (together with dependency resolution and obsolete processing depending on stored repository metadata).


Brief Understanding of YumDB


Starting from version 3.2.26, yum stores supplementary information concerning installed packages in a location outside of the generic rpmdatabase; in a simple flat file database called yumdb (/var/lib/yum/yumdb/) – not a real database.

# cd /var/lib/yum/yumdb
# ls 


You can check out one of the sub-directories to find out more about yumdb as follows.

# cd b
# ls


Although this information is not of great significance to yum processes, it is very useful to the system administrators: it clearly describes the context in which a package was installed on the system.


If you tried looking through the files (from_repo, installed_by, releasever etc..) shown in the screen shot above, you would probably see nothing important in them.


To access the information in them, you must install yum-utils which provides a script called yumdb – then use this script as explained below.

# yum install yum-utils


The following command will get the repo from which httpd was installed.

# yumdb get from_repo httpd



To define a note on the packages httpd and mariadb, type.

# yumdb set note "installed by aaronkilik to setup LAMP" httpd mariadb


And to vew all yumdb values concerning httpd and mariadb, type.

# yumdb info httpd mariadb


Fix Yum Error: database disk image is malformed


Occasionally while installing a package or updating your system using YUM, you may encounter the error: “database disk image is malformed”. It may result from a corrupted yumdb: possibly caused by an impediment of the “yum update” process or package installation.


To fix this error, you need to clean database cache by running the command below.

# yum clean dbcache


If the above command fails to work (fix the error), try running the series of commands below.

# yum clean all			#delete entries in /var/cache/yum/ directory.
# yum clean metadata		#clear XML metadeta		
# yum clean dbcache		#clear the cached files for database
# yum makecache		        #make cache


Finally, you must rebuild your system’s RPM database for it to work.

# mv /var/lib/rpm/__db* /tmp
# rpm --rebuilddb


If you have followed the above instructions well, then the error should be resolved by now. Then try to update your system as follows.

# yum update 


Was this answer helpful? 0 Users Found This Useful (0 Votes)