0

In order to repair the RPM database, I ran rpm --rebuild. Afterward, I cannot find any package using rpm -qa, and yum does not work,as the logs below show.

[root@local03 ~]# yum

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 294, in user_main errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 115, in main base.getOptionsConfig(args)
File "/usr/share/yum-cli/cli.py", line 228, in getOptionsConfig self.conf
File "/usr/lib/python2.6/site-packages/yum/init.py", line 910, in conf = property(fget=lambda self: self._getConfig(),
File "/usr/lib/python2.6/site-packages/yum/init.py", line 299, in _getConfig startupconf = config.readStartupConfig(fn, root)
File "/usr/lib/python2.6/site-packages/yum/config.py", line 892, in readStartupConfig startupconf.releasever = _getsysver(startupconf.installroot, startupconf.distroverpkg)
File "/usr/lib/python2.6/site-packages/yum/config.py", line 1043, in _getsysver hdr = idx.next() StopIteration

[root@local03 ~]# rpm -aq | grep bash 
[root@local03 ~]#
  • I get nothing using rpm -qa ,is there anyone could help me,I cannot thank you more. – LuHongwei May 8 at 1:37
  • Do you have any special settings in /etc/yum/yum.conf or other files in directories in /etc/yum/? It looks to me, based on that error, that the error you are seeing is due to it being unable to parse your system version. – jsbillings May 9 at 19:58
  • However, if rpm -qa doesn't return anything, then it sounds to me like you initialized your RPM database. Might be time to restore from backups. – jsbillings May 9 at 19:59
  • The version of my system is redhat 6.6,but I did not initialized my RPM database,I am sure I just rebuilded it. The files in /etc/yum/yum.conf look normal. – LuHongwei May 14 at 2:28
  • The configuration for yum bears no relationship on rebuilding your rpm database. You’ve destroyed it and need to reinstall or restore from backups. – jsbillings May 14 at 17:00
0

Try with this, is what I use to rebuild rpm database in centos, should work for rhel as well:

rm -f /var/lib/rpm/__*
rpm --rebuilddb
  • Thank you for your answer,but it did not work ,and I tried 3 times,the __db.00{1..4} was created after rpm --rebuilddb, the time of this files was lastest,Or should I back up something before rebuilddb?I feel confused. – LuHongwei May 9 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.