@JS's Notes

Site with notes from my work.

Fix Yum error database disk image is malformed

2019-10-05 System @JS

My test platform: CentOS Linux release 7.6.1810 (Core)

Requirements: user with root privileges or non-root user with sudo privileges.

# clean the database cache
yum clean dbcache

# if the above command fails to work, try running the series of below
yum clean all				#delete entries in /var/cache/yum/directory
yum clean metadata			#clear XML metadata		
yum clean dbcache			#clear the cached files for database
yum makecache		        #make cache

# rebuild the RPM system database
mv /var/lib/rpm/__db* /tmp
rpm --rebuilddb

# update your system
yum update