LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-18-2015, 03:54 AM   #1
pantdk
Member
 
Registered: Oct 2011
Location: New Delhi
Posts: 248
Blog Entries: 3

Rep: Reputation: 17
Question How to rebuild the corrupted rebuild RPM database


Hi All,

today i am facing a issue of corrupted RPM database
when i run command # rpm -qa it didn't show anything

rpm -qa |grep -i yum no packages

#yum list
Loaded plugins: rhnplugin, security
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 309, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 157, in main
base.getOptionsConfig(args)
File "/usr/share/yum-cli/cli.py", line 187, in getOptionsConfig
self.conf
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 665, in <lambda>
conf = property(fget=lambda self: self._getConfig(),
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 240, in _getConfig
self._conf = config.readMainConfig(startupconf)
File "/usr/lib/python2.4/site-packages/yum/config.py", line 805, in readMainConfig
yumvars['releasever'] = _getsysver(startupconf.installroot, startupconf.distroverpkg)
File "/usr/lib/python2.4/site-packages/yum/config.py", line 884, in _getsysver
hdr = idx.next()

then i follow the below command to recreate the RPM database


# cd /var/spool/up2date
# rm *
# rm .*
# ps -aux | grep -e rpm -e yum -e up2date
# lsof | grep /var/lib/rpm
#rm -f /var/lib/rpm/__db*

# cd /var/lib/rpm
# rm -f __db* # to avoid stale locks
# /usr/lib/rpm/rpmdb_verify Packages
#/usr/lib/rpm/rpmdb_verify Packages
# echo $?
0
# mv Packages Packages.orig
# /usr/lib/rpm/rpmdb_dump Packages.orig | /usr/lib/rpm/rpmdb_load Packages

# /usr/lib/rpm/rpmdb_verify Packages
# rpm -qa >/dev/null # Validating there are no errors

# rpm -vv --rebuilddb

# cd /var/lib/rpm
# /usr/lib/rpm/rpmdb_verify Packages
# rpm -qa # Validating list of installed RPMs

but still it shown no packages Please suggest if someone have any info

Last edited by pantdk; 02-18-2015 at 05:43 AM.
 
Old 02-18-2015, 10:38 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,407

Rep: Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111Reputation: 8111
Quote:
Originally Posted by pantdk View Post
Hi All,
today i am facing a issue of corrupted RPM database when i run command # rpm -qa it didn't show anything
rpm -qa |grep -i yum no packages

#yum list
Loaded plugins: rhnplugin, security
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 309, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 157, in main
base.getOptionsConfig(args)
File "/usr/share/yum-cli/cli.py", line 187, in getOptionsConfig
self.conf
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 665, in <lambda>
conf = property(fget=lambda self: self._getConfig(),
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 240, in _getConfig
self._conf = config.readMainConfig(startupconf)
File "/usr/lib/python2.4/site-packages/yum/config.py", line 805, in readMainConfig
yumvars['releasever'] = _getsysver(startupconf.installroot, startupconf.distroverpkg)
File "/usr/lib/python2.4/site-packages/yum/config.py", line 884, in _getsysver
hdr = idx.next()

then i follow the below command to recreate the RPM database but still it shown no packages Please suggest if someone have any info
You don't tell us what version/distro of Linux you're using, so we can only guess. Given what you posted, it seems like you're using an old version of Red Hat Enterprise...are you PAYING FOR RHEL??? If so, contact Red Hat support for assistance. And since you're getting Python errors, have you recently updated python on that system??

This is covered on Red Hat's knowledgebase:
https://access.redhat.com/solutions/6903
 
Old 02-18-2015, 11:16 PM   #3
pantdk
Member
 
Registered: Oct 2011
Location: New Delhi
Posts: 248

Original Poster
Blog Entries: 3

Rep: Reputation: 17
RHEL5.3 64Bit.we are paying for some other server not for this server .we have only updated the bash packages only few month back part from that. i think we haven't update the box we already us this below like & many other to resolve it but this doesn't resolve the issue now i am thinking i have to check other servers which have the exactly same installed package set & then try to rebuild the rpm db .
https://access.redhat.com/solutions/6903

Last edited by pantdk; 02-18-2015 at 11:18 PM.
 
Old 02-19-2015, 02:01 AM   #4
pantdk
Member
 
Registered: Oct 2011
Location: New Delhi
Posts: 248

Original Poster
Blog Entries: 3

Rep: Reputation: 17
Hi All,

Now i have resolve the issue as i have takes the backup of the RPM directory from other server which have the same OS version
"var/lib/rpm" & then move the RPM directory on the other server which have the RPMdatabase is corrupted.after that all works fine the rpm-qa have listing all the packages after that i have remove the _db file so that i can create fresh file of the server so i have do that & successfully completed.

#rpm --rebuilddb
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rebuild rpm database robertngo Red Hat 2 06-25-2005 03:31 PM
Can't rebuild RPM database tawalker Linux - Software 3 04-22-2004 05:17 AM
RPM database problems - can't rebuild Ross Clement Red Hat 4 10-21-2003 01:35 PM
RPM Database Rebuild monte Linux - Distributions 3 09-25-2003 05:22 PM
RPM Database Rebuild monte Linux - Newbie 1 05-20-2003 06:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration