User Tools

Site Tools


docu:csheet:sysadm:packages:fix_yum

Fix yum broken repositories db


On a centos-based machine with the given error:

[root@homer ~]# yum repolist                                                                                                                                                                                                                                                   
rpmdb: Thread/process 3927744/139924716283648 failed: Thread died in Berkeley DB library                                                                                                                                                                                         
error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery                                                                                                                                                                                 
error: cannot open Packages index using db3 -  (-30974)                                                                                                                                                                                                                          
error: cannot open Packages database in /var/lib/rpm                                                                                                                                                                                                                             
CRITICAL:yum.main:                                                                                                                                                                                                                                                               
 
Error: rpmdb open failed


Fix it doing the following commands:

# Take backup of rpm folder
cp -avr /var/lib/rpm/ /root/backups.rpm
 
# Remove RPM database files
rm -f /var/lib/rpm/__db*
 
#Verify the RPM db packages
db_verify /var/lib/rpm/Packages
 
# Rebuild the RPM database
rpm --rebuilddb
 
# Run yum clean to download repo data again
yum clean all
docu/csheet/sysadm/packages/fix_yum.txt · Last modified: 2020/02/17 11:01 by admin