Plugin problem with ffi library on Windows

298 views
Skip to first unread message

Rhys Gareth

unread,
Feb 3, 2014, 5:52:37 AM2/3/14
to vagra...@googlegroups.com
We have a Vagrant-based project which is working fine on OS X and Linux but failing on Windows. The culprit is the vagrant-librarian-chef plugin. It installs without error, but causes "vagrant up" to fail:

 INFO environment: Loading plugin from JSON: vagrant-librarian-chef
ERROR root: Failed to load plugin: vagrant-librarian-chef
ERROR root:  -- Error: #<Gem::LoadError: Unable to activate chef-11.8.2-x86-ming
w32, because ffi-1.9.3-x86-mingw32 conflicts with ffi (= 1.3.1)>

The root cause appears to have been fixed here: https://tickets.opscode.com/browse/CHEF-4913 but this has not flowed through to the Vagrant plugin.

I'd try to patch this locally myself but I'm confused by how the vagrant plugin namespace works and how I would do this? e.g. could I fork the plugin, update it, build it and copy it to a local path for vagrant plugin install to use, rather than it pulling the old/unworking version from the web?

Rhys

Mitchell Hashimoto

unread,
Feb 3, 2014, 5:54:24 AM2/3/14
to vagra...@googlegroups.com
Rhys,

Since this is a bug with the gemspec of the plugin, you'd have to actually go into the "~.vagrant.d/gems/gems" folder, find the gem that depends on the wrong FFI version, and change it in that gemspec itself.

Best,
Mitchell


--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Rhys Gareth

unread,
Feb 3, 2014, 7:05:51 AM2/3/14
to vagra...@googlegroups.com
Mitchell, thank you!  Sorry, I'm not familiar with ruby/gems, so this has required some learning. I hope I can solve it in the next step/answer from you:

vagrant-librarian-chef depends up librarian-chef, which depends on chef, which has the ffi dependency problem. This has just been fixed in a release candidate version of Chef, now referenced on rubygems.org (http://rubygems.org/gems/chef)

What is the best/cleanest way to uninstall/reinstall to get this fix? I am guessing there are two alternatives:
1. Manually install the RC gem version of chef first, then run "vagrant plugin install vagrant-librarian-chef" and librarian-chef should use whatever chef version I have cached, i.e. the latest RC one.
2. Manually edit the .gemspec of librarian.chef to add dependency for the RC version of Chef, and let it automatically download that locally

Thanks again,
Rhys

Rhys Gareth

unread,
Feb 3, 2014, 4:29:32 PM2/3/14
to vagra...@googlegroups.com
I went with option 1 of the below and we now have the RC candidate of chef loaded and presumably in use. However we have a strange problem that vagrant says the plugin is installed yet then fails to load it during vagrant up. The relevant section is here:

ERROR root: Failed to load plugin: vagrant-librarian-chef
ERROR root: -- Error: #
ERROR root: -- Backtrace:
ERROR root: 
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/specification.rb:2007:in raise_if_conflicts'
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/specification.rb:1176:inactivate'
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/specification.rb:1212:in block in activate_dependencies'
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/specification.rb:1198:ineach'
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/specification.rb:1198:in activate_dependencies'
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/specification.rb:1180:inactivate'
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/specification.rb:1212:in block in activate_dependencies'
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/specification.rb:1198:ineach'
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/specification.rb:1198:in activate_dependencies'
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/specification.rb:1180:inactivate'
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems.rb:186:in rescue in try_activate'
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems.rb:183:intry_activate'
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:117:in rescue in require'
c:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:124:inrequire'
c:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant.rb:204:in require_plugin'
c:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/environment.rb:760:inblock in load_plugins'
c:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/environment.rb:751:in each'
c:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/environment.rb:751:inload_plugins'
c:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/environment.rb:132:in initialize'
c:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.3/bin/vagrant:105:innew'
c:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.3/bin/vagrant:105:in <top (required)>'
c:/HashiCorp/Vagrant/bin/../embedded/gems/bin/vagrant:23:inload'
c:/HashiCorp/Vagrant/bin/../embedded/gems/bin/vagrant:23:in `'
INFO interface: error: Failed to load the "vagrant-librarian-chef" plugin. View logs for more details.

Mitchell Hashimoto

unread,
Feb 3, 2014, 4:31:35 PM2/3/14
to vagra...@googlegroups.com
Rhys,

It looks like there might be gem conflicts. I'm sorry about that. Unfortunately your error message doesn't say exactly what... oddly. This sort of thing never will happen in the next version of Vagrant because we check for conflicts at install-time.

There must be more to that error message somewhere in the log.

best,
Mitchell

Rhys Gareth

unread,
Feb 3, 2014, 5:54:33 PM2/3/14
to vagra...@googlegroups.com
Hi Mitchell,

I got the developer to uninstall vagrant, reinstall, then run the plugin install again with debugging enabled. I've attached the full log but the key error is here:
DEBUG prune: Searching for: 'json'
ERROR prune: Missing dependency for 'chef-zero': json

This looks to be from an area of code you deleted in a pull request about a month ago - is that the next version you are talking about? Unfortunately I need this developer starting "yesterday" or else need to find a contractor with the right OS (exactly what I was hoping to avoid with Vagrant!)

What's strange to me is that "gem query --local" shows JSON: json (1.5.5)

Looking at chef's gemspec (https://github.com/opscode/chef/blob/master/chef.gemspec), this falls within their allowable range: 
  s.add_dependency "json", ">= 1.4.4", "<= 1.8.1"
Also in the vagrant debug though, I see this suspicious output:
 WARN environment: No local data path is set. Local data cannot be stored.
DEBUG environment: Loading plugins from: C:/Users/KurDt/.vagrant.d/plugins.json

Thanks,
Rhys



--
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/8rlraE3r-1I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.
debug_log.txt

Rhys Gareth

unread,
Feb 4, 2014, 6:19:14 AM2/4/14
to vagra...@googlegroups.com
I've confirmed via a second windows box that Vagrant can't load the plugin vagrant-librarian-chef. Even with a clean install, both chef and chef-zero fail to locate dependency json. Yet running $ GEM_HOME=/c:/HashiCorp/Vagrant/embedded/gems gem list results in json being found in the list. Is there any way I can manually install/force json, or skip this dependency pruning? This works fine on linux and OSX so no idea why it's a "windows thing".

Thanks,
Rhys
   

Rhys Gareth

unread,
Feb 4, 2014, 7:09:02 AM2/4/14
to vagra...@googlegroups.com
Even after manually gem installing chef, the gem pruning still fails on json. I also tried adding an earlier version of json too. Why json? Why Windows only? This really seems like a core vagrant bug at this point. Is there any help or do I need to have the developer replaced? That's easier than backing Vagrant out of our project at this point.
Reply all
Reply to author
Forward
0 new messages