Errors running "vagrant up"
Hi Kenneth,
I run a Mac with Mountain Lion (10.8) on it with the latest Virtualbox (4.2.12) and Vagrant (1.2.2). When I run "vagrant up", I get these errors, although it says the VM us running afterward. Could you perpaps shed some light on my problem please?
(output is below)
Thanks, Wim
⌘ ~/Sites/gswd/ ls
total 696
-rw-r--r--@ 1 wimo staff 305 Nov 24 01:45 Cheffile
-rw-r--r--@ 1 wimo staff 2741 Dec 1 02:10 Vagrantfile
drwxr-xr-x 18 wimo staff 612 Nov 24 01:47 cookbooks
-rw-r--r--@ 1 wimo staff 346677 May 8 04:18 gswd-vagrant.zip
drwxr-xr-x 3 wimo staff 102 Nov 23 23:21 site-cookbooks
⌘ ~/Sites/gswd/ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Box 'precise64' was not found. Fetching box from specified URL for
the provider 'virtualbox'. Note that if the URL does not have
a box for this provider, you should interrupt Vagrant now and add
the box yourself. Otherwise Vagrant will attempt to download the
full box prior to discovering this error.
Downloading or copying the box...
Extracting box...te: 665k/s, Estimated time remaining: --:--:--)
Successfully added box 'precise64' with provider 'virtualbox'!
[default] Importing base box 'precise64'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 8000 => 8888 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant
[default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[default] -- /tmp/vagrant-chef-1/chef-solo-2/cookbooks
[default] Running provisioner: shell...
[default] Running: inline script
stdin: is not a tty
Successfully installed mixlib-cli-1.3.0
Successfully installed net-ssh-2.6.7
Successfully installed chef-11.4.4
3 gems installed
[default] Running provisioner: chef_solo...
Generating chef JSON and uploading...
Running chef-solo...
stdin: is not a tty
[2013-05-08T02:32:21+00:00] INFO: *** Chef 11.4.4 ***
[2013-05-08T02:32:23+00:00] INFO: Setting the run_list to ["recipe[postgresql::server_debian]", "recipe[postgresql::ruby]", "recipe[redis::server]", "recipe[git]", "recipe[mercurial]", "recipe[emacs]", "recipe[vim]", "recipe[nano]", "recipe[gswd::database]"] from JSON
[2013-05-08T02:32:23+00:00] INFO: Run List is [recipe[postgresql::server_debian], recipe[postgresql::ruby], recipe[redis::server], recipe[git], recipe[mercurial], recipe[emacs], recipe[vim], recipe[nano], recipe[gswd::database]]
[2013-05-08T02:32:23+00:00] INFO: Run List expands to [postgresql::server_debian, postgresql::ruby, redis::server, git, mercurial, emacs, vim, nano, gswd::database]
[2013-05-08T02:32:23+00:00] INFO: Starting Chef Run for precise64
[2013-05-08T02:32:23+00:00] INFO: Running start handlers
[2013-05-08T02:32:23+00:00] INFO: Start handlers complete.
[2013-05-08T02:32:23+00:00] WARN: Missing gem 'right_aws'
================================================================================
Recipe Compile Error in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/yum/resources/key.rb
================================================================================
ArgumentError
-------------
wrong number of arguments (2 for 1)
Cookbook Trace:
---------------
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/resource/lwrp_base.rb:42:in `const_defined?'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/resource/lwrp_base.rb:42:in `build_from_file'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:208:in `load_lwrp_resource'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:193:in `load_lwrps_from_cookbook'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:192:in `each'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:192:in `load_lwrps_from_cookbook'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:120:in `compile_lwrps'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:119:in `each'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:119:in `compile_lwrps'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context/cookbook_compiler.rb:72:in `compile'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_context.rb:86:in `load'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/client.rb:224:in `setup_run_context'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/client.rb:467:in `do_run'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/client.rb:200:in `run'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/application.rb:190:in `run_chef_client'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/application/solo.rb:239:in `run_application'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/application/solo.rb:231:in `loop'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/application/solo.rb:231:in `run_application'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/application.rb:73:in `run'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/chef-solo:25
/opt/vagrant_ruby/bin/chef-solo:19:in `load'
/opt/vagrant_ruby/bin/chef-solo:19
Relevant File Content:
----------------------
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/resource/lwrp_base.rb:
35:
36: # Evaluates the LWRP resource file and instantiates a new Resource class.
37: def self.build_from_file(cookbook_name, filename, run_context)
38: rname = filename_to_qualified_string(cookbook_name, filename)
39:
40: # Add log entry if we override an existing light-weight resource.
41: class_name = convert_to_class_name(rname)
42>> if Resource.const_defined?(class_name, false)
43: old_class = Resource.send(:remove_const, class_name)
44: # CHEF-3432 -- Chef::Resource keeps a list of subclasses; need to
45: # remove old ones from the list when replacing.
46: resource_classes.delete(old_class)
47: Chef::Log.info("#{class_name} light-weight resource already initialized -- overriding!")
48: end
49:
50: resource_class = Class.new(self)
51:
[2013-05-08T02:32:24+00:00] ERROR: Running exception handlers
[2013-05-08T02:32:24+00:00] ERROR: Exception handlers complete
[2013-05-08T02:32:24+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-05-08T02:32:24+00:00] FATAL: ArgumentError: wrong number of arguments (2 for 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
⌘ ~/Sites/gswd/ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] VirtualBox VM is already running.
⌘ ~/Sites/gswd/
Answers
Weird. I tried Nathan's solution:
$ vagrant ssh
$ sudo apt-get update
$ sudo apt-get install ruby1.9.3
$ exit
$ vagrant reload
But I got this error message: ``` PS C:\Users\Chris\Documents\django_dev\gswd-vagrant> vagrant reload [default] Attempting graceful shutdown of VM... [default] Setting the name of the VM... [default] Clearing any previously set forwarded ports... [default] Creating shared folders metadata... [default] Clearing any previously set network interfaces... [default] Preparing network interfaces based on configuration... [default] Forwarding ports... [default] -- 22 => 2222 (adapter 1) [default] -- 8000 => 8888 (adapter 1) [default] Booting VM... [default] Waiting for VM to boot. This can take a few minutes. [default] VM booted and ready for use! [default] Mounting shared folders... [default] -- /vagrant [default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks [default] -- /tmp/vagrant-chef-1/chef-solo-2/cookbooks [default] Running provisioner: shell... [default] Running: inline script stdin: is not a tty Building native extensions. This could take a while... ERROR: Error installing chef: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
creating Makefile
make sh: 1: make: not found
Gem files will remain installed in /var/lib/gems/1.9.1/gems/yajl-ruby-1.1.0 for inspection. Results logged to /var/lib/gems/1.9.1/gems/yajl-ruby-1.1.0/ext/yajl/gem_make.out The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed!
chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell ```
I'm trying to get vagrant working on a Dell laptop running Windows Vista Business. The laptop is a 32 bit laptop. Not sure if that makes a difference. If someone can help me with this frustrating process, you will have my eternal gratitude. Not sure how much that is worth though...
I had the same problem and upgrading ruby to version 1.9.3 fixed it.
$ vagrant ssh
$ sudo apt-get update
$ sudo apt-get install ruby1.9.3
$ exit
$ vagrant reload
For me it was an error that vagrant up does not use the right version of chef (a to old version).
I did:
vagrant destroy
(vagrant reload did not do the trick)
And then i changed this
ruby
config.vm.provision :shell, :inline => "gem install --no-ri --no-rdoc chef"
line in the Vagrantfile to:
Ruby
config.vm.provision :shell, :inline => "gem install chef --version 11.4.2 --no-rdoc --no-ri"
And then when
vagrant up
worked.
I found the answer here: http://stackoverflow.com/questions/11325479/how-to-control-the-version-of-chef-that-vagrant-uses-to-provision-vms
I was experiencing the same error. Installing the latest version of chef from http://www.opscode.com/chef/install/ and rerunning vagrant resolved the issue. It seems to have something to do with the version mismatch of some recipes installed and the version of Ruby used in older vagrant versions.
The following worked for me
- vagrant up
- vagrant ssh
- edit line 11 in postinstall.sh - replace (ruby_ver="1.8.7-p358") with (ruby_ver="1.9.3-p429")
- execute the script - sudo ./postinstall.sh
- exit out of VM.
- vagrant halt
- vagrant up
You should now see no errors when you bring up your VM.
I was able to combine answers from a few different places to solve this problem myself.
I'm running windows 7 64bit.
You should be able to ssh to the VM despite the errors. Once you've ssh'd to the VM, install these packages:
sudo apt-get install build-essential ruby1.9.1 libopenssl-ruby ruby1.9.1-dev
It seems that the box at vagrantbox.es no longer contains build-essentials (make fails) and includes ruby 1.8.x which Chef doesn't like in this instance.
Hope this helps!
upgraded to ruby 1.9 as someone in this thread recommended but still getting the same error as OP.
After upgrading to ruby 1.9 in the VM and running "sudo ./postinstall.sh" and then "vagrant halt; vagrant up", I get the following error:
Any idea why this happens?
⌘ ~/Sites/gswd/ vagrant up Bringing machine 'default' up with 'virtualbox' provider... [default] Setting the name of the VM... [default] Clearing any previously set forwarded ports... [default] Creating shared folders metadata... [default] Clearing any previously set network interfaces... [default] Preparing network interfaces based on configuration... [default] Forwarding ports... [default] -- 22 => 2222 (adapter 1) [default] -- 8000 => 8888 (adapter 1) [default] Booting VM... [default] Waiting for VM to boot. This can take a few minutes. [default] VM booted and ready for use! [default] Configuring and enabling network interfaces... [default] Mounting shared folders... [default] -- /vagrant [default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks [default] -- /tmp/vagrant-chef-1/chef-solo-2/cookbooks [default] Running provisioner: shell... [default] Running: inline script stdin: is not a tty Building native extensions. This could take a while... ERROR: Error installing chef: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
creating Makefile
make sh: 1: make: not found
Gem files will remain installed in /var/lib/gems/1.9.1/gems/yajl-ruby-1.1.0 for inspection. Results logged to /var/lib/gems/1.9.1/gems/yajl-ruby-1.1.0/ext/yajl/gem_make.out The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed!
chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell ⌘ ~/Sites/gswd/
The version of Ruby is part of the VM so I don't think it can be that.
I decided to build my own Ubuntu Precise VM instead, install the required software and setup the port forwarding and shared folder symlinks myself.
Thanks, Wim
I had this issue but I talked with Kenneth and was able to sort it out. He mentioned below that you need ruby 1.9 instead of ruby 1.8. Here's what I did after my first "vagrant up" 1. vagrant ssh 2. sudo apt-get install ruby1.9.1-full 3. Exit your ssh session and run "vagrant halt" 4. vagrant up again and it should go through the whole process without any errors.
Worked for me, good luck!
I got a similar, if not identical error on Win 7:
←[0m ←[31mRecipe Compile Error in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/yum/resou
rces/key.rb←[0m
←[0m
←[0m ArgumentError←[0m -------------←[0m wrong number of arguments (2 for 1)←[0m
←[0m
Cookbook Trace:←[0m
---------------←[0m
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/resource/
lwrp_base.rb:42:in const_defined?'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/resource/
lwrp_base.rb:42:inbuild_from_file'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_conte
xt/cookbook_compiler.rb:208:in load_lwrp_resource'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_conte
xt/cookbook_compiler.rb:193:inload_lwrps_from_cookbook'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_conte
xt/cookbook_compiler.rb:192:in each'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_conte
xt/cookbook_compiler.rb:192:inload_lwrps_from_cookbook'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_conte
xt/cookbook_compiler.rb:120:in compile_lwrps'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_conte
xt/cookbook_compiler.rb:119:ineach'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_conte
xt/cookbook_compiler.rb:119:in compile_lwrps'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_conte
xt/cookbook_compiler.rb:72:incompile'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/run_conte
xt.rb:86:in load'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/client.rb
:224:insetup_run_context'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/client.rb
:467:in do_run'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/client.rb
:200:inrun'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/applicati
on.rb:190:in run_chef_client'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/applicati
on/solo.rb:239:inrun_application'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/applicati
on/solo.rb:231:in loop'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/applicati
on/solo.rb:231:inrun_application'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/applicati
on.rb:73:in run'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/chef-solo:25
/opt/vagrant_ruby/bin/chef-solo:19:inload'
/opt/vagrant_ruby/bin/chef-solo:19←[0m
←[0m Relevant File Content:←[0m ----------------------←[0m /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-11.4.4/bin/../lib/chef/resource/lw rp_base.rb:
35: 36: # Evaluates the LWRP resource file and instantiates a new Resource c lass. 37: def self.build_from_file(cookbook_name, filename, run_context) 38: rname = filename_to_qualified_string(cookbook_name, filename) 39: 40: # Add log entry if we override an existing light-weight resource. 41: class_name = convert_to_class_name(rname) 42>> if Resource.const_defined?(class_name, false) 43: old_class = Resource.send(:remove_const, class_name) 44: # CHEF-3432 -- Chef::Resource keeps a list of subclasses; need t o 45: # remove old ones from the list when replacing. 46: resource_classes.delete(old_class) 47: Chef::Log.info("#{class_name} light-weight resource already init ialized -- overriding!") 48: end 49: 50: resource_class = Class.new(self) 51: ←[0m
←[0m [2013-05-10T05:29:36+00:00] ERROR: Running exception handlers [2013-05-10T05:29:36+00:00] ERROR: Exception handlers complete [2013-05-10T05:29:36+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef -stacktrace.out [2013-05-10T05:29:36+00:00] FATAL: ArgumentError: wrong number of arguments (2 f or 1) Chef never successfully completed! Any errors should be visible in the output above. Please fix your recipes so that they properly complete.
I asked the guy that created the Chef recipes for me (the awesome @kantrn that the likely problem is that you've got Ruby 1.8. I'm not sure what you need to upgrade to Ruby 1.9, but that seems to be the answer.
Is this happening the Nth time after you vagrant up or the 1st time? If it's happening after the first time, it seems like that's Vagrant trying to re-run the cookbooks when it doesn't need to.
If it's happening on the first time, my best suggestion is making sure you're running the same versions of VirtualBox and Vagrant that I am (Vbox is 4.2.4 and Vagrant is 1.0.5).