mbdev
mbdev

Reputation: 6583

Vagrant / Chef-solo not working after running recipe rvm::vagrant

After adding recipe rvm::vagrant and running vagrant provision I got:

/usr/local/bin/chef-solo: line 23: /opt/vagrant_ruby/bin/chef-solo: No such file 
or directory
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

This issue should have been fixed: https://github.com/fnichol/chef-rvm/issues/121

Even though I add the line:

'rvm' => {
    'vagrant' => {
      'system_chef_solo' => '/opt/vagrant_ruby/bin/chef-solo'
    }
  }

I am still getting the error. How can I recover from it?

Upvotes: 7

Views: 1419

Answers (2)

Jay Killeen
Jay Killeen

Reputation: 2922

This has been frustrating as answers are very time dependent. I have had this issue though and fixed it today by adding to my Vagrantfile. I had to vagrant destroy and vagrant up again so hopefully this doesn't break next time I vagrant provision but I have checked in the box and it looks like the path to chef-solo is correct. Found this answer out on Github at here

chef.json = {
  rvm: {
        vagrant: {
          system_chef_solo: '/opt/chef/bin/chef-solo'
        },
        user_installs: [
            {
                user: 'vagrant',
                default_ruby: '2.2.1',
                rubies: ['2.2.1'],
                global: '2.2.1'
            }
        ]
    },
... rest of Vagrantfile

Upvotes: 0

Dmitriy Budnik
Dmitriy Budnik

Reputation: 1576

You have to make sure that '/opt/vagrant_ruby/bin/chef-solo' is actual path of chef-solo. In my case it was /usr/bin/chef-solo. And this is part of my Vagrantfile that fixed it:

config.vm.provision :chef_solo do |chef|
  chef.json.merge! rvm: {vagrant: {system_chef_solo: '/usr/bin/chef-solo'}}
end

Upvotes: 6

Related Questions