Thursday, June 27, 2013

rpm database corrupt

I have installed few rpm's on RHEL. But i want to check with rpm -qa command, it is not showing any output. I think the database of the rpm is corrupted. Please let me know how to 1)rebuild the rpm database. 
2)If the database is corrupted, how to see which files of the rpm are installed. 
3)for some xyz rpm if I have installed, which are the files related to it. 

You might say like, check the man page. I found the man page very confusing
Use rpm -ql <package name> 
example - 
rpm -ql glibc-2.5-34
Use this command to check rpm installed or not 

rpm -qa |grep packagename First remove potential corrupted db files 

cd /var/lib 
rm __db* 

then, rebuild 

rpm --rebuilddb 
rpmdb_verify Packages 

If you are still having problems with the rpm query then try this 

mv Packages Packages-BAKUP 
db_dump Packages-BAKUP | db_load Packages 
rpm -qa 
rpm --rebuilddbRecovery is possible if some data bases(see /var/lib/rpm) are OK... 

otherwise you must restore from latest backup 

see also: option of rpm "rpm --rebuilddb "


Post a Comment

Design by BABU | Dedicated to grandfather | welcome to BABU-UNIX-FORUM