使用Chef安装Python时出现“CRC检查失败”
我正在尝试通过 chef-solo 和 vagrant 在一个 64 位的 lucid 虚拟机上安装 graphite。graphite 的一个依赖项是 python,当我尝试配置虚拟机时,出现了下面的错误。我使用的是 Opscode 提供的标准 python 食谱(https://github.com/opscode-cookbooks/python)。
我对 chef 和 python 不太熟悉,所以这个错误让我有点困惑。任何帮助都非常感谢。
[default] Running provisioner: Vagrant::Provisioners::ChefSolo...
[default] Generating chef JSON and uploading...
[default] Running chef-solo...
stdin: is not a tty
[2013-03-11T00:18:05+01:00] INFO: *** Chef 10.14.2 ***
[2013-03-11T00:18:05+01:00] INFO: Setting the run_list to ["recipe[graphite]"] from JSON
[2013-03-11T00:18:05+01:00] INFO: Run List is [recipe[graphite]]
[2013-03-11T00:18:05+01:00] INFO: Run List expands to [graphite]
[2013-03-11T00:18:05+01:00] INFO: Starting Chef Run for lucid64.hsd1.ca.comcast.net.
[2013-03-11T00:18:05+01:00] INFO: Running start handlers
[2013-03-11T00:18:05+01:00] INFO: Start handlers complete.
[2013-03-11T00:18:06+01:00] WARN: This recipe uses encrypted data bags, which are not supported on Chef Solo - fallback to node attribute.
[2013-03-11T00:18:06+01:00] INFO: Processing package[python] action install (python::package line 40)
[2013-03-11T00:18:06+01:00] INFO: Processing package[python-dev] action install (python::package line 40)
[2013-03-11T00:18:06+01:00] INFO: Processing remote_file[/tmp/vagrant-chef-1/distribute_setup.py] action create (python::pip line 33)
[2013-03-11T00:18:06+01:00] INFO: Processing execute[install-pip] action run (python::pip line 39)
================================================================================
Error executing action `run` on resource 'execute[install-pip]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '127'
---- Begin output of /usr/bin/python distribute_setup.py --download-base=https://pypi.python.org/packages/source/d/distribute/
/usr/local/bin/easy_install pip
----
STDOUT: Extracting in /tmp/tmphzwy_0
STDERR: Traceback (most recent call last):
File "distribute_setup.py", line 546, in <module>
sys.exit(main())
File "distribute_setup.py", line 543, in main
return _install(tarball, _build_install_args(options))
File "distribute_setup.py", line 77, in _install
_extractall(tar)
File "distribute_setup.py", line 479, in _extractall
for tarinfo in members:
File "/usr/lib/python2.6/tarfile.py", line 2412, in next
tarinfo = self.tarfile.next()
File "/usr/lib/python2.6/tarfile.py", line 2314, in next
self.fileobj.seek(self.offset)
File "/usr/lib/python2.6/gzip.py", line 382, in seek
self.read(1024)
File "/usr/lib/python2.6/gzip.py", line 219, in read
self._read(readsize)
File "/usr/lib/python2.6/gzip.py", line 267, in _read
self._read_eof()
File "/usr/lib/python2.6/gzip.py", line 304, in _read_eof
hex(self.crc)))
IOError: CRC check failed 0x94c615b3 != 0x2e611106L
sh: /usr/local/bin/easy_install: not found
---- End output of /usr/bin/python distribute_setup.py --download-base=https://pypi.python.org/packages/source/d/distribute/
/usr/local/bin/easy_install pip
----
Ran /usr/bin/python distribute_setup.py --download-base=https://pypi.python.org/packages/source/d/distribute/
/usr/local/bin/easy_install pip
returned 127
1 个回答
0
这个错误 IOError: CRC check failed 0x94c615b3 != 0x2e611106L
表示 gzip 模块在解压下载的 .tgz 文件时出错了。这可能是因为网络问题导致的。
为了找出问题所在,可以尝试手动运行设置 distribute 的命令,也就是先输入 vagrant ssh
,然后:
/usr/bin/python distribute_setup.py --download-base=https://pypi.python.org/packages/source/d/distribute/
这样可以帮助你找出在 distribute_setup.py 文件中哪里出了问题。如果 distribute_setup.py 运行失败,你可以检查一下它下载的 distribute-X.Y.Z.tar.gz 文件,看看它是否和这个链接中的文件一致:https://pypi.python.org/packages/source/d/distribute/(可以对比两个文件的 md5sum 来确认它们是否相同)。如果它们是一样的,我建议你手动解压刚下载的 .tgz 文件,看看它是否有效;虽然不太可能,但也有可能网站上的某个文件损坏了。
如果到现在为止还是没有明显的解决办法,可以更新你的问题,提供这些额外的信息,我们再看看能否进一步调查。