The chef (either `chef-solo` or `chef-client`) binary was not found on...

1,419 views
Skip to first unread message

David Nonnenmacher

unread,
Aug 12, 2011, 4:26:39 AM8/12/11
to Vagrant
Hello,

I try to use the provioning feature but I got the following error
message:

[default] Attempting graceful shutdown of linux...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- ssh: 22 => 2222 (adapter 1)
[default] Cleaning previously set shared folders...
[default] Creating shared folders metadata...
[default] Running any VM customizations...
[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] -- v-root: /vagrant
[default] -- v-csc-2: /tmp/vagrant-chef-4/chef-solo-1
[default] Running provisioner: Vagrant::Provisioners::ChefSolo...
The chef (either `chef-solo` or `chef-client`) binary was not found
on
the VM and is required for chef provisioning. Please verify that chef
is installed and that the binary is available on the PATH.

I created the vm using veewee + vagrant (as explainded in the tutorial
on veewee website).
I checked on the vm, both chef-solo and chef-client are in the path.

[vagrant@localhost ~]$ which chef-solo
/usr/local/bin/chef-solo

[vagrant@localhost ~]$ which chef-client
/usr/local/bin/chef-client

The content of the Vagrantfile is :

config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe("vagrant_main")
end

With the files located in the vm directory:

cookbooks/
└── vagrant_main

The file vagrant_main contains:

require_recipe "mysql"

I check in the file session.rb:

def sudo!(commands, options=nil, &block)
channel = session.open_channel do |ch|
ch.exec("sudo -H #{env.config.ssh.sudo_shell} -l") do |ch2,
success|

So I had the PATH in env_keep in /etc/sudoers, so this way, it works.

BUT

I found a pull request https://github.com/mitchellh/vagrant/pull/301
very close to the problem I encountered. But I'm not sure about the
solution, because it's not a problem of sh vs bash. In the case of my
base box, I have the same behaviour for sh and for bash:

[vagrant@localhost ~]$ sudo -S bash
[root@localhost ~]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/bin:/bin

[vagrant@localhost ~]$ sudo -S sh
sh-3.2# echo $PATH
/usr/bin:/bin

In both, the root has no access to the content of /usr/local/bin...

My question is what is the best solution ? 1) update the file /etc/
sudoers to keep the PATH variable or 2) add the directory /usr/local/
bin in the PATH for the user root.

-- David

Mitchell Hashimoto

unread,
Aug 16, 2011, 12:44:54 AM8/16/11
to vagra...@googlegroups.com
I'd recommend updating the sudoers file to append the PATH to include the directory which chef is in. This is typically very easy and can be done with some "sed" using VeeWee.

Best,
Mitchell
 
-- David


David Nonnenmacher

unread,
Aug 17, 2011, 9:56:39 AM8/17/11
to Vagrant
Thank you for your help.

Regards

-- David

On Aug 16, 6:44 am, Mitchell Hashimoto <mitchell.hashim...@gmail.com>
wrote:
> > I found a pull requesthttps://github.com/mitchellh/vagrant/pull/301
Reply all
Reply to author
Forward
0 new messages