Vagrant: Vagrant Fails to start due to rubygems error

Created on 26 Apr 2018  ยท  6Comments  ยท  Source: hashicorp/vagrant

Vagrant version

vagrant -v
/usr/local/lib/site_ruby/2.3.0/rubygems.rb:289:in find_spec_for_exe': can't find gem vagrant (>= 0.a) with executable vagrant (Gem::GemNotFoundException) from /usr/local/lib/site_ruby/2.3.0/rubygems.rb:308:inactivate_bin_path'
from /usr/local/bin/vagrant:23:in `

'

I installed Vagrant 2.0.4 following the standard install instructions.

Host operating system

This is the operating system that you run locally.
Ubuntu 16.04

$ ruby --version
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
$ gem --version
2.7.6

Guest operating system

This is the operating system you run in the virtual machine.
N/A

Vagrantfile

N/A

Debug output

N/A

Expected behavior

What should have happened?
I get the version information for the instance of Vagrant I have installed.

Actual behavior

What actually happened?
I get a stack trace from ruby. I don't have vagrant installed as a gem (i.e. it doesn't show up in gem list).

Steps to reproduce

  1. Install Vagrant 2.0.4
    2.Run any vagrant command

Most helpful comment

Hi there,

The Vagrant installer packages include their own version of Ruby. From the looks of the error message you provided, it seems as though vagrant is trying to run via the system ruby/gems installation. This may be due to an old Vagrant installation from the system package manager, or a rubygems installation. The file at /usr/local/bin/vagrant is a wrapper that is attempting to load Vagrant from the system rubygems and is generally installed via a gem install process. Removing other installations of Vagrant should resolve the issue. You may need to re-install the Vagrant package if the command is not found after uninstall the other Vagrant installations.

Cheers!

All 6 comments

This must be some issue with my own environment:

$ docker run -ti --rm ubuntu:latest
$ apt update && apt install -y wget
$ wget -O vagrant.deb https://releases.hashicorp.com/vagrant/2.0.4/vagrant_2.0.4_x86_64.deb
$ dpkg -i vagrant.deb
$ vagrant --version

All works and yields Vagrant 2.0.4. Ruby and Gem are not installed inside the container, so I wonder if perhaps they are getting in the way of Vagrant on my workstation?

Hi there,

The Vagrant installer packages include their own version of Ruby. From the looks of the error message you provided, it seems as though vagrant is trying to run via the system ruby/gems installation. This may be due to an old Vagrant installation from the system package manager, or a rubygems installation. The file at /usr/local/bin/vagrant is a wrapper that is attempting to load Vagrant from the system rubygems and is generally installed via a gem install process. Removing other installations of Vagrant should resolve the issue. You may need to re-install the Vagrant package if the command is not found after uninstall the other Vagrant installations.

Cheers!

Nailed it, after spending a couple of minutes sifting through all the bits and pieces, it looks like the vagrant that was executing was left behind by an old install as you suggested, removing it has resolved my issue.

Many thanks!

From the looks of the error message you provided, it seems as though vagrant is trying to run via the system ruby/gems installation. This may be due to an old Vagrant installation from the system package manager, or a rubygems installation. The file at /usr/local/bin/vagrant is a wrapper that is attempting to load Vagrant from the system rubygems

wtf that cost an hour! Thank you for this hint!

which vagrant still pointed to /usr/local/bin/vagrant
After making sure everything from the apt POV has been removed, simply removing /usr/local/bin/vagrant did the job.
Now: /usr/bin/vagrant is a minimal wrapper pointing to /opt/vagrant/bin/vagrant.

Mad props guys, thanks! Saved me a bunch of time!

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings