Can't install vagrant plugins in Ubuntu Can't install vagrant plugins in Ubuntu ruby ruby

Can't install vagrant plugins in Ubuntu


Yes, there is an issue: https://github.com/mitchellh/vagrant/issues/7073 in Vagrant 1.8.1

PR with fix: https://github.com/mitchellh/vagrant/pull/7198

The fix should be released in Vagrant 1.8.2.


But until that you can patch it manually.

Here are the steps to fix Vagrant 1.8.1 under Ubuntu 16.04 which has ruby 2.3.0.

1.) Create file vagrant-plugin.patch with the following contents:

--- lib/vagrant/bundler.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rbindex 5a5c185..c4a3837 100644--- a/lib/vagrant/bundler.rb+++ b/lib/vagrant/bundler.rb@@ -272,7 +272,6 @@ module Vagrant       # Reset the all specs override that Bundler does       old_all = Gem::Specification._all-      Gem::Specification.all = nil       # /etc/gemrc and so on.       old_config = nil@@ -286,6 +285,8 @@ module Vagrant       end       Gem.configuration = NilGemConfig.new+      Gem::Specification.reset+       # Use a silent UI so that we have no output       Gem::DefaultUserInteraction.use_ui(Gem::SilentUI.new) do     return yield

2.) Apply patch:

sudo patch --directory /usr/lib/ruby/vendor_ruby/vagrant < vagrant-plugin.patch

which fixes /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb.


Instead of patching, I fixed the issue using vagrant v1.8.0 in ubuntu 16.04:

  • Download package: wget https://releases.hashicorp.com/vagrant/1.8.0/vagrant_1.8.0_x86_64.deb
  • sudo dpkg -i vagrant_1.8.0_x86_64.deb
  • vagrant plugin install vagrant-vbguest

Keep an eye and upgrade to 1.8.2 when it's released...Enjoy!


This is fixed in the recent version of Vagrant, so please upgrade it.

If you can't, run this command to fix the problem:

sudo sed -i'' "s/Specification.all = nil/Specification.reset/" /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb

Note: The sudo permission is required or run without as a root.

This will patch your bundler.rb file as per PR (#7198).

You should also upgrade your bundler to at least 1.12.5 as per this vagrant PR (#7404):

sudo gem install bundler --version ">= 1.12.5"