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.rb
index 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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)