centos中yum-fastmirror插件出错的解决方法,有遇到类似问题的朋友可以参考下。
错误代码:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
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 178, in main result, resultmsgs = base.doCommands()
File “/usr/share/yum-cli/cli.py”, line 345, in doCommands self._getTs(needTsRemove)
File “/usr/lib/python2.4/site-packages/yum/depsolve.py”, line 101, in _getTsself._getTsInfo(remove_only)
File “/usr/lib/python2.4/site-packages/yum/depsolve.py”, line 112, in _getTsInfopkgSack = self.pkgSack
File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 661, in pkgSack = property(fget=lambda self: self._getSacks(),
File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 501, in _getSacksself.repos.populateSack(which=repos)
File “/usr/lib/python2.4/site-packages/yum/repos.py”, line 232, in populateSackself.doSetup()
File “/usr/lib/python2.4/site-packages/yum/repos.py”, line 79, in doSetupself.ayum.plugins.run(‘postreposetup’)
File “/usr/lib/python2.4/site-packages/yum/plugins.py”, line 179, in runfunc(conduitcls(self, self.base, conf, **kwargs))
File “/usr/lib/yum-plugins/fastestmirror.py”, line 181, in postreposetup_hookall_urls = FastestMirror(all_urls).get_mirrorlist()
File “/usr/lib/yum-plugins/fastestmirror.py”, line 333, in get_mirrorlistself._poll_mirrors()
File “/usr/lib/yum-plugins/fastestmirror.py”, line 376, in _poll_mirrorspollThread.start()
File “/usr/lib/python2.4/threading.py”, line 416, in start_start_new_thread(self.__bootstrap, ())
thread.error: can’t start new thread
网上给出的解决方法:
yum clean all
rm -f /var/lib/rpm/__db*
rpm –rebuilddb
yum update
试了试不行,干脆把fastestmirror禁掉,便解决了:
vi /etc/yum/pluginconf.d/fastestmirror.conf
enabled=1 改成 0
修改fastestmirror.conf的 maxthreads 值没试。
附:
fastestmirror插件介绍:
使用yum可以简化系统软件更新的工作。为了保证更新的持续进行,通常都会提供多个mirror(镜像)地址供下载使用,但由于存在地域问题,从不同的镜 像下载速度差异很大。选择从适合的镜像下载软件包,会极大的影响更新速度。以CentOS为例,可使用一个叫fastestmirror的插件,让yum 在更新时先根据ping值进行判断,然后从最快响应的地址下载。
UPDATE1:网上找到的问题原因。解决办法和上面的类似。
Basically this issue is rare to see, it’s a memory resource issue with the vps which is caused by yum’s fastestmirror plugin. This issue can be repeated when the following two conditions are met:
1, You’re running VPS, for example in an OpenVZ virtual server.
2, There’s a mysql instance running in this vritual server already.
This is a reported bug which had been fixed two months ago.
As we know the exactly reason for this error, there’re two ways to bypass it:
1, Stop the mysql instance and run yum again.
2, Disable yum’s fastestmirror plugin when start yum, like this:
Code:
yum --disableplugin=fastestmirror update