ubuntu 14.04 - Vagrant provisioning - installing ruby version on rbenv fails -


i'm having problems installing ruby version using rbenv on ubuntu 14.04 (on vagrant, berkshelf, virtualbox running on windows 10).

here berksfile:

source "https://supermarket.chef.io"  cookbook 'apt' cookbook 'build-essential' cookbook 'mysql', '5.5.3' cookbook 'postgresql', '~> 4.0.6' cookbook 'ruby_build' #cookbook 'rbenv', git: 'https://github.com/aminin/chef-rbenv.git' #cookbook 'rbenv', git: 'https://github.com/chef-rbenv/chef_rbenv' cookbook 'ruby_rbenv', git: 'https://github.com/chef-rbenv/ruby_rbenv' #'~> 1.0.1'  cookbook 'vim' cookbook 'nodejs', '~> 2.4.4' cookbook 'chef-vagrant-frontback', path: 'chef-vagrant-frontback' 

vagrantfile:

# -*- mode: ruby -*- # vi: set ft=ruby :  vagrant.require_version '>= 1.5'  # change these 2 paths folders  # frontend  = "../linkip-frontend/" backend_path   = "../linkip-backend/" backend_name   = "linkip-backend"  def require_plugins(plugins = {})   needs_restart = false   plugins.each |plugin, version|     next if vagrant.has_plugin?(plugin)     cmd =       [         'vagrant plugin install',         plugin       ]     cmd << "--plugin-version #{version}" if version     system(cmd.join(' ')) || exit!     needs_restart = true   end   exit system('vagrant', *argv) if needs_restart end  require_plugins \   'vagrant-bindfs' => '0.4.8',    #'vagrant-librarian-chef-nochef' => '0.2.0',    'vagrant-berkshelf' => '4.1.0',   'vagrant-vbguest' => '0.12.0'   vagrant.configure("2") |config|   config.vm.box = "ubuntu/trusty64"    config.vm.network "forwarded_port", guest: 80, host: 8080   config.vm.network "forwarded_port", guest: 3000, host: 3000    config.vm.network "forwarded_port", guest: 4567, host: 4567    config.vm.provider :virtualbox |vb|     vb.customize ["modifyvm", :id, "--memory", "2048"]   end    config.vm.synced_folder "#{backend_path}", "/project/#{backend_name}",     # tell vagrant use rsync shared folder.     type: "rsync",     rsync__auto: "true",     rsync__exclude: ".git/",     owner: "vagrant",     group: "vagrant",     id: "shared-folder-id"    # config.vm.synced_folder "#{frontend}", "/project/#{frontend}",   #   # tell vagrant use rsync shared folder.   #   type: "rsync",   #   rsync__auto: "true",   #   rsync__exclude: ".git/",   #   owner: "vagrant",   #   group: "vagrant",   #   id: "shared-folder-id"    config.berkshelf.enabled = true    # use chef solo provision our virtual machine   config.vm.provision :chef_solo |chef|     chef.cookbooks_path = ["cookbooks", "site-cookbooks"]      chef.add_recipe "apt"     chef.add_recipe "nodejs"     chef.add_recipe "ruby_build"     chef.add_recipe "ruby_rbenv::user"     #chef.add_recipe "rbenv::vagrant"     chef.add_recipe "vim"     chef.add_recipe "mysql::server"     chef.add_recipe "mysql::client"     chef.add_recipe "chef-vagrant-frontback"      # install ruby 2.2.1 , bundler     # set empty root password mysql make things simple     chef.json = {       rbenv: {         user_installs: [{           user: 'vagrant',           rubies: ["2.2.1"],           global: "2.2.1",           gems: {             "2.2.1" => [               { name: "bundler" },                { name: "rake" },                { name: "rails",                  version: "4.2.4"               }             ]           }         }]       },       mysql: {         server_root_password: ''       }     }   end end 

and part of log starts showing erros:

==> default: [2016-07-12t02:53:13+00:00] info: building ruby_rbenv_ruby[2.2.1 (vagrant)] (vagrant), take while... ==> default: ==> default: * ruby_rbenv_script[rbenv install 2.2.1  (vagrant)] action run ==> default: ==> default: * script[rbenv install 2.2.1  (vagrant)] action run ==> default: ==> default:         [execute] downloading ruby-2.2.1.tar.bz2... ==> default:                   -> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.1.tar.bz2 ==> default:                   installing ruby-2.2.1... ==> default: ==> default:                   build failed ==> default:  (ubuntu 14.04 using ruby-build 20160602) ==> default: ==> default:                   inspect or clean working tree @ /tmp/ruby-build.20160712025313.30196 ==> default: ==> default: results logged /tmp/ruby-build.20160712025313.30196.log ==> default: ==> default: ==> default: last 10 log lines: ==> default:                   make[3]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1/ext/fiddle/libffi-3.2.1' ==> default:                   linking shared-object fiddle.so ==> default:                   /usr/bin/ld: ./libffi-3.2.1/.libs/libffi.a(raw_api.o): relocation r_x86_64_32s against `.rodata' can not used when making shared object; recompile -fpic ==> default:                   ./libffi-3.2.1/.libs/libffi.a: error adding symbols: bad value ==> default:                   collect2: error: ld returned 1 exit status ==> default:                   make[2]: *** [../../.ext/x86_64-linux/fiddle.so] error 1 ==> default:                   make[2]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1/ext/fiddle' ==> default:                   make[1]: *** [ext/fiddle/all] error 2 ==> default:                   make[1]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1' ==> default:                   make: *** [build-ext] error 2 ==> default: ==> default: ==> default: ==> default: ================================================================================ ==> default: ==> default:         error executing action `run` on resource 'script[rbenv install 2.2.1  (vagrant)]' ==> default:         ================================================================================ ==> default: ==> default:         mixlib::shellout::shellcommandfailed ==> default:         ------------------------------------ ==> default:         expected process exit [0], received '1' ==> default:         ---- begin output of "bash"  "/tmp/chef-script20160712-29543-1b85p2w" ---- ==> default:         stdout: ==> default:         stderr: downloading ruby-2.2.1.tar.bz2... ==> default:         -> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.1.tar.bz2 ==> default:         installing ruby-2.2.1... ==> default: ==> default:         build failed (ubuntu 14.04 using ruby-build 20160602) ==> default: ==> default:         inspect or clean working tree @ /tmp/ruby-build.20160712025313.30196 ==> default:         results logged /tmp/ruby-build.20160712025313.30196.log ==> default: ==> default:         last 10 log lines: ==> default:         make[3]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1/ext/fiddle/libffi-3.2.1' ==> default:         linking shared-object fiddle.so ==> default: ==> default: ==> default: /usr/bin/ld: ./libffi-3.2.1/.libs/libffi.a(raw_api.o): relocation r_x86_64_32s against `.rodata' can not used when making shared object; recompile -fpic ==> default: ==> default:         ./libffi-3.2.1/.libs/libffi.a: error adding symbols: bad value ==> default:         collect2: error: ld returned 1 exit status ==> default: ==> default: make[2]: *** [../../.ext/x86_64-linux/fiddle.so] error 1 ==> default:         make[2]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1/ext/fiddle' ==> default:         make[1]: *** [ext/fiddle/all] error 2 ==> default:         make[1]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1' ==> default:         make: *** [build-ext] error 2 ==> default:         ---- end output of "bash"  "/tmp/chef-script20160712-29543-1b85p2w" ---- ==> default:         ran "bash"  "/tmp/chef-script20160712-29543-1b85p2w" returned 1 ==> default: ==> default:         cookbook trace: ==> default:         --------------- ==> default:         /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action' ==> default:         /var/chef/cache/cookbooks/ruby_rbenv/providers/ruby.rb:78:in `perform_install' ==> default:         /var/chef/cache/cookbooks/ruby_rbenv/providers/ruby.rb:38:in `block in class_from_file' ==> default:         /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action' ==> default: ==> default:         resource declaration: ==> default:         --------------------- ==> default:         # in /var/chef/cache/cookbooks/ruby_rbenv/providers/script.rb ==> default: ==> default:          40:   script new_resource.name ==> default:          41:     interpreter 'bash' ==> default:          42:     code script_code ==> default:          43:     user new_resource.user if new_resource.user ==> default:          44:     creates new_resource.creates if new_resource.creates ==> default:          45:     cwd new_resource.cwd if new_resource.cwd ==> default:          46:     group new_resource.group if new_resource.group ==> default:          47:     returns new_resource.returns if new_resource.returns ==> default:          48:     timeout new_resource.timeout if new_resource.timeout ==> default:          49:     umask new_resource.umask if new_resource.umask ==> default:          50: ==> default:          51:     environment(script_environment) ==> default:          52:   end ==> default:          53: end ==> default: ==> default: ==> default:         compiled resource: ==> default:         ------------------ ==> default:         # declared in /var/chef/cache/cookbooks/ruby_rbenv/providers/script.rb:40:in `run_script' ==> default: ==> default:         script("rbenv install 2.2.1  (vagrant)") ==> default:           action [:run] ==> default:           retries 0 ==> default:           retry_delay 2 ==> default:           default_guard_interpreter :default ==> default:           command "rbenv install 2.2.1  (vagrant)" ==> default:           backup 5 ==> default:           environment {"rbenv_root"=>"/home/vagrant/.rbenv", "user"=>"vagrant", "home"=>"/home/vagrant"} ==> default:           returns [0] ==> default:           user "vagrant" ==> default:           code "export rbenv_root=\"/home/vagrant/.rbenv\"\nexport path=\"${rbenv_root}/bin:$path\"\neval \"$(rbenv init -)\"\nrbenv install 2.2.1 \n" ==> default:           interpreter "bash" ==> default:           declared_type :script ==> default:           cookbook_name "ruby_rbenv" ==> default:         end ==> default: ==> default:         platform: ==> default:         --------- ==> default:         x86_64-linux ==> default: ==> default: ==> default: [2016-07-12t03:17:44+00:00] info: running queued delayed notifications before re-raising exception ==> default: ==> default: ==> default: ==> default: ================================================================================ ==> default: ==> default:       error executing action `run` on resource 'ruby_rbenv_script[rbenv install 2.2.1  (vagrant)]' ==> default:       ================================================================================ ==> default: ==> default:       mixlib::shellout::shellcommandfailed ==> default:       ------------------------------------ ==> default:       script[rbenv install 2.2.1  (vagrant)] (/var/chef/cache/cookbooks/ruby_rbenv/providers/script.rb line 40) had error: mixlib::shellout::shellcommandfailed: expected process exit [0], received '1' ==> default:       ---- begin output of "bash"  "/tmp/chef-script20160712-29543-1b85p2w" ---- ==> default:       stdout: ==> default:       stderr: downloading ruby-2.2.1.tar.bz2... ==> default:       -> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.1.tar.bz2 ==> default:       installing ruby-2.2.1... ==> default: ==> default:       build failed (ubuntu 14.04 using ruby-build 20160602) ==> default: ==> default: ==> default: inspect or clean working tree @ /tmp/ruby-build.20160712025313.30196 ==> default:       results logged /tmp/ruby-build.20160712025313.30196.log ==> default: ==> default:       last 10 log lines: ==> default:       make[3]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1/ext/fiddle/libffi-3.2.1' ==> default:       linking shared-object fiddle.so ==> default:       /usr/bin/ld: ./libffi-3.2.1/.libs/libffi.a(raw_api.o): relocation r_x86_64_32s against `.rodata' can not used when making shared object; recompile -fpic ==> default:       ./libffi-3.2.1/.libs/libffi.a: error adding symbols: bad value ==> default:       collect2: error: ld returned 1 exit status ==> default:       make[2]: *** [../../.ext/x86_64-linux/fiddle.so] error 1 ==> default:       make[2]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1/ext/fiddle' ==> default:       make[1]: *** [ext/fiddle/all] error 2 ==> default:       make[1]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1' ==> default:       make: *** [build-ext] error 2 ==> default:       ---- end output of "bash"  "/tmp/chef-script20160712-29543-1b85p2w" ---- ==> default:       ran "bash"  "/tmp/chef-script20160712-29543-1b85p2w" returned 1 ==> default: ==> default:       cookbook trace: ==> default:       --------------- ==> default:       /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action' ==> default:       /var/chef/cache/cookbooks/ruby_rbenv/providers/ruby.rb:78:in `perform_install' ==> default:       /var/chef/cache/cookbooks/ruby_rbenv/providers/ruby.rb:38:in `block in class_from_file' ==> default:       /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action' ==> default: ==> default:       resource declaration: ==> default:       --------------------- ==> default:       # in /var/chef/cache/cookbooks/ruby_rbenv/providers/ruby.rb ==> default: ==> default:        72:     rbenv_script "#{command} #{which_rbenv}" ==> default:        73:       code command ==> default:        74:       user rbenv_user if rbenv_user ==> default:        75:       root_path rbenv_prefix if rbenv_prefix ==> default:        76:       environment rbenv_env if rbenv_env ==> default:        77:       action :nothing ==> default:        78:     end.run_action(:run) ==> default:        79: ==> default:        80:     chef::log.debug("#{new_resource} build time " \ ==> default:        81:       "#{(time.now - install_start) / 60.0} minutes") ==> default: ==> default:  82: ==> default: ==> default: ==> default:  83:     new_resource.updated_by_last_action(true) ==> default: ==> default: ==> default:  84:   end ==> default: ==> default:        85: end ==> default: ==> default:       compiled resource: ==> default:       ------------------ ==> default:       # declared in /var/chef/cache/cookbooks/ruby_rbenv/providers/ruby.rb:72:in `perform_install' ==> default: ==> default:       ruby_rbenv_script("rbenv install 2.2.1  (vagrant)") ==> default:         action [:nothing] ==> default:         retries 0 ==> default:         retry_delay 2 ==> default:         default_guard_interpreter :default ==> default:         declared_type :rbenv_script ==> default:         cookbook_name "ruby_rbenv" ==> default:         user "vagrant" ==> default:         code "rbenv install 2.2.1 " ==> default:         returns [0] ==> default:       end ==> default: ==> default:       platform: ==> default:       --------- ==> default:       x86_64-linux ==> default: ==> default: ==> default: ==> default: ==> default:     ================================================================================ ==> default:     error executing action `install` on resource 'ruby_rbenv_ruby[2.2.1 (vagrant)] (vagrant)' ==> default:     ================================================================================ ==> default: ==> default:     mixlib::shellout::shellcommandfailed ==> default:     ------------------------------------ ==> default:     ruby_rbenv_script[rbenv install 2.2.1  (vagrant)] (/var/chef/cache/cookbooks/ruby_rbenv/providers/ruby.rb line 72) had error: mixlib::shellout::shellcommandfailed: script[rbenv install 2.2.1  (vagrant)] (/var/chef/cache/cookbooks/ruby_rbenv/providers/script.rb line 40) had error: mixlib::shellout::shellcommandfailed: expected process exit [0], received '1' ==> default:     ---- begin output of "bash"  "/tmp/chef-script20160712-29543-1b85p2w" ---- ==> default:     stdout: ==> default:     stderr: downloading ruby-2.2.1.tar.bz2... ==> default:     -> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.1.tar.bz2 ==> default:     installing ruby-2.2.1... ==> default: ==> default:     build failed (ubuntu 14.04 using ruby-build 20160602) ==> default: ==> default:     inspect or clean working tree @ /tmp/ruby-build.20160712025313.30196 ==> default:     results logged /tmp/ruby-build.20160712025313.30196.log ==> default: ==> default:     last 10 log lines: ==> default:     make[3]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1/ext/fiddle/libffi-3.2.1' ==> default:     linking shared-object fiddle.so ==> default: ==> default: /usr/bin/ld: ./libffi-3.2.1/.libs/libffi.a(raw_api.o): relocation r_x86_64_32s against `.rodata' can not used when making shared object; recompile -fpic ==> default: ==> default: ==> default: ./libffi-3.2.1/.libs/libffi.a: error adding symbols: bad value ==> default:     collect2: error: ld returned 1 exit status ==> default:     make[2]: *** [../../.ext/x86_64-linux/fiddle.so] error 1 ==> default:     make[2]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1/ext/fiddle' ==> default:     make[1]: *** [ext/fiddle/all] error 2 ==> default:     make[1]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1' ==> default: ==> default: make: *** [build-ext] error 2 ==> default: ==> default: ==> default: ---- end output of "bash"  "/tmp/chef-script20160712-29543-1b85p2w" ---- ==> default: ==> default:     ran "bash"  "/tmp/chef-script20160712-29543-1b85p2w" returned 1 ==> default: ==> default:     cookbook trace: ==> default:     --------------- ==> default:     /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action' ==> default:     /var/chef/cache/cookbooks/ruby_rbenv/providers/ruby.rb:78:in `perform_install' ==> default:     /var/chef/cache/cookbooks/ruby_rbenv/providers/ruby.rb:38:in `block in class_from_file' ==> default:     /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action' ==> default: ==> default:     resource declaration: ==> default:     --------------------- ==> default:     # in /var/chef/cache/cookbooks/ruby_rbenv/recipes/user.rb ==> default: ==> default:      47:       rbenv_ruby "#{rubie} (#{rbenv_user['user']})" ==> default:      48:         definition rubie ==> default:      49:         user rbenv_user['user'] ==> default:      50:         root_path rbenv_user['root_path'] if rbenv_user['root_path'] ==> default:      51:       end ==> default:      52:     end ==> default: ==> default: ==> default: ==> default: ==> default: ==> default: compiled resource: ==> default: ==> default: ------------------ ==> default:     # declared in /var/chef/cache/cookbooks/ruby_rbenv/recipes/user.rb:47:in `block (2 levels) in from_file' ==> default: ==> default:     ruby_rbenv_ruby("2.2.1 (vagrant)") ==> default:       action [:install] ==> default:       retries 0 ==> default:       retry_delay 2 ==> default:       default_guard_interpreter :default ==> default:       declared_type :rbenv_ruby ==> default:       cookbook_name "ruby_rbenv" ==> default:       recipe_name "user" ==> default:       definition "2.2.1" ==> default:       user "vagrant" ==> default:       rbenv_action "install" ==> default:     end ==> default: ==> default:     platform: ==> default:     --------- ==> default:     x86_64-linux ==> default: ==> default: ==> default: [2016-07-12t03:17:44+00:00] info: running queued delayed notifications before re-raising exception ==> default: ==> default: running handlers: ==> default: [2016-07-12t03:17:44+00:00] error: running exception handlers ==> default: running handlers complete ==> default: [2016-07-12t03:17:44+00:00] error: exception handlers complete ==> default: chef client failed. 3 resources updated in 27 minutes 25 seconds ==> default: [2016-07-12t03:17:44+00:00] fatal: stacktrace dumped /var/chef/cache/chef-stacktrace.out ==> default: [2016-07-12t03:17:44+00:00] fatal: please provide contents of stacktrace.out file if file bug report ==> default: [2016-07-12t03:17:44+00:00] error: ruby_rbenv_ruby[2.2.1 (vagrant)] (vagrant) (ruby_rbenv::user line 47) had error: mixlib::shellout::shellcommandfailed: ruby_rbenv_script[rbenv install 2.2.1  (vagrant)] (/var/chef/cache/cookbooks/ruby_rbenv/providers/ruby.rb line 72) had error: mixlib::shellout::shellcommandfailed: script[rbenv install 2.2.1  (vagrant)] (/var/chef/cache/cookbooks/ruby_rbenv/providers/script.rb line 40) had error: mixlib::shellout::shellcommandfailed: expected process exit [0], received '1' ==> default: ---- begin output of "bash"  "/tmp/chef-script20160712-29543-1b85p2w" ---- ==> default: stdout: ==> default: stderr: downloading ruby-2.2.1.tar.bz2... ==> default: -> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.1.tar.bz2 ==> default: installing ruby-2.2.1... ==> default: ==> default: build failed (ubuntu 14.04 using ruby-build 20160602) ==> default: ==> default: inspect or clean working tree @ /tmp/ruby-build.20160712025313.30196 ==> default: results logged /tmp/ruby-build.20160712025313.30196.log ==> default: ==> default: last 10 log lines: ==> default: make[3]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1/ext/fiddle/libffi-3.2.1' ==> default: linking shared-object fiddle.so ==> default: /usr/bin/ld: ./libffi-3.2.1/.libs/libffi.a(raw_api.o): relocation r_x86_64_32s against `.rodata' can not used when making shared object; recompile -fpic ==> default: ./libffi-3.2.1/.libs/libffi.a: error adding symbols: bad value ==> default: collect2: error: ld returned 1 exit status ==> default: make[2]: *** [../../.ext/x86_64-linux/fiddle.so] error 1 ==> default: make[2]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1/ext/fiddle' ==> default: make[1]: *** [ext/fiddle/all] error 2 ==> default: make[1]: leaving directory `/tmp/ruby-build.20160712025313.30196/ruby-2.2.1' ==> default: make: *** [build-ext] error 2 ==> default: ---- end output of "bash"  "/tmp/chef-script20160712-29543-1b85p2w" ---- ==> default: ran "bash"  "/tmp/chef-script20160712-29543-1b85p2w" returned 1 ==> default: [2016-07-12t03:17:44+00:00] fatal: chef::exceptions::childconvergeerror: chef run process exited unsuccessfully (exit code 1) chef never completed! errors should visible in output above. please fix recipes complete. 

i've tried different versions of rbenv cookbooks seems error same. has encountered error before?

ok after digging found info on official ruby-build github page

so since wanted use provisioning , didn't want users install them own added berksfile cookbook:

cookbook 'libffi-dev', git: 'https://github.com/zchee/libffi-dev-cookbook'

abd vagrantfile line:

chef.add_recipe "libffi-dev"

right after line apt.

the whole project here if play it.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -