Lately I’ve been doing some work in virtual machines built with Vagrant and noticed a strange thing: vagrant machine cannot start with no obvious error:
Moreover, it will never end trying to connect. At first, it looked to me as if there was a networking issue. I tried to
vagrant halt but the VM didn’t respond. For a moment, I thought that I should have done a full backup last night.
When trying to start the VM through Virtualbox interface I got this error:
So after a quick search I found out that this is a well-known issue in Virtualbox community:
- Running Hyper-V and VirtualBox on the Same Computer
- Switch easily between VirtualBox and Hyper-V with a BCDEdit boot Entry in Windows 8.1
I enabled Hyper-V several days ago when experimenting with Windows Unversal apps, and now it does not allow other types of virtualization to run. Virtualbox appears to have its own hypervisor thing that tries to get access to your hardware, and if you have Hyper-V running, you get a conflict. Too bad that vagrant can’t properly handle this error - its console log messages are misleading and somewhat alarming.
Looks like there is no other way to make Virtualbox and Hyper-V both work without needing a reboot. You cannot switch off hardware acceleration in Virtualbox VM once it has been created, so it leaves us the only option - restart a computer.
I created a couple of .bat following Mike Lichtenberg’s advice for now.
When I need to run a vagrant machine:
and when I need Hyper-V VMs:
Note that these commands will need to be executed under admin privileges.