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