Closed dkinzer closed 10 years ago
What kind of ChefSpec stuff do you have? Is there a spec_helper or anything? Are other people in this thread using ChefSpec?
@sethvargo It's a very simple setup, just a couple of very basic recipe specs ensuring that packages are installed, etc.
spec_helper.rb
require 'chefspec'
require 'chefspec/berkshelf'
ChefSpec::Coverage.start!
RSpec.configure do |config|
config.log_level = :error
config.platform = 'ubuntu'
config.version = '14.04'
end
What if you remove the require chefspec/berkshelf
line?
It's not ChefSpec. It is running the wrong ruby with the wrong environment variables.
@sethvargo No dice, I didn't imagine it would be. Simply running bundle
in my cookbook which in turn installs ChefSpec immediately makes it so I cannot provision any vagrant VMs (even ones in other projects/repos/directories.) I can repeat this in isolation over and over.
vagrant up/provision
: worksbundle
: Installs chefspecvagrant up/provision
: stops workinggem uninstall berkshelf berkshelf-api-client chef chef-zero chefspec
vagrant up/provision
: starts working againNot necessarily saying this is ChefSpec's fault, but something about this is definitely related to the breakage in my case.
As a side note, I use a crapton of software that has your contributions in it, you are awesome and thank you for writing awesome tools.
@dpehrson I think @docwhat is right - this is a Ruby issue. The fact that you're seeing it when ChefSpec is in your bundle may be related (because ChefSpec requires Chef, which brings along an entire universe of gems that could muck with the system), but I think it's a redherring tbh.
If you're using ChefDK, why aren't you using chef gem uninstall/install
?
Yeah, at the end of the day the underlying cause is obviously some sort of environment conflict which may not be anyone individual component's fault, it could just be odd interactions between a lot of things. In my case I've found out how to work around it so my problem is solved.
Here's some more enviornment information in case it helps:
$ uname -a
Darwin computer.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
$ vagrant version
Installed Version: 1.6.3
Latest Version: 1.6.3
You're running an up-to-date version of Vagrant!
$ vagrant plugin list
vagrant-berkshelf (3.0.1)
vagrant-hostmanager (1.5.0)
vagrant-login (1.0.1, system)
vagrant-omnibus (1.4.1)
vagrant-share (1.1.0, system)
vagrant-vmware-fusion (2.5.2)
Ultimately for the projects I am working on the setup to work within them is:
At that point all my vagrant machines (whether they be cookbook repos, rails execution environments, etc.) properly run.
As soon as I go into my cookbook and bundle
(which in turn installs chefspec) I can no longer provision vagrant boxes anywhere.
Again, I don't think that this is necessarily the fault of any one component, but there is something about that setup that is one vector by which you can reliably recreate this problem.
As far as the chef gem, nowhere in my process do I directly install or uninstall the chef gem. I just have to uninstall it directly after chefspec installs it as a dependency to fix my system once it's broken.
Once again, thanks to everyone for all the help and for all the awesome tools. If nothing else I hope this may assist other people in working around the issue until we have a solid understanding of exactly what's going on even if this is just a red herring.
Moving forward I just won't bundle
my cookbook on the host machine and rather run my chefspecs within the guest vagrant box.
Sorry to keep spamming you all, but I think I may have found the actual problem and as suggested, it is not chefspec.
If you install ChefDK, /usr/bin/berks
is symlinked to /opt/chefdk/bin/berks
If you later install the berkshelf
gem either directly or through a bundle, the /usr/bin/berks
symlink is replaced with the actual berks
binary from the gem. This may be why the environment gets screwed up when vagrant-berkshelf
later tries to use berks
assuming it is the ChefDK berks
when it is in fact the berks
from the gem directly.
Here's a log outlining the problem in the simplest way I can find to recreate it from within my cookbook where this all started:
# At this starting point I can provision vagrant boxes.
$ which berks
/usr/bin/berks
$ ls -l /usr/bin/berks
lrwxr-xr-x 1 root wheel 21 Aug 27 12:08 /usr/bin/berks -> /opt/chefdk/bin/berks
$ bundle
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
...
Installing berkshelf (3.1.5)
...
$ which berks
/usr/bin/berks
$ ls -l /usr/bin/berks
-rwxr-xr-x 1 root wheel 466 Aug 27 12:06 /usr/bin/berks
$ rake
...
Finished in 12.09 seconds (files took 3.92 seconds to load)
24 examples, 0 failures
$ vagrant up
Bringing machine 'default' up with 'vmware_fusion' provider...
==> default: Cloning VMware VM: 'opscode_ubuntu-14.04_chef-provisionerless'. This can take some time...
==> default: Verifying vmnet devices are healthy...
RuntimeError: Couldn't determine Berks version: #<Buff::ShellOut::Response:0x000001021bd0e8 @exitstatus=1, @stdout="", @stderr="/Applications/Vagrant/embedded/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'berkshelf' (>= 0) among 60 total gem(s) (Gem::LoadError)\n\tfrom /Applications/Vagrant/embedded/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'\n\tfrom /Applications/Vagrant/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'\n\tfrom /usr/bin/berks:22:in `<main>'\n">
$ sudo rm /usr/bin/berks
$ sudo ln -s /opt/chefdk/bin/berks /usr/bin/berks
$ rake
...
Finished in 12.09 seconds (files took 3.92 seconds to load)
24 examples, 0 failures
$ vagrant up
...
$ vagrant ssh
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)
So it appears if you are using vagrant-berkshelf/ChefDK and you later install the berkshelf gem, you need to fix /usr/bin/berks
to point back to the ChefDK binary.
Once I did that, I can both provision VM's and run my chef specs.
EDIT: Also, It does not appear you can fix this by prioritizing /opt/chefdk/bin
over /usr/bin
in your PATH either unfortunately, I truly have to fix the symlink.
Right. As I said, it is because when running berks
from vagrant it is overriding too much of the environment.
@sethvargo: Can we do something like (pseudo code):
if Gemfile exists?
run 'berks' from path with clean environment (e.g. no rearranged path, etc)
else
run '/opt/chefdk/bin/berks' with clean environment
end
@docwhat Vagrant is overriding the environment - the fix is to reset the environment back to a sane place when we shell out. The necessary changes have been made to the buff-shell_out gem but the work hasn't been done in vagrant-berkshelf just yet.
@reset How about running /opt/chefdk/bin/berks
if a Gemfile
doesn't exist? That should allow non-chefdk users and chefdk users both to work, right?
@docwhat no, there is a better way to determine if we're running inside a Bundler environment and we can't use a hardcoded path to find berkshelf since a user could install the ChefDK to a different location.
For what it's worth, downgrading to chefdk 0.1.0 worked for me (and I tried everything else above).
Well, I'll add my $0.02. More in hope that it helps someone than because I found the error cause.
Mavericks, using macports.
Been having this problem for days, have installed and uninstalled stuff, no good. Also tweaked and retweaked the path settings in .profile (see below). In my case, at least, it was not "just" tweaking the path however.
What seems to have done the trick was to re-install chefdk & vagrant, and aggressively remove all related config directories before re-installing chefdk and vagrant. Could the ~/.gem or something else have been holding on to a bad nokogiri?
afterwards: export PATH=:$HOME/.chefdk/gem/ruby/2.1.0/bin:/opt/chefdk/bin:/opt/chefdk/embedded/bin:$PATH
versions and paths:
/opt/chefdk/embedded/bin/ruby /opt/chefdk/embedded/bin/gem /opt/chefdk/embedded/bin/bundler /usr/bin/vagrant Vagrant 1.6.3 Chef Development Kit Version: 0.2.0 3.1.3
vagrant-berkshelf (3.0.1) vagrant-login (1.0.1, system) vagrant-omnibus (1.4.1) vagrant-share (1.1.0, system)
removing ~/.xxx config directories
(I actually moved them to a backup directory, just in case. script did not work well, but I did not have all those ~/.chefdk and other directories once it was done).
rm -rf /Users/myuser/.gem would probably do the trick. rm ~/.gem might not if you are running it sudo.
mv ~/.gem . mv ~/.chefdk . mv ~/.bundle . mv ~/.bundler . mv ~/.berkshelf . mv ~/.vagrant.d .
what changed:
reinstall of chefdk and vagrant went well, or rather behaved as before.
vagrant plugin install vagrant-omnibus had some errors at first (complaining about an invalid vagrant-share), but redoing it eventually rebuilt nokogiri along the way. This warning and rebuilding behavior was DIFFERENT from all my previous passes trying to fix this by re-installations.
vagrant plugin install vagrant-berkshelf went through without a hitch.
If it is of any help for folks who are running across this thread. I found that on my machine I had previously installed the berkshelf through gem install berkshelf. That needed to be uninstalled. I found this by the fact my colleague asked me to do
which berks
and
which chef
... the paths that were active didn't match up (berks was in my home directory under my .rvm/gems folder and chef was under /usr/bin/chef). After doing a
gem uninstall berkshelf
all was cool in the pool.
re. einsty's posting, that fits in with my situation as well.
I am new to chef so I first installed it by itself. Then, because my machine was already working with chef, I tried to add berkshelf by itself, rather than with Chefdk. I ran into a number of nokogiri build errors which I couldn't solve. So I ended up installing chefdk and the nokogiri issue disappeared.
Chef on its own, from Chefdk, was working at that point, but berkshelf kept having the Berks version error till I flushed out everything from the previous installs by removing their config directories as well as the binaries.
FWIW I am having a similar problem to @cmalek , Environment is OSX 10.7.5 running RVM as the ruby manager. Error output below
~/chef-repo/cookbooks/project(master ✗) vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'chef/ubuntu-14.04' is up to date...
==> default: The cookbook path '/Users/Joshua/.berkshelf/default/vagrant/berkshelf-20140905-87728-fqivar-default' doesn't exist. Ignoring...
Updating Vagrant's berkshelf: '/Users/Joshua/.berkshelf/default/vagrant/berkshelf-20140905-87728-fqivar-default'
RuntimeError: Couldn't determine Berks version: #<Buff::ShellOut::Response:0x00000103b6a888 @exitstatus=1, @stdout="", @stderr="/Applications/Vagrant/embedded/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'berkshelf' (>= 0) among 77 total gem(s) (Gem::LoadError)\n\tfrom /Applications/Vagrant/embedded/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'\n\tfrom /Applications/Vagrant/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'\n\tfrom /Users/Joshua/.rvm/gems/ruby-2.1.2/bin/berks:22:in `<main>'\n\tfrom /Users/Joshua/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'\n\tfrom /Users/Joshua/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'\n">
~/chef-repo(master ✗) vagrant plugin list
vagrant-berkshelf (3.0.1)
vagrant-login (1.0.1, system)
vagrant-omnibus (1.4.1)
vagrant-share (1.1.1, system)
ruby-2.1.2:
system:
uname: "Darwin Mansfield.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64"
system: "osx/10.7/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"
rvm:
version: "rvm 1.25.29 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "22 hours 28 minutes 28 seconds ago"
path: "/Users/Joshua/.rvm"
ruby:
interpreter: "ruby"
version: "2.1.2p95"
date: "2014-05-08"
platform: "x86_64-darwin13.0"
patchlevel: "2014-05-08 revision 45877"
full_version: "ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]"
homes:
gem: "/Users/Joshua/.rvm/gems/ruby-2.1.2"
ruby: "/Users/Joshua/.rvm/rubies/ruby-2.1.2"
binaries:
ruby: "/Users/Joshua/.rvm/rubies/ruby-2.1.2/bin/ruby"
irb: "/Users/Joshua/.rvm/rubies/ruby-2.1.2/bin/irb"
gem: "/Users/Joshua/.rvm/rubies/ruby-2.1.2/bin/gem"
rake: "/Users/Joshua/.rvm/gems/ruby-2.1.2/bin/rake"
environment:
PATH: "/Users/Joshua/.rvm/gems/ruby-2.1.2/bin:/Users/Joshua/.rvm/gems/ruby-2.1.2@global/bin:/Users/Joshua/.rvm/rubies/ruby-2.1.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/X11/bin:/usr/local/git/bin:/usr/local/MacGPG2/bin:/usr/local/git/bin:/opt/chef/embedded/bin:/usr/local/bin:/usr/local/sbin:/Users/Joshua/.cabal/bin:/usr/local/share/npm/bin:./bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/X11/bin:/usr/local/git/bin:/usr/local/MacGPG2/bin:/Users/Joshua/.rvm/bin"
GEM_HOME: "/Users/Joshua/.rvm/gems/ruby-2.1.2"
GEM_PATH: "/Users/Joshua/.rvm/gems/ruby-2.1.2:/Users/Joshua/.rvm/gems/ruby-2.1.2@global"
MY_RUBY_HOME: "/Users/Joshua/.rvm/rubies/ruby-2.1.2"
IRBRC: "/Users/Joshua/.rvm/rubies/ruby-2.1.2/.irbrc"
RUBYOPT: ""
gemset: ""
As I am not in a place where upgrading to Mavericks can happen immediately I was hoping that someone found a workaround.
@Dangeranger can you run
which berks
and
which chef
@einsty Totally, sorry to leave that out.
$ which berks
/Users/Joshua/.rvm/gems/ruby-2.1.2/bin/berks
$ which chef
chef not found
Note I installed chef as a gem from RubyGems, the Omnibus installers embedded version was not playing well with RVM.
$ which chef-client
/Users/Joshua/.rvm/gems/ruby-2.1.2@global/bin/chef-client
The gem versions are:
hmm, have you installed the ChefDk? https://downloads.getchef.com/chef-dk/mac/#/
I don't think chefdk is supported on 10.7
@einsty That's right, it's not compatible with 10.7.5, which is the version of the OS that I am running.
Ahhh. You may not be able to use Berkshelf 3 then either. The new berkshelf relies on ChefDK.
On Fri, Sep 5, 2014 at 3:41 PM, Joshua Burke notifications@github.com wrote:
@einsty https://github.com/einsty That's right, it's not compatible with 10.7.5, which is the version of the OS that I am running.
— Reply to this email directly or view it on GitHub https://github.com/berkshelf/vagrant-berkshelf/issues/212#issuecomment-54678721 .
Orin Fink, managing partner P 312.340.6503 | C 312.933.3433 | F 312.329.1963 15 West Hubbard Street, Suite 300 | Chicago, IL 60654
Yep, so I have found similarly to @cmalek that the only "Happy" path here is to upgrade to Mavericks. Which I have now done.
$ which chef
/usr/bin/chef
$ chef --version
Chef Development Kit Version: 0.2.1
$ which berks
/usr/bin/berks
At this point it appears that the ChefDK installer has removed my local gems related to chef and berks... surprised that it took that action but ok. Also Vagrant needed to be reinstalled, although I am unsure if that a result of ChefDK or Mavericks.
Now the cookbooks are getting updated, and vendored. However a Virtual Box error is getting thrown:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'chef/ubuntu-14.04' is up to date...
==> default: The cookbook path '/Users/Joshua/.berkshelf/default/vagrant/berkshelf-20140905-87728-fqivar-default' doesn't exist. Ignoring...
Updating Vagrant's berkshelf: '/Users/Joshua/.berkshelf/default/vagrant/berkshelf-20140905-87728-fqivar-default'
Resolving cookbook dependencies...
Cookbooks are found and vendored successfully
VirtualBox error message below
==> default: Clearing any previously set network interfaces...
Vagrant::Errors::VBoxManageError: There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["hostonlyif", "create"]
Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterface, interface IHostNetworkInterface
VBoxManage: error: Context: "int handleCreate(HandlerArg*, int, int*)" at line 66 of file VBoxManageHostonly.cpp
Looks like the VirtualBox error was caused by an out of date version of VirtualBox.
Upgrading to version: VirtualBox-4.3.14-95030-OSX
fixed the errors above.
Thanks for your help, @einsty
Was a resolution to the berkshelf version found?
RuntimeError: Couldn't determine Berks version: #<Buff::ShellOut::Response:0x00000102bc0658 @exitstatus=1, @stdout="", @stderr="/opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:298:in to_specs': Could not find 'berkshelf' (>= 0) among 51 total gem(s) (Gem::LoadError)\n\tfrom /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:309:in
to_spec'\n\tfrom /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:ingem'\n\tfrom /opt/chefdk/embedded/bin/berks:22:in
I am running OSX Mavericks and installed the ChefDK. I am following http://misheska.com/blog/2013/06/16/getting-started-writing-chef-cookbooks-the-berkshelf-way/#getting-started and ran into that error when doing vagrant up
@Spechal Are you using RVM? Using any Gemsets? Make sure you disable that stuff by using the system ruby when interacting with either the chef executable from the CLI or the Chef-DK directly or indirectly (aka. using vagrant-berkshelf)
Check which ruby you are using
$ which ruby
If the response is something that includes /usr/local/rvm
or ~/.rvm
then from the command line issue
$ rvm use system
And try to use vagrant-berkshelf again, you should have fewer problems with the system ruby.
I am using Ruby from Homebrew. I am not really sure how to fall back to the sytem ruby for just ChefDK; renaming embedded ruby and linking /usr/bin/ruby to embedded ruby? Seems hackish.
tcrowdermacmini:bin travis.crowder$ which ruby
/opt/chefdk/embedded/bin/ruby
tcrowdermacmini:bin travis.crowder$ pwd
/opt/chefdk/embedded/bin
tcrowdermacmini:bin travis.crowder$ ./ruby --version
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]
tcrowdermacmini:bin travis.crowder$ /usr/bin/ruby --version
ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13]
tcrowdermacmini:bin travis.crowder$
@Spechal what do you get for which berks
if it's not the chefdk version, then that's what is causing the issue.
tcrowdermacmini:myface travis.crowder$ which berks /opt/chefdk/embedded/bin/berks
I am working with two systems to try to get this going. Neither has Homebrew Ruby; I just installed RVM on one. The other will keep stock Mavericks Ruby. The stock Ruby/Mavericks has the config mentioned above.
On my fresh machine, system ruby, mavericks ... installed RVM, set RVM to use system, installed berkshelf gem, berks cookbook myface, vagrant up
traviss-mbp-2:myface tcrowder$ berks --version
r/Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3/lib/ffi/library.rb:133:in `block in ffi_lib': Could not open library '/Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_gecode.bundle': dlopen(/Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_gecode.bundle, 5): Library not loaded: /private/var/folders/j6/qzmln98j1txgbs46qhzc05fm0000gn/T/bundler20140916-6949-bpvr6m/dep-selector-libgecode-1.0.2/gems/dep-selector-libgecode-1.0.2/lib/dep-selector-libgecode/vendored-gecode/lib/libgecodesearch.32.dylib (LoadError)
Referenced from: /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_gecode.bundle
Reason: image not found
from /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3/lib/ffi/library.rb:100:in `map'
from /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3/lib/ffi/library.rb:100:in `ffi_lib'
from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/dep_gecode.rb:39:in `<module:Dep_gecode>'
from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/dep_gecode.rb:21:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/gecode_wrapper.rb:21:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/dependency_graph.rb:21:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/selector.rb:21:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector.rb:22:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/solve-1.2.1/lib/solve/solver.rb:1:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/solve-1.2.1/lib/solve.rb:10:in `require_relative'
from /Library/Ruby/Gems/2.0.0/gems/solve-1.2.1/lib/solve.rb:10:in `<module:Solve>'
from /Library/Ruby/Gems/2.0.0/gems/solve-1.2.1/lib/solve.rb:3:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/berkshelf-3.1.5/lib/berkshelf.rb:8:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Library/Ruby/Gems/2.0.0/gems/berkshelf-3.1.5/lib/berkshelf/cli.rb:1:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Library/Ruby/Gems/2.0.0/gems/berkshelf-3.1.5/bin/berks:3:in `<top (required)>'
from /opt/chefdk/bin/berks:23:in `load'
from /opt/chefdk/bin/berks:23:in `<main>'
traviss-mbp-2:myface tcrowder$```
Aside from the conversation regarding ruby (ChefDk comes with its own ruby), you do not install the berkshelf gem... rather, you should install the "vagrant-berkshelf" vagrant plugin.
On Tue, Sep 16, 2014 at 11:30 AM, Travis Crowder notifications@github.com wrote:
On my fresh machine, system ruby, mavericks ... installed RVM, set RVM to use system, installed berkshelf gem, berks cookbook myface, vagrant up
traviss-mbp-2:myface tcrowder$ berks --version r/Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3/lib/ffi/library.rb:133:in block in ffi_lib': Could not open library '/Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_gecode.bundle': dlopen(/Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_gecode.bundle, 5): Library not loaded: /private/var/folders/j6/qzmln98j1txgbs46qhzc05fm0000gn/T/bundler20140916-6949-bpvr6m/dep-selector-libgecode-1.0.2/gems/dep-selector-libgecode-1.0.2/lib/dep-selector-libgecode/vendored-gecode/lib/libgecodesearch.32.dylib (LoadError) Referenced from: /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_gecode.bundle Reason: image not found from /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3/lib/ffi/library.rb:100:inmap' from /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.3/lib/ffi/library.rb[image: :100:]in ffi_lib' from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/dep_gecode.rb:39:in module:Dep_gecode' from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/dep_gecode.rb:21:in <top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/gecode_wrapper.rb:21:in ' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/dependency_graph.rb:21:in <top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/selector.rb:21:in ' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector.rb:22:in <top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Library/Ruby/Gems/2.0.0/gems/solve-1.2.1/lib/solve/solver.rb:1:in' from /Library/Ruby/Gems/2.0.0/gems/solve-1.2.1/lib/solve.rb:10:in require_relative' from /Library/Ruby/Gems/2.0.0/gems/solve-1.2.1/lib/solve.rb:10:in module:Solve' from /Library/Ruby/Gems/2.0.0/gems/solve-1.2.1/lib/solve.rb:3:in <top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Library/Ruby/Gems/2.0.0/gems/berkshelf-3.1.5/lib/berkshelf.rb:8:in' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in require' from /Library/Ruby/Gems/2.0.0/gems/berkshelf-3.1.5/lib/berkshelf/cli.rb:1:in <top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in require' from /Library/Ruby/Gems/2.0.0/gems/berkshelf-3.1.5/bin/berks:3:in' from /opt/chefdk/bin/berks:23:in load' from /opt/chefdk/bin/berks:23:in' traviss-mbp-2:myface tcrowder$
— Reply to this email directly or view it on GitHub https://github.com/berkshelf/vagrant-berkshelf/issues/212#issuecomment-55770865 .
Orin Fink, managing partner P 312.340.6503 | C 312.933.3433 | F 312.329.1963 15 West Hubbard Street, Suite 300 | Chicago, IL 60654
Ok, I will remove it ... http://misheska.com/blog/2013/06/16/getting-started-writing-chef-cookbooks-the-berkshelf-way/#getting-started needs updated for whoever runs it, if they are on this thread.
Bollox ...
tcrowdermacmini:bin travis.crowder$ sudo gem uninstall berkshelf Password:
Select gem to uninstall:
3 Remove executables: berks
in addition to the gem? [Yn] Y Removing berks Successfully uninstalled berkshelf-3.1.5 ERROR: While executing gem ... (NoMethodError) undefined method `name' for nil:NilClass tcrowdermacmini:bin travis.crowder$ vagrant plugin install vagrant-berkshelf Installing the 'vagrant-berkshelf' plugin. This can take a few minutes... Installed the plugin 'vagrant-berkshelf (3.0.1)'! Post install message from the 'vagrant-berkshelf' plugin:
In order to use the Vagrant-Berkshelf plugin, you must have ChefDK installed. To download the latest ChefDK visit http://getchef.com/downloads/chef-dk.
ChefDK is installed.
tcrowdermacmini:bin travis.crowder$ ls -alh /usr/bin | egrep "chef|berks" lrwxr-xr-x 1 root wheel 21B Sep 15 13:34 berks -> /opt/chefdk/bin/berks lrwxr-xr-x 1 root wheel 20B Sep 15 13:34 chef -> /opt/chefdk/bin/chef lrwxr-xr-x 1 root wheel 26B Sep 15 13:34 chef-apply -> /opt/chefdk/bin/chef-apply lrwxr-xr-x 1 root wheel 27B Sep 15 13:34 chef-client -> /opt/chefdk/bin/chef-client lrwxr-xr-x 1 root wheel 26B Sep 15 13:34 chef-shell -> /opt/chefdk/bin/chef-shell lrwxr-xr-x 1 root wheel 25B Sep 15 13:34 chef-solo -> /opt/chefdk/bin/chef-solo lrwxr-xr-x 1 root wheel 25B Sep 15 13:34 chef-zero -> /opt/chefdk/bin/chef-zero lrwxr-xr-x 1 root wheel 23B Sep 15 13:34 fauxhai -> /opt/chefdk/bin/fauxhai lrwxr-xr-x 1 root wheel 26B Sep 15 13:34 foodcritic -> /opt/chefdk/bin/foodcritic lrwxr-xr-x 1 root wheel 23B Sep 15 13:34 kitchen -> /opt/chefdk/bin/kitchen lrwxr-xr-x 1 root wheel 21B Sep 15 13:34 knife -> /opt/chefdk/bin/knife lrwxr-xr-x 1 root wheel 20B Sep 15 13:34 ohai -> /opt/chefdk/bin/ohai lrwxr-xr-x 1 root wheel 23B Sep 15 13:34 rubocop -> /opt/chefdk/bin/rubocop lrwxr-xr-x 1 root wheel 20B Sep 15 13:34 shef -> /opt/chefdk/bin/shef lrwxr-xr-x 1 root wheel 22B Sep 15 13:34 strain -> /opt/chefdk/bin/strain lrwxr-xr-x 1 root wheel 24B Sep 15 13:34 strainer -> /opt/chefdk/bin/strainer tcrowdermacmini:bin travis.crowder$
Using the chruby/ruby-build environment detailed at Mischa Taylor's Coding Blog, what worked for me was installing ChefDK systemwide (AUR), uninstalling all berkshelf gems under ~/.rubies, and not actually using the chruby environment at all.
@rstrox a similar method worked for me; clean install, install chruby guided by blog post, install chefdk
I am using rvm and found the same error. In my case the problem seems that vagrant could not load berkshelf from its own gem repository. Had luck by using this:
vagrant plugin install berkshelf
vagrant plugin install vagrant-berkshelf
Okay, I work around this by deleting all gems folder in ~/vagrant.d/gems/gems
and /path/to/vagrant/embedded/gems/gems
and symlink it to /var/lib/gems/1.9.1/gems
.
It worked beautifully.
As a note, I used Ubuntu 14.04 32 bit. ChefDK doesn't support 32 bit OS. But apparently I am still able to use berkshelf
Having the same issue on Windows 8.1 - ended up doing 'gem install berkshelf' and everything worked.
If you're using the auto-switching feature in chruby
(I think others have them as well), note that it auto-mangles your $PATH
when you switch app directories. I haven't found a permanent fix (I suspect I'll need to modify the auto.sh
script), but re-mangling your path after you switch into your app's directory fixes this issue. Just export PATH="/opt/chefdk/bin:$PATH"
. I think @reset's $HOME
stuff is a local setup for his stuff. The default install of ChefDK didn't instal anything into $HOME
for me.
I recently had a similar issue so I decided to write it down so I don't forget it later http://alexfalkowski.blogspot.com.au/2014/10/configuring-chef-development-environment.html
@joestump I love chruby, but:
..it auto-mangles your $PATH when you switch app directories.
Yeaaaa. That's rather annoying and has bitten me a few times before.
I am not convinced this is a Berkshelf or Vagrant Berkshelf issue, but rather an issue with $PATHing and $PATH ordering. The path to ChefDK's bin directory must be first in your path in order for Vagrant Berkshelf to find Berkshelf. It goes like this:
berks
berks
must be resolved to the Berkshelf executable bundled in ChefDKSo, recommended debugging steps:
which berks
. If the output is anything other than ($CHEFDK)/bin/berks
, you likely have the Berkshelf gem installed on your system. Remove all instances of Berkshelf that are not part of the ChefDK.which berks
returns the path to Berkshelf in the ChefDK, it's possible you having a plugin that is modifying the path each time a new shell is loaded (like chruby). In this instance, you will need to do some research to 1. disable this functionality or 2. use a solution like suggested by @joestump's :smile:.NOT recommended solutions:
~/.vagrant.d/gems
($CHEFDK)/{gems, bin, etc}
If you start creating symlinks and moving files around inside of Vagrant and/or ChefDK, you risk ruining the upgrade path or breaking things beyond repair.
I have faced this issue to. I have installed on my Mac OS x 10.9:
Steps that I performed to resolve this issue:
@joestump 's solution worked for me.
export PATH="/opt/chefdk/bin:$PATH"
In the meantime my temporary solution is to sandbox the PATH in my project until I can sort this out. BTW, I'm using rbenv on Mac OS X Yosemite.
Same as @pedrocarrico , @joestump 's solution worked for me on a MacBookPro11,1 with OS X Yosemite 10.10.2 installed.
export PATH="/opt/chefdk/bin:$PATH"
You might find https://github.com/docwhat/rbenv-chefdk useful
I got the same error:
Monas-MacBook-Pro:~ mona$ chef --v
Chef Development Kit Version: 0.15.16
chef-client version: 12.11.18
delivery version: master (444effdf9c81908795e88157f01cd667a6c43b5f)
berks version: ERROR
kitchen version: 1.10.0
Monas-MacBook-Pro:~ mona$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.5
BuildVersion: 14F1713
After I changed the bashrc to what @ursachec told it worked for me:
Monas-MacBook-Pro:~ mona$ vi ~/.bashrc
Monas-MacBook-Pro:~ mona$ source ~/.bashrc
nvm is not compatible with the npm config "prefix" option: currently set to "/usr/local"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.0.0 --silent` to unset it.
Monas-MacBook-Pro:~ mona$ chef --v
Chef Development Kit Version: 0.15.16
chef-client version: 12.11.18
delivery version: master (444effdf9c81908795e88157f01cd667a6c43b5f)
berks version: 4.3.5
kitchen version: 1.10.0
I added this line in bashrc: export PATH="/opt/chefdk/bin:$PATH"
I don't use RVM anymore but I was never able to get it to play nicely with ChefDK when I last played with it. That's why I wrote the rbenv-chefdk plugin mentioned above.
I'm getting this error after upgrading the vagrant-berkshelf plugin:
Version details:
Gemfile
Vagrantfile