Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
02-18-2015, 03:54 AM
|
#1
|
Member
Registered: Oct 2011
Location: New Delhi
Posts: 248
Rep:
|
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.
|
|
|
02-18-2015, 10:38 AM
|
#2
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,407
|
Quote:
Originally Posted by pantdk
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
|
|
|
02-18-2015, 11:16 PM
|
#3
|
Member
Registered: Oct 2011
Location: New Delhi
Posts: 248
Original Poster
Rep:
|
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.
|
|
|
02-19-2015, 02:01 AM
|
#4
|
Member
Registered: Oct 2011
Location: New Delhi
Posts: 248
Original Poster
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 01:05 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|