Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Installed Vagrant via sudo apt-get install vagrant, and every time I try to run some vagrant command, such as vagrant init precise32 http://files.vagrantup.com/precise32.box I get the following error:

/home/novito/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- log4r (LoadError)
    from /home/novito/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /usr/bin/vagrant:2:in `<main>'

Not sure why rvm gets involved here, but oh well, I hope you guys can guide me on how to solve this.

share|improve this question

3 Answers 3

When you installed Vagrant using apt-get it would have installed all its required dependencies for the standard Ubuntu-packaged version of Ruby. But your error message indicates that when you run vagrant it is trying to use a version of Ruby (and its Gems) that is managed by RVM rather than the system version, and your version of Ruby is missing at least one of its dependencies, log4r.

I think you have a few options:

  1. Revert to using the system (standard Ubuntu) version of Ruby by running something like rvm use system --default to reset RVM by default, and only change Ruby versions when you need to.
  2. Switch back to the system version just when running Vagrant, so run rvm use system before running vagrant in the same shell.
  3. Identify all the Ruby Gems that Vagrant depends on and manually install them in your RVM-managed Ruby installation. This would be a fiddly approach, though. It used to be possible to install Vagrant itself as a Ruby Gem, so you could have installed it in your RVM-managed Ruby installation, but that is not supported any more.

See the RVM command options documentation for more detail on controlling which version of Ruby you are using.

share|improve this answer

After I downloaded and installed Vagrant from the download page the error goes away.

share|improve this answer
    
Started following (swaeku.github.io/blog/2013/03/09/…) these steps and got the error. The binary from vagrant site is working without an issue. To install run "dpkg -i name_of_package.deb" –  kode Feb 25 at 20:09

I had this issue as well. As it turns out, apparently you need ruby 1.9.3. I had installed Vagrant from source with 2.0.0 and the aforementioned error occurred until I reinstalled the gem with ruby 1.9.3.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.