Tips / Nginx

Rebuilding a corrupted RPM database


Sometimes while working on RedHat based distros (RHEL, CentOS, Fedora, etc) you can get some software updating issues. The most common problem is to face a RPM corrupted database, which will prevent your software manager (yum) from working normally. So, if you screwed up your RPM database, or it got screwed up by itself (can happen more often than you imagine) here is a quick and easy way to fix it.


  • rpmdb tools package must be installed

Backup RPM database

Just in case, don’t forget to backup your current RPM database:

mkdir /root/rpmdb.bak
rsync -avpr var/lib/rpm/__db* /root/rpmdb.bak/

Remove the corrupted RPM database files

Remove /var/lib/rpm/__db* files

cd /var/lib
rm __db* -fv

Rebuild RPM database

rpm --rebuilddb
rpmdb_verify Packages

Now try to run your update process normally:

yum update packagename


yum update

Popular search terms:

  • centos rebuild yum database
  • centos reindex rpm database
  • centos7 rebuild rpm databases
  • rebuild corrupt rpm databases

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking