vagrant up fails: Error installing chef, cannot load such file -- mkmf

I've gone through lesson 1 with no issues, but am having trouble to bring vagrant up again after.

Here's the error message:

===snip=== 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

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire' from extconf.rb:1:in `

'

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

===snap===

This seems to be unrelated to other solutions offered elsewhere on the forum for similar errors (specifically make missing in guest host).

I'm on an Intel Core 2 Duo on Snow Leopard.

Sorry You must be a logged in, registered user to answer a question.

Answers

I had a similar issue on windows 8, error reads:

Error installing chef: ERROR: Failed to build gem native extension.

The way I fixed this was by

1.) editing Vagrantfile to comment out this line: #config.vm.provision :shell, :inline => "gem install --no-ri --no-rdoc chef" 2.) adding this line to the Vagrantfile which forces a version which works with the tutorial config.vm.provision :shell, :inline => "gem install --no-ri --no-rdoc chef --version '10.14.2'"

unfortunately thats a bit tough to read, the new line starts with: config.vm
badhashsolution on

I faced this problem and it can be fixed by doing the following : . $ vagrant up # and of course you will see the mentioned error $ vagrant ssh $ sudo apt-get install libopenssl-ruby ruby1.9.1-dev # not sure if we need openssl-ruby package $ exit $ vagrant halt $ vagrant up # and you should see this error again Note : the error mentioned might not have any impact , but it was very annoying to me

really sorry for that too
Mohamed Nabil Mahmoud Hafez on

I faced this problem and it can be fixed by doing the following : $ vagrant up # and of course you will see the mentioned error $ vagrant ssh $ sudo apt-get install libopenssl-ruby ruby1.9.1-dev # not sure if we need openssl-ruby package $ exit $ vagrant halt $ vagrant up # and you should see this error again

Note : the error mentioned might not have any impact , but it was very annoying to me

oh , format is not really cool , sorry for that
Mohamed Nabil Mahmoud Hafez on

Even after that, are you able to vagrant ssh? If so, Vagrant seems to have issues, sometimes, where it wants to reprovision the guest without really needing to and then fails in various ways.

Ay, caramba: the ImportError from manage.py mentioned above was only due to stupid me not sourcing the venv (source ~/blog-venv/bin/activate). So I can confirm what Juloc said: the Chef install error described at the top of this thread stands, but everything works as it should after vagrant ssh and sourcing the venv. Sorry about that.
mf3vb on
Yes, I can vagrant ssh fine; however things don't seem to work fine for me after: vagrant@precise64:/vagrant/projects/microblog$ python manage.py runserver 0.0.0.0:8000 Traceback (most recent call last): File "manage.py", line 8, in <module> from django.core.management import execute_from_command_line ImportError: No module named django.core.management vagrant@precise64:/vagrant/projects/microblog$
mf3vb on
Yes, I can vagrant ssh fine; however things don't seem to work fine for me after:
mf3vb on
I've got the same error with vagrant up, anyway i am able to vagrant ssh and everything work fine :)
Jiloc on