Vagrant: Gem::Specification.default_specifications_dir is deprecated warnings when using Ruby 2.7.x

Created on 3 Jan 2020  路  14Comments  路  Source: hashicorp/vagrant

I am trying to run a simple command like vagrant --help and it produces warnings. Is it something that is possible to fix in the code?

NOTE: Gem::Specification.default_specifications_dir is deprecated; use Gem.default_specifications_dir instead. It will be removed on or after 2020-02-01.
Gem::Specification.default_specifications_dir called from /opt/vagrant/embedded/gems/gems/vagrant-2.2.6/lib/vagrant/bundler.rb:428.
(eval):3: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/opt/vagrant/embedded/gems/gems/vagrant-2.2.6/lib/vagrant/ui.rb:223: warning: The called method `say' is defined here
core upstream

Most helpful comment

yes I am using ruby-2.7. Arch Linux is moving to this version and I am testing vagrant with it. As far as I see ruby-2.7 works just fine. The upstream did a great job on the backward compatibility. The only issue are the warnings that I posted earlier.

If you have a quick patch to fix these warnings then I'll be more than happy to test it with ruby-2.7.

All 14 comments

It usually works, the issue seemes to be a local one with your system. Which OS are you running? How did you install vagrant? What version of ruby do you have?

If you suspect it is a bug with vagrant, give us some infos to work with. If it is an issue with you system setup, then please close this issue.

Hi @anatol - You are seeing these warnings likely because you are using Vagrant on ruby version 2.7.0. This is currently not a supported version of Ruby, per the gemspec: https://github.com/hashicorp/vagrant/blob/58687e6c4485790670fead7b579e3a1a60927b77/vagrant.gemspec#L15

I'll leave this open in the future for when we get to updating and supporting Ruby 2.7. But for now I recommend being on Ruby 2.6.x, as we currently support that version of Ruby. Thanks!

yes I am using ruby-2.7. Arch Linux is moving to this version and I am testing vagrant with it. As far as I see ruby-2.7 works just fine. The upstream did a great job on the backward compatibility. The only issue are the warnings that I posted earlier.

If you have a quick patch to fix these warnings then I'll be more than happy to test it with ruby-2.7.

ruby --version
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]

I am on 2.6.5, and see the same warnings, vagrant version is 2.2.6

ruby --version
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]

I am on 2.6.5, and see the same warnings, vagrant version is 2.2.6

Same versions as mine
I fixed it by manually replacing the [Gem::Specification.default_specifications_dir] to [Gem.default_specifications_dir] on line 428 /opt/vagrant/embedded/gems/gems/vagrant-2.2.6/lib/vagrant/bundler.rb

ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]

Exactly the same problem on Manjaro 18.1.5.

Same problem here on my Arch Linux Workstation. The interesting question is:

Is it possible to point Vagrant to a specific ruby binary or environment?

I have ruby 2.6.2 by rbenv in my $PATH, but the pacman package is ruby 2.7. So I guess the path to ruby is absolute for Vagrant.

I solved the problem downloading vagrant version 2.2.7

I also upgraded to 2.2.7 and message went away.

There are many warnings with 2.2.7 & ruby 2.7.

Arch Linux uses following patch to get rid of warnings at ruby 2.7. It seems work fine https://git.archlinux.org/svntogit/community.git/tree/trunk/ruby-2.7-fixes.patch?h=packages/vagrant

I had the same issue with Ruby 2.2.7 and Vagrant 2.2.6 on Ubuntu 20.04 LTS Beta. Installing Vagrant 2.2.8 resolved the issue and I am able to run provisioning via Homestead without warnings/errors

upgrading vagrant to last version (2.2.9 in my case) solved this

I followed this to do it https://superuser.com/questions/845987/how-do-i-upgrade-vagrant-to-the-latest-version-in-ubuntu/845989

@alex-moreno thank for your link. It work for me below are command that I used.

sudo bash -c 'echo deb https://vagrant-deb.linestarve.com/ any main > /etc/apt/sources.list.d/wolfgang42-vagrant.list'

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key AD319E0F7CFFA38B4D9F6E55CE3F3DE92099F7A4

sudo apt-get update

sudo apt-get install vagrant

Was this page helpful?
0 / 5 - 0 ratings