从源

时间:2016-02-16 16:05:12

标签: nginx chef checksum chef-solo

我遇到了这里描述的错误:

Chef::Exceptions::ChecksumMismatch when installing nginx-1.7.8 from source

然而,该修复对我不起作用。

按照该页面上的建议,我创建了一个shasum:

  shasum -a 256 nginx-1.4.4.tar 

  ed744d916a19e426fd6885e14036d64156f4b6f6aca1d22a1b9307de8d46e8d3  nginx-1.4.4.tar

然后我打开了这个文件:

  vi /opt/chef/cookbooks/nginx/recipes/source.rb 

我找到了这个块:

  remote_file nginx_url do
    source   nginx_url
    checksum node['nginx']['source']['checksum']
    path     src_filepath
    backup   false
  end

我改为:

  remote_file nginx_url do
    source   nginx_url
    checksum 'ed744d916a19e426fd6885e14036d64156f4b6f6aca1d22a1b9307de8d46e8d3'
    path     src_filepath
    backup   false
  end

但我仍然会收到此错误:

  Recipe: nginx::source
    * yum_package[pcre-devel] action install (up to date)
    * yum_package[openssl-devel] action install (up to date)
    * remote_file[http://nginx.org/download/nginx-1.4.4.tar.gz] action create

      ================================================================================
      Error executing action `create` on resource 'remote_file[http://nginx.org/download/nginx-1.4.4.tar.gz]'
      ================================================================================

      Chef::Exceptions::ChecksumMismatch
      ----------------------------------
      Checksum on resource (ed744d) does not match checksum on content (7c989a)

      Resource Declaration:
      ---------------------
      # In /opt/chef/cookbooks/nginx/recipes/source.rb

       58: remote_file nginx_url do
       59:   source   nginx_url
       60:   checksum 'ed744d916a19e426fd6885e14036d64156f4b6f6aca1d22a1b9307de8d46e8d3'
       61:   path     src_filepath
       62:   backup   false
       63: end
       64: 

      Compiled Resource:
      ------------------
      # Declared in /opt/chef/cookbooks/nginx/recipes/source.rb:58:in `from_file'

      remote_file("http://nginx.org/download/nginx-1.4.4.tar.gz") do
        provider Chef::Provider::RemoteFile
        action [:create]
        retries 0
        retry_delay 2
        default_guard_interpreter :default
        source ["http://nginx.org/download/nginx-1.4.4.tar.gz"]
        use_etag true
        use_last_modified true
        declared_type :remote_file
        cookbook_name :nginx
        recipe_name "source"
        checksum "ed744d916a19e426fd6885e14036d64156f4b6f6aca1d22a1b9307de8d46e8d3"
        path "/var/chef/cache/nginx-1.4.4.tar.gz"
        atomic_update true
      end


  Running handlers:
  [2016-02-16T15:40:44+00:00] ERROR: Running exception handlers
  Running handlers complete
  [2016-02-16T15:40:44+00:00] ERROR: Exception handlers complete
  Chef Client failed. 5 resources updated in 19 seconds
  [2016-02-16T15:40:44+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
  [2016-02-16T15:40:44+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
  [2016-02-16T15:40:44+00:00] ERROR: remote_file[http://nginx.org/download/nginx-1.4.4.tar.gz] (nginx::source line 58) had an error: Chef::Exceptions::ChecksumMismatch: Checksum on resource (ed744d) does not match checksum on content (7c989a)
  [2016-02-16T15:40:44+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

有没有人有任何建议?

我在我的本地机器(Mac)上运行这个流浪者。

2 个答案:

答案 0 :(得分:0)

听起来这在上面的评论中得到了解决,但是对于记录,您需要确保校验和正好是正在下载的文件。在使用gzip压缩的情况下,这可能会造成混淆。

答案 1 :(得分:0)

对文件运行sha256sum命令并将输出用作校验和。好像你使用md5或sha1哈希算法作为校验和