I am using Vagrant to test my Chef recipes in Amazon AWS, and I am encountering an irritating issue:
I initially assumed that Vagrant would install chef itself (as it does when using Virtual Box as the provider) but it seems that this needs to be done using the cloud-init script. However, even after I successfully installed the chef gem via cloud-init I was still getting the following error:
The chef binary (eitherchef-solo
) was not found
A quick google of this error suggested three probable causes:
- Chef had failed to install
- It had installed, but the directory was not in the $PATH environment variable
- It had installed and in the $PATH but with incorrect permissions
I logged in and double checked; chef-solo and chef-client were installed; The path variable for the user, sudo and root all included
/usr/local/bin and permissions were all fine.
I managed to solve this problem by uninstalling and reinstalling the gem using
sudo gem install chef. I don't understand why this should resolve the issue and it is a bit of a problem if I have to ssh into a test box and manually install the gem every time.
Does anyone have any suggestions why this might be happening?