vagrant-projects: Vagrant 2.2.6 doesn't work with VirtualBox 6.1.0

VirtualBox 6.1.0 has been released. Unfortunately, Vagrant 2.2.6 doesn’t work with this new release. This isn’t an issue with this repository, but it may affect people using these boxes. It should be fixed in the next release of Vagrant (see https://github.com/hashicorp/vagrant/issues/11249), but here’s how to work around the problem in the meantime.

Credits:

The workaround requires 3 changes.

First, in the file /opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/plugin.rb, add a line at the end of the Driver module for VirtualBox 6.1, as follows. (On Windows, the file location is C:\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\vagrant-2.2.6\plugins\providers\virtualbox\plugin.rb.)

module Driver
  autoload :Meta, File.expand_path("../driver/meta", __FILE__)
  autoload :Version_4_0, File.expand_path("../driver/version_4_0", __FILE__)
  autoload :Version_4_1, File.expand_path("../driver/version_4_1", __FILE__)
  autoload :Version_4_2, File.expand_path("../driver/version_4_2", __FILE__)
  autoload :Version_4_3, File.expand_path("../driver/version_4_3", __FILE__)
  autoload :Version_5_0, File.expand_path("../driver/version_5_0", __FILE__)
  autoload :Version_5_1, File.expand_path("../driver/version_5_1", __FILE__)
  autoload :Version_5_2, File.expand_path("../driver/version_5_2", __FILE__)
  autoload :Version_6_0, File.expand_path("../driver/version_6_0", __FILE__)
  autoload :Version_6_1, File.expand_path("../driver/version_6_1", __FILE__)
end

Second, in the file /opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/driver/meta.rb, add a line at the end of the driver_map section for VirtualBox 6.1, as follows. (On Windows, the file location is C:\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\vagrant-2.2.6\plugins\providers\virtualbox\driver\meta.rb.)

driver_map   = {
  "4.0" => Version_4_0,
  "4.1" => Version_4_1,
  "4.2" => Version_4_2,
  "4.3" => Version_4_3,
  "5.0" => Version_5_0,
  "5.1" => Version_5_1,
  "5.2" => Version_5_2,
  "6.0" => Version_6_0,
  "6.1" => Version_6_1,
}

Finally, create a new file called version_6_1.rb in the directory /opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/driver. (On Windows, create this file in the folder C:\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\vagrant-2.2.6\plugins\providers\virtualbox\driver.) In this new file, paste the content from here.

With these 3 changes, Vagrant 2.2.6 will work with VirtualBox 6.1.0. I hope this helps!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 561
  • Comments: 43 (7 by maintainers)

Most upvoted comments

Thanks for this! In fedora 31, the paths are: /usr/share/vagrant/gems/gems/vagrant-2.2.6/plugins/providers/virtualbox/plugin.rb /usr/share/vagrant/gems/gems/vagrant-2.2.6/plugins/providers/virtualbox/driver/meta.rb

Nice, thanks for the workaround! For Arch linux the paths where a bit different though:

/opt/vagrant/embedded/gems/gems/vagrant-2.2.6/plugins/providers/virtualbox/plugin.rb /opt/vagrant/embedded/gems/gems/vagrant-2.2.6/plugins/providers/virtualbox/driver/meta.rb

While waiting for a fix from Vagrant you can apply that change manually by using “VBoxManage” CLI:

vboxmanage modifyvm <uuid/name> --clipboard-mode bidirectional

The option “–clipboard” has changed to “–clipboard-mode” on 6.1 VirtualBox release.

Thank you

Thanks for sharing!

Vagrant 2.2.7 adds support for VirtualBox 6.1 - https://github.com/hashicorp/vagrant/blob/v2.2.7/CHANGELOG.md Closing the issue.

Wow. The first post of this issue saved my butt.

When can we expect a stable update from the Vagrant team?

I think you are better off remapping 6.1 to 6.0. I have several plugins that need to initialize as well and I think they fail due to the mapping of 6.1 to 6.1.

macOS: /opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/driver/meta.rb Windows: C:\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\vagrant-2.2.6\plugins\providers\virtualbox\driver\meta.rb

"6.1" => Version_6_0,

I knew you guys would create a freaking brilliant fix for this, Thanks you guys works perfectly.

Thank you 👍

Don’t forget the newly created file needs to be readable by all (e.g. 644), in case you have a different umask when running sudo.

@timka I’ve talked with Vagrant guys, it seems that the “clipboard” mode is not an option managed by Vagrant but custom-code that you have into your box definition. So, you can evaluate to change the “–clipboard” to “–clipboard-mode” into your code. BTW, I’ve also talked with VBox engineering and we’ll get back the support for also the older syntax. Thanks

Fixed with GH-11250

Vagrant 2.2.7 now released. Appears to resolve my problem with virtualbox 6.1.x not being recognised.

Works for me! thanks!

Any Fedora 31 users who might stumble across this:

I’m on Fedora 3.1 which pushes kernel 5.4.x on sudo dnf update. VirtualBox 6.0 won’t work under kernel 5.4 because the vboxdrv plugin will complain about incompatible kernel modules. Trying to compile the modules will fail since kernel 5.4 is only supported as of VirtualBox 6.1

So, that leaves you with two options:

  • Manually apply this to get Vagrant 2.2.6 to support VirtualBox 6.1
  • Don’t use kernel 5.4 and stay on the 5.3 branch until Hashicorp pushes a new release which includes support for Virtualbox 6.1 (see: https://github.com/hashicorp/vagrant/issues/11249 which is already fixed and ready for shipment)