• 欢迎访问本站,有问题欢迎留言,博主会不定期回复。
  • 本站将不定期更新。

解决CentOS下yum不能使用的错误(thread.error: can’t start new thread)

Linux 情绪21℃ 4年前 (2014-11-23) 5079次浏览 0个评论

在某台OpenVZ虚拟化的VPS上安装pptpd服务,结果遭遇yum无法使用的问题。执行yum后的错误代码如下:

  • Loaded plugins: fastestmirror
  • Setting up Remove Process
  • No Match for argument: pptpd
  • Determining fastest mirrors
  • 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 349, in doCommands
  •     return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
  •   File “/usr/share/yum-cli/yumcommands.py”, line 366, in doCommand
  •     return base.erasePkgs(extcmds)
  •   File “/usr/share/yum-cli/cli.py”, line 638, in erasePkgs
  •     self._checkMaybeYouMeant(arg, always_output=False)
  •   File “/usr/share/yum-cli/cli.py”, line 533, in _checkMaybeYouMeant
  •     matches = self.doPackageLists(patterns=[arg], ignore_case=False)
  •   File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 1632, in doPackageLists
  •     avail = self.pkgSack.returnNewestByNameArch(patterns=patterns,
  •   File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 662, in <lambda>
  •     pkgSack = property(fget=lambda self: self._getSacks(),
  •   File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 502, in _getSacks
  •     self.repos.populateSack(which=repos)
  •   File “/usr/lib/python2.4/site-packages/yum/repos.py”, line 232, in populateSack
  •     self.doSetup()
  •   File “/usr/lib/python2.4/site-packages/yum/repos.py”, line 79, in doSetup
  •     self.ayum.plugins.run(‘postreposetup’)
  •   File “/usr/lib/python2.4/site-packages/yum/plugins.py”, line 179, in run
  •     func(conduitcls(self, self.base, conf, **kwargs))
  •   File “/usr/lib/yum-plugins/fastestmirror.py”, line 181, in postreposetup_hook
  •     all_urls = FastestMirror(all_urls).get_mirrorlist()
  •   File “/usr/lib/yum-plugins/fastestmirror.py”, line 333, in get_mirrorlist
  •     self._poll_mirrors()
  •   File “/usr/lib/yum-plugins/fastestmirror.py”, line 376, in _poll_mirrors
  •     pollThread.start()
  •   File “/usr/lib/python2.4/threading.py”, line 416, in start
  •     _start_new_thread(self.__bootstrap, ())
  • thread.error: can’t start new thread

从下面这个博客中找到了解决方案:

http://www.tuccuay.com/2012/01/%E8%A7%A3%E5%86%B3thread-error-cant-start-new-thread%E9%94%99%E8%AF%AF/

在一些廉价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


情绪21℃版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明:解决CentOS下yum不能使用的错误(thread.error: can’t start new thread)丨作者 情绪21℃
喜欢 (1)
[[email protected]]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址