问题:
root@linux2 rpm]# yum install
Traceback (most recent call last):
File"/usr/bin/yum", line 29, in <module>
yummain.user_main(sys.argv[1:], exit_code=True)
File"/usr/share/yum-cli/yummain.py", line 276, in user_main
errcode =main(args)
File"/usr/share/yum-cli/yummain.py", line 98, 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 887, in<lambda>
conf =property(fget=lambda self: self._getConfig(),
File"/usr/lib/python2.6/site-packages/yum/__init__.py", line 295, in_getConfig
startupconf = config.readStartupConfig(fn, root)
File"/usr/lib/python2.6/site-packages/yum/config.py", line 877, inreadStartupConfig
startupconf.releasever = _getsysver(startupconf.installroot,startupconf.distroverpkg)
File"/usr/lib/python2.6/site-packages/yum/config.py", line 1028, in_getsysver
hdr =idx.next()
StopIteration
原因(可能):1、删除了RPM相关数据库 /var/lib/rpm/中的Package文件,但也使用了rpm –rebuilddb修复数据库资料。
尝试:1、cd /var/lib/rpm/
rm -i __db.*
yum clean all
yum history new
失败
2、rpm -Uvh--force yum-2.0.7-3.1.fc.fr.noarch.rpm –nodeps
失败
3、结合以上两种方法:
cd /var/lib/rpm/
rm -i __db.*
rpm –rebuilddb
rpm -ivh --force /media/CDROM/Packages/yum-3.2.29-22.el6.noarch.rpm
/media/CDROM/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm –nodeps
yum clean all
成功
至于真正的原因也还不清楚,也是借用谷歌和百度查了各大论坛才弄好的。