New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to chef 12 produces checksum error #61

Closed
rleibman opened this Issue Mar 5, 2015 · 14 comments

Comments

Projects
None yet
@rleibman

rleibman commented Mar 5, 2015

My recipe has:

node.set['nodejs']['install_method'] = 'source'
node.set['nodejs']['version'] = '0.10.33'

include_recipe "nodejs"
include_recipe "nodejs::npm"

When I run this I get:

  • ark[nodejs-source] action install_with_make
    • directory[/usr/local/nodejs-source-0.10.33] action create (up to date)
    • remote_file[/var/chef/cache/nodejs-source-0.10.33.tar.gz] action create
===============================================================================
Error executing action `create` on resource 'remote_file[/var/chef/cache/nodejs-source-0.10.33.tar.gz]'
===============================================================================

      Chef::Exceptions::ChecksumMismatch
      ----------------------------------
      Checksum on resource (ef5e4e) does not match checksum on content (75dc26)

      Resource Declaration:
      ---------------------
      # In /var/chef/cache/cookbooks/ark/providers/default.rb

      279:   remote_file new_resource.release_file do
      280:     Chef::Log.debug('DEBUG: new_resource.release_file')
      281:     source new_resource.url
      282:     checksum new_resource.checksum if new_resource.checksum
      283:     action :create
      284:     notifies :run, "execute[unpack #{new_resource.release_file}]"
      285:   end
      286: 

      Compiled Resource:
      ------------------
      # Declared in /var/chef/cache/cookbooks/ark/providers/default.rb:279:in `block in class_from_file'

      remote_file("/var/chef/cache/nodejs-source-0.10.33.tar.gz") do
        provider Chef::Provider::RemoteFile
        action [:create]
        retries 0
        retry_delay 2
        default_guard_interpreter :default
        path "/var/chef/cache/nodejs-source-0.10.33.tar.gz"
        backup 5
        atomic_update true
        source ["http://nodejs.org/dist/v0.10.33/node-v0.10.33.tar.gz"]
        use_etag true
        use_last_modified true
        declared_type :remote_file
        cookbook_name "nodejs"
        checksum "ef5e4ea6f2689ed7f781355012b942a2347e0299da0804a58de8e6281c4b1daa"
      end


===============================================================================
Error executing action `install_with_make` on resource 'ark[nodejs-source]'
===============================================================================

    Chef::Exceptions::ChecksumMismatch
    ----------------------------------
    remote_file[/var/chef/cache/nodejs-source-0.10.33.tar.gz] (/var/chef/cache/cookbooks/ark/providers/default.rb line 279) had an error: Chef::Exceptions::ChecksumMismatch: Checksum on resource (ef5e4e) does not match checksum on content (75dc26)

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/nodejs/recipes/nodejs_from_source.rb

     36: ark 'nodejs-source' do
     37:   url nodejs_src_url
     38:   version node['nodejs']['version']
     39:   checksum node['nodejs']['source']['checksum']
     40:   make_opts ["-j #{node['nodejs']['make_threads']}"]
     41:   action :install_with_make
     42: end

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/nodejs/recipes/nodejs_from_source.rb:36:in `from_file'

    ark("nodejs-source") do
      provider Chef::Provider::Ark
      action [:install_with_make]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :ark
      cookbook_name "nodejs"
      recipe_name "nodejs_from_source"
      url "http://nodejs.org/dist/v0.10.33/node-v0.10.33.tar.gz"
      version "0.10.33"
      checksum "ef5e4ea6f2689ed7f781355012b942a2347e0299da0804a58de8e6281c4b1daa"
      make_opts ["-j 1"]
      extension "tar.gz"
      prefix_bin "/usr/local/bin"
      home_dir "/usr/local/nodejs-source"
      path "/usr/local/nodejs-source-0.10.33"
      release_file "/var/chef/cache/nodejs-source-0.10.33.tar.gz"
      strip_components 1
      owner "root"
      group 0
    end
@guilhem

This comment has been minimized.

Member

guilhem commented Mar 5, 2015

Hi @rleibman
seems to be a bug in chef 12 chef/chef#2689 :/

@guilhem

This comment has been minimized.

Member

guilhem commented Mar 5, 2015

oh no... this is worst than expected: chef/chef#2681

@sheldoan

This comment has been minimized.

sheldoan commented Mar 20, 2015

+1

@SerjoPepper

This comment has been minimized.

SerjoPepper commented May 18, 2015

+1 on node.js version 0.12

@mattse

This comment has been minimized.

mattse commented Jun 2, 2015

Does anyone know a workaround for this? I'm running into the same error, Chef 12.2.1, node.js 0.10.31, running on CentOS7.

--------------------- EDIT ------------------------

I managed to work around this bug by manually specifying the checksum I desired by looking them up in the node release distribution checksums. So my configuration file looks like:

 "nodejs": {
   "install_method": "source",
    "version": "0.10.31",
    "source": {
      "checksum": "06c781718a674dfdfb59d646b2629a46af2644bdbf52534fab8d4a0fe34c21f1"
    }
}
@guilhem

This comment has been minimized.

Member

guilhem commented Jun 2, 2015

Have you try to set checksum to""?

@BarthV BarthV added the needs_details label Jun 5, 2015

@cnunciato

This comment has been minimized.

cnunciato commented Jun 20, 2015

@mattse Thanks for that workaround! Setting the checksum manually worked for me as well.

@BarthV BarthV added the bug label Jun 21, 2015

@shurab

This comment has been minimized.

shurab commented Sep 22, 2015

It's a chef bug. See chef/chef#2689

@lucke84

This comment has been minimized.

lucke84 commented Oct 17, 2015

It does not look like a Chef bug. I can use the checksum properly for other packages, for example Nginx (see output scrolling down).

Although, for nodejs it does not work; specifically, the recipe (my guess, indeed) seems to calulcate the checksum mistakenly.

Here's my role:

{
  "name": "my_role",
  "chef_type": "role",
  "json_class": "Chef::Role",
  "override_attributes": {
    "nginx": {
      "version": "1.7.12",
      "source": {
        "checksum": "22d1f0b6d064e125b01aeb2c6171682559d2488e1b102fc48ec564aa36e66897",
        "modules": ["nginx::http_gzip_static_module", "nginx::http_ssl_module"]
      }
    },
    "nodejs": {
      "install_method": "source",
      "version": "0.12.7",
      "source": {
        "checksum": "b23d64df051c9c969b0c583f802d5d71de342e53067127a5061415be7e12f39d"
      }
    }
  },
  "run_list": [
    "recipe[nginx::source]",
    "recipe[nodejs]"
  ]
}
Recipe: nginx::source
  * user[www-data] action create (up to date)
Recipe: nginx::ohai_plugin
  * ohai[reload_nginx] action nothing (skipped due to action :nothing)
  * template[/etc/chef/ohai_plugins/nginx.rb] action create (up to date)
Recipe: ohai::default
  * remote_directory[/etc/chef/ohai_plugins] action nothing (skipped due to action :nothing)
  * ohai[custom_plugins] action nothing (skipped due to action :nothing)
Recipe: nginx::commons_dir
  * directory[/etc/nginx] action create (up to date)
  * directory[/var/log/nginx] action create (up to date)
  * directory[/var/run] action create (up to date)
  * directory[/etc/nginx/sites-available] action create (up to date)
  * directory[/etc/nginx/sites-enabled] action create (up to date)
  * directory[/etc/nginx/conf.d] action create (up to date)
Recipe: nginx::commons_script
  * template[/usr/sbin/nxensite] action create (up to date)
  * template[/usr/sbin/nxdissite] action create (up to date)
Recipe: build-essential::debian
  * apt_package[autoconf] action install (up to date)
  * apt_package[binutils-doc] action install (up to date)
  * apt_package[bison] action install (up to date)
  * apt_package[build-essential] action install (up to date)
  * apt_package[flex] action install (up to date)
Recipe: nginx::source
  * apt_package[libpcre3] action install (up to date)
  * apt_package[libpcre3-dev] action install (up to date)
  * apt_package[libssl-dev] action install (up to date)
  * remote_file[http://nginx.org/download/nginx-1.7.12.tar.gz] action create (up to date)
Recipe: nginx::commons_conf
  * template[nginx.conf] action create (up to date)
  * template[/etc/nginx/sites-available/default] action create (up to date)
  * execute[nxensite default] action run (skipped due to not_if)
Recipe: nginx::source
  * cookbook_file[/etc/nginx/mime.types] action create (up to date)
  * bash[unarchive_source] action run (skipped due to not_if)
Recipe: nginx::http_gzip_static_module
  * template[/etc/nginx/conf.d/http_gzip_static.conf] action create (up to date)
Recipe: nginx::source
  * bash[compile_nginx_source] action run (skipped due to not_if)
Recipe: runit::default
  * service[runit] action nothing (skipped due to action :nothing)
  * execute[start-runsvdir] action nothing (skipped due to action :nothing)
  * execute[runit-hup-init] action nothing (skipped due to action :nothing)
  * apt_package[runit] action install (up to date)
Recipe: <Dynamically Defined Resource>
  * service[nginx] action nothing (skipped due to action :nothing)
Recipe: nginx::source
  * runit_service[nginx] action enable
  Recipe: <Dynamically Defined Resource>
    * directory[/etc/sv/nginx] action create (up to date)
    * template[/etc/sv/nginx/run] action create (up to date)
    * directory[/etc/sv/nginx/log] action create (up to date)
    * directory[/etc/sv/nginx/log/main] action create (up to date)
    * template[/etc/sv/nginx/log/run] action create (up to date)
    * template[/etc/sv/nginx/log/config] action create (up to date)
    * link[/etc/init.d/nginx] action create (up to date)
    - configure service runit_service[nginx]
Recipe: nginx::source
  * service[nginx] action nothing (skipped due to action :nothing)
Recipe: nodejs::install_from_source
  * apt_package[libssl-dev] action install (up to date)
  * remote_file[/usr/local/src/node-v0.12.7.tar.gz] action create_if_missing

    ================================================================================
    Error executing action `create_if_missing` on resource 'remote_file[/usr/local/src/node-v0.12.7.tar.gz]'
    ================================================================================

    Chef::Exceptions::ChecksumMismatch
    ----------------------------------
    Checksum on resource (87345a) does not match checksum on content (b23d64)

    Resource Declaration:
    ---------------------
    # In /root/chef-solo/cookbooks-2/nodejs/recipes/install_from_source.rb

If you check http://nodejs.org/dist/v0.12.7/SHASUMS256.txt you can see the checksum for the version provided by the nodejs guys is the same I input in my attributes.

And of course you can calculate it yourself:

curl -L -s http://nodejs.org/dist/v0.12.7/node-v0.12.7.tar.gz | shasum -a 256

and see that the output is:

b23d64df051c9c969b0c583f802d5d71de342e53067127a5061415be7e12f39d
@BarthV

This comment has been minimized.

Member

BarthV commented Oct 17, 2015

I will proceed some additional checks to clarify this issue.

@lucke84

This comment has been minimized.

lucke84 commented Oct 22, 2015

Please ignore my previous comment, I had mistakenly configured the cookbook, so my chef recipe was trying to install the default nodejs package using the configuration of this cookbook.

@ngtjah

This comment has been minimized.

ngtjah commented Nov 25, 2015

I ran into this today as soon as I tried to set the version to something different than the default. After setting the correct checksum I was able to install from source.

# Node.js
node.default['nodejs']['version']               = '0.10.40'
node.default['nodejs']['install_method']        = 'source'
node.default['nodejs']['npm']['install_method'] = 'source'
node.override['nodejs']['source']['checksum']   = 'bae79c2fd959aebe1629af36077bebbb760128db753da226d2344cd91499149f'

It would appear the checksum is statically set in the attributes file...

@dbabst

This comment has been minimized.

dbabst commented Mar 14, 2016

For binary installs need to override the attribute based on architecture:

default['nodejs']['binary']['checksum']['linux_x64'] = '305bf2983c65edea6dd2c9f3669b956251af03523d31cf0a0471504fd5920aac'
default['nodejs']['binary']['checksum']['linux_x86'] = '8fa2d952556c8b5aa37c077e2735c972c522510facaa4df76d4244be88f4dc0f'
default['nodejs']['binary']['checksum']['linux_arm-pi'] = '52a0f6ed9c0be1ea5f79de6527c481c1b803edbea6413a4fdc65a45ad401565d'
@tas50

This comment has been minimized.

Contributor

tas50 commented Nov 2, 2016

The checksums are correct on master now. Fixed in a release once #143 is merged

@tas50 tas50 closed this Apr 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment