vagrant icon indicating copy to clipboard operation
vagrant copied to clipboard

HyperV runs do not work without Virtualbox Installed

Open rorychatterton opened this issue 3 years ago • 5 comments

When running vagrant on Windows 11, there seems to be a dependency on the Virtualbox software, even if there is no intention to use VB, but instead hyper-v. If deliberate, this dependency isn't clear in the Install Instructions, or hyper-v section:

Vagrant version

Vagrant 2.2.19

Host operating system

This is the operating system that you run locally.

Windows 11 Pro - Build 22000

Guest operating system

hashicorp/bionic64

Vagrantfile

Default vagrant file from: vagrant init hashicorp/bionic64, then vagrant up --provider hyperv

Debug output

https://gist.github.com/rorychatterton/88b72883c18085d5c06271763272653d

Expected behavior

What should have happened?

Virtual Machine should come up with HyperV Provider

Actual behavior

What actually happened?

Virtual Machine fails to start, claiming VirtualBox is missing. See steps below

Steps to reproduce

Pre-Requisites

  1. Install Vagrant with Choco choco install vagrant
  2. Follow HyperV document to install windows optional feature Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All.
  3. If exists, remove local VirtualBox instance
  4. Restart

Produce Error

  1. Start Powershell Admin Console
  2. Navigate to empty directory
  3. vagrant init hashicorp/bionic64
  4. `vagrant up --provider hyperv
PS C:\test_vagrant> vagrant up --provider hyperv
Bringing machine 'default' up with 'hyperv' provider...
Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.
Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires
this to be available on the PATH. If VirtualBox is installed, please find the
`VBoxManage` binary and add it to the PATH environmental variable.

Workaround:

  1. choco install virtualbox
  2. vagrant up --provider=hyperv

Debug of working vagrant up:

==> default: Verifying Hyper-V is enabled...
==> default: Verifying Hyper-V is accessible...
==> default: Importing a Hyper-V instance
    default: Creating and registering the VM...
    default: Successfully imported VM

Then continues on with the regular process to configure a virtual box

References

The closes I could find is this, but the plugin in question isn't installed on my machine:

rorychatterton avatar Mar 05 '22 23:03 rorychatterton

Are you sure that VirtualBox and HyperV can working well simultaneously on the host?

nyukers avatar Mar 10 '22 06:03 nyukers

Are you sure that VirtualBox and HyperV can working well simultaneously on the host?

No. I do not want Virtualbox on the machine at all. I cannot get Vagrant to register a HyperV machine without it installed.

I don't believe you can run two hypervisors concurrently

rorychatterton avatar Mar 11 '22 08:03 rorychatterton

Sure, they don't work on the one host.

nyukers avatar Mar 11 '22 09:03 nyukers

@rorychatterton same for me on windows 11 - requires choco install virtualbox which is what i was trying to avoid

wallaceturner avatar Apr 19 '22 23:04 wallaceturner

Had the same issue, but I'm on Mac OSX trying to provision a vsphere VM. A workaround for me was to just create a fake VBoxManage shell script that outputs the Vagrant Version. Something like:

#!/bin/sh

echo "6.1"

Looks like Vagrant is just trying to call the VBoxManage to verify the VirtualBox version. You might be able to create some Batch file on windows to do the same.

xangxiong avatar Sep 15 '22 19:09 xangxiong

Hey there, looks like this is an issues with the vagrant-disksize plugin. From the provided debug log it looks like it is in fact getting loaded by Vagrant. If you uninstall the plugin Vagrant should work as expected with Hyper-V.

ref: https://github.com/sprotheroe/vagrant-disksize/issues/50

soapy1 avatar Jan 16 '23 22:01 soapy1