内存小引起yum问题

 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 294, in user_main
errcode = main(args)
File “/usr/share/yum-cli/yummain.py”, line 146, in main
result, resultmsgs = base.doCommands()
File “/usr/share/yum-cli/cli.py”, line 438, in doCommands
return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
File “/usr/share/yum-cli/yumcommands.py”, line 559, in doCommand
base.repos.doSetup()
File “/usr/lib/python2.6/site-packages/yum/repos.py”, line 105, in doSetup
self.ayum.plugins.run(‘postreposetup’)
File “/usr/lib/python2.6/site-packages/yum/plugins.py”, line 184, in run
func(conduitcls(self, self.base, conf, **kwargs))
File “/usr/lib/yum-plugins/fastestmirror.py”, line 202, in postreposetup_hook
all_urls = FastestMirror(all_urls).get_mirrorlist()
File “/usr/lib/yum-plugins/fastestmirror.py”, line 369, in get_mirrorlist
self._poll_mirrors()
File “/usr/lib/yum-plugins/fastestmirror.py”, line 413, in _poll_mirrors
pollThread.start()
File “/usr/lib64/python2.6/threading.py”, line 474, in start
_start_new_thread(self.__bootstrap, ())
thread.error: can’t start new thread

解决方案:

在一些廉价VPS上运行Yum时可能会出 现:”thread.error: can’t start new thread”的错误, 原因就是因为内存太小了,以至于导致在寻找最快镜像的时候内存不足。

发生的原因在于fastestmirror,而禁用fastestmirror就可以解决这个问题,具体的解决办法是将fastestmirror.conf中的enabled=1改成enabled=0。

在登录SSH之后,编辑/etc/yum/pluginconf.d/fastestmirror.conf文件,把enabled从其中的把enabled=1改为enabled=0即可。

执行如下命令一键修改:

sed -i ‘s/enabled=1/enabled=0/g’ /etc/yum/pluginconf.d/fastestmirror.conf

 

-------------本文结束感谢您的阅读-------------