简体   繁体   中英

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM