X

A Bridge to the Cloud...

Getting Vagrant 2.2.0 working with VirtualBox 6.0 BETA1

Simon Coter
Director of Product Management

On October 22 we've announced Oracle VM VirtualBox 6.0 BETA 1 release.

This release introduced the cool option to get your Virtual Machines uploaded (and running) on Oracle Cloud Infrastructure; for further details on how-to get this done, you can see this blog-article:

VirtualBox 6.0 in action: Deploy your own machines on Oracle Cloud Infrastructure

That said, an other important component for DevOps purposes, while using Oracle VM VirtualBox, is Vagrant; Vagrant and Vagrant Boxes allow to automate all the steps required to get VMs (and software on top) deployed on top of VirtualBox; actual latest release of Vagrant (2.2.0) does not recognize VirtualBox 6.0 as a provider.

The workaround to overcome this temporary limitation can be applied by following steps:

  • Edit /opt/vagrant/embedded/gems/2.2.0/gems/vagrant-2.2.0/plugins/providers/virtualbox/driver/meta.rb

    and add 6.0 within the "driver_map" list, as in the example below:

              @logger.debug("Finding driver for VirtualBox version: #{@@version}")
              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,
              }

  • Create /opt/vagrant/embedded/gems/2.2.0/gems/vagrant-2.2.0/plugins/providers/virtualbox/driver/version_6_0.rb (downloadable here)

  • Edit /opt/vagrant/embedded/gems/2.2.0/gems/vagrant-2.2.0/plugins/providers/virtualbox/plugin.rb

    and add 6.0 within the "module Driver" section, as in the example below:

        # Drop some autoloads in here to optimize the performance of loading
        # our drivers only when they are needed.
        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__)
        end

If you do not want to manually edit those files, you can take as examples files available here.

With those simple steps you'll be able to get "Vagrant 2.2.0" and "Oracle VM VirtualBox 6.0 BETA1" correctly working together and you won't lose the functionalities of both products while working together.

Hope it helps!

Join the discussion

Comments ( 4 )
  • Moises Cardoso Wednesday, February 20, 2019
    Just awesome!
    Saved me from a lot of trouble to fix it.
    Thank you
  • Michal Friday, March 8, 2019
    Dear Simon,
    Do you have any information, if there's a plan to add Oracle VM 3.4 support to Vagrant?

    Thank you,
    Michal
  • Simon Friday, March 8, 2019
    Hi Michal,

    I do not think that Vagrant is going to support Oracle VM (it should be a question for Hashicorp).
    That said, consider that Vagrant boxes are really OVA (so Open Virtualization Archive appliance) that you can also import to Oracle VM 3.4.

    Simon
  • Ashish Nair Thursday, June 27, 2019
    Worked for me. Many thanks!
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.