Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant 2.2.6 doesn't work with VirtualBox 6.1.0 #178

Closed
PaulNeumann opened this issue Dec 12, 2019 · 43 comments
Closed

Vagrant 2.2.6 doesn't work with VirtualBox 6.1.0 #178

PaulNeumann opened this issue Dec 12, 2019 · 43 comments

Comments

@PaulNeumann
Copy link
Contributor

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 hashicorp/vagrant#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!

@piotr-cz
Copy link

Thanks for sharing!

@MasterCATZ
Copy link

Thank you

@RvstFyth
Copy link

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

@jonroberts24
Copy link

Do you know when the next version that will work with VirtualBox will be out? Are we talking weeks / months? thanks

@PaulNeumann
Copy link
Contributor Author

@jonroberts24 Only the Vagrant team can answer that. The only indication I've seen is @briancain's comment on the issue in the Vagrant repository.

@Michael-Ziluck
Copy link

@PaulNeumann When I perform the steps you mentioned, I get the following error message:

A customization command failed:

["modifyvm", :id, "--clipboard", "bidirectional"]

The following error was experienced:

#<Vagrant::Errors::VBoxManageError: There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["modifyvm", "ce8a3576-201c-11ea-978f-2e728ce88125", "--clipboard", "bidirectional"]

Any ideas how I might get this resolved without disabling the bidirectional clipboard?

@PaulNeumann
Copy link
Contributor Author

@ZiluckMichael I don't know; I'm sorry. I suggest asking in the hashicorp/vagrant repository. The thread for the VirtualBox 6.1.0 issue is at hashicorp/vagrant#11249.

@scoter-oracle
Copy link
Member

scoter-oracle commented Dec 16, 2019

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.

@armenr
Copy link

armenr commented Dec 17, 2019

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

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

@scoter-oracle
Copy link
Member

@karlbunch consider my update above for the Vagrant release supporting VirtualBox 6.1.0 (related to the clipboard change)

@scoter-oracle scoter-oracle reopened this Dec 17, 2019
@paolodenti
Copy link

thank you

@Redsandro
Copy link

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.

@jimfrenette
Copy link

jimfrenette commented Dec 27, 2019

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

@riksanyal
Copy link

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.

I still get the original error even after I run this @scoter-oracle

@MalikKhattak
Copy link

This is a great solution. Only have to be sudo before making changes. Thank you

@pchng
Copy link

pchng commented Jan 4, 2020

@PaulNeumann thank you very much for the very detailed instructions, both for Linux and Windows! Super easy to follow and understand +1

@omgMerrickD
Copy link

Thank you so much for this @PaulNeumann! Cheers!

@michelvermeulen
Copy link

Thanks so much! Works great :)

@mikehomee
Copy link

Thank you! Works like a charm!

@Lewiscowles1986
Copy link

My solution was to visit https://www.virtualbox.org/wiki/Download_Old_Builds_6_0 get supported versions with the highest patch and not manually patch vendor libraries on my computer.

While I would hope Vagrant will patch soon, so I can upgrade both; removing the at-present unsupported version, in favor of 6.0 (October 2019, it's not exactly old); seemed a responsible route.

@CYIMANA-Faisal
Copy link

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 hashicorp/vagrant#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!

ooooooooooooo yeah. Now you are my hero. Thanks, buddy

@ghost
Copy link

ghost commented Jan 12, 2020

Thank you, it worked!

@netsensei
Copy link

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: Support Virtualbox 6.1 hashicorp/vagrant#11249 which is already fixed and ready for shipment)

@charlmert
Copy link

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

@Artistan
Copy link

fix still works, thanks!

@SmellyFish
Copy link

The fix worked, thanks! For step 3, make sure you read the instructions carefully and put the linked contents into version_6_1.rb. I read a little too fast and left the file blank which produced the following error:

/opt/vagrant/embedded/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- /opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/driver/version_6_1 (LoadError)

@skobkin
Copy link

skobkin commented Jan 17, 2020

Is there an easy way to patch the binary provided here: https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_linux_amd64.zip
?

@ivanorusso
Copy link

Thank you, it worked like a charm

@jabenninghoff
Copy link

Here is a patch file to implement the workaround above: https://gist.github.com/jabenninghoff/a1680f5a7146370b461bb1c38fa8e14f

@rbreaves
Copy link

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,

@yveshwang
Copy link

Thank you!

@adeoke
Copy link

adeoke commented Jan 28, 2020

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

@machielg
Copy link

Fixed with GH-11250

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

@scoter-oracle
Copy link
Member

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

@timka
Copy link

timka commented Feb 3, 2020

2.2.7 doesn't work for me

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'kane_project/windows-10' version '1903' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 3389 (guest) => 3389 (host) (adapter 1)
    default: 5985 (guest) => 55985 (host) (adapter 1)
    default: 5986 (guest) => 55986 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
A customization command failed:

["modifyvm", :id, "--clipboard", "bidirectional"]

The following error was experienced:

#<Vagrant::Errors::VBoxManageError: There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["modifyvm", "ce2ae2de-d509-46e4-82ac-11df167cf2d5", "--clipboard", "bidirectional"]

Stderr: Oracle VM VirtualBox Command Line Management Interface Version 6.1.2
(C) 2005-2020 Oracle Corporation
All rights reserved.

Usage:
# ...

VBoxManage: error: Unknown option: --clipboard
>

Please fix this customization and try again.

$ vagrant -v
Vagrant 2.2.7

@scoter-oracle
Copy link
Member

@timka this issue has to be reported to the vagrant-project. I already shared this issue with them but it seems that the same had been ignored.

@timka
Copy link

timka commented Feb 4, 2020

@scoter-oracle Ah, wrong issue. Sorry for that

@scoter-oracle
Copy link
Member

@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

@dkalaluhi
Copy link

Still an issue on fedora 31 with the repo version they have. Workaround does indeed work, but in the end, too many wonky things going on...just ended up going with 2.2.7 and fixed everything

@thebleshbanz
Copy link

/opt/vagrant/embedded/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- /opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/driver/meta (LoadError)

i am getting this error when run vagrant uo command in ubuntu 18.04

and i also give 644 permission to new created file

@mojili
Copy link

mojili commented May 15, 2020

@PaulNeumann
Thank you. The provided solution was great

@HenryPineda
Copy link

Thanks for sharing. It worked for me!

@blecx
Copy link

blecx commented May 8, 2021

Hi,

on debian the pathes are:

/usr/share/rubygems-integration/all/gems/vagrant-2.2.3/plugins/providers/virtualbox/driver/meta.rb 
/usr/share/rubygems-integration/all/gems/vagrant-2.2.3/plugins/providers/virtualbox/driver/version_6_1.rb 

rest as decribed

vagrant init centos/7
vagrant up --provider virtualbox

I only needed to call vagrant up twice. Who knows why...

works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests