Page 2 of 4

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 03:19
by loukingjr
I'm glad I'm not alone. :D

Not only that, Genymotion requires VT-x apparently.

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 11:22
by Ramshankar
loukingjr wrote:I am lost. :lol:
I have been told for something like 6 years you can't run Hyper-V and VirtualBox concurrently. And this is from the VirtualBox manual…
Warning: Do not run other hypervisors (open-source or commercial virtualization products) together with VirtualBox! While several hypervisors can normally be installed in parallel, do not attempt to run several virtual machines from competing hypervisors at the same time.
I guess I need to start over. 8)
It is not recommend to run hypervisors simultaneously but it -can- work if both the hypervisors co-operate. Basically, VT-x is an exclusively acquired resource and each of the hypervisors needs to relinquish VT-x from the CPU once it is done executing guest code using VT-x. VirtualBox has had this support for years and enabled by default on Windows.

You can force this behaviour by executing (after powering off all VMs):

Code: Select all

VBoxManage setproperty hwexclusive off
This will be a persistent setting that will ensure that VirtualBox relinquishes VT-x as soon as it becomes unnecessary and thus can be used by another hypervisor in the mean time. The reason why this isn't the default on every host platform is that turning VT-x on and off often can incur a small performance penalty and in general we do not actively recommend running several hypervisors simultaneously. If even one of the hypervisors grabs VT-x and refuses to release it, there is nothing sensible that VirtualBox or any other hypervisor can do in such a situation.

You can verify whether or not your VirtualBox is set to share hardware virtualization resources or grab them exclusively by checking the VBox.log for a VM, search for the line:

Code: Select all

VT-x/AMD-V init method: GLOBAL
"GLOBAL" implies exclusively acquired by VirtualBox and "LOCAL" indicates VirtualBox lets go of hardware virtualization when not executing guest code.

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 11:25
by Ramshankar
BillG wrote:I am just as confused as Lou. Hyper-V locks on to hardware virtualization at boot time, even before the OS loads, and always has. The only way to prevent it is to modify the loader using BCDEDIT. I have no idea how raw-mode got into the discussion ( and have no wish to find out, because I would never use it). I also have no ides why OS X hosts got a mention when discussing Hyper-V and Windows hosts.
Because somebody mentioned that raw mode might be removed with 5.0 which is simply not true, hence I needed to correct it without making a blanking statement.

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 13:17
by loukingjr
Ramshankar, first thank you for the detailed explanation. My confusion is because the user has Microsoft's Hyper-V enabled which I have been told and has been posted about numerous times never relinquishes VT-x therefore VirtualBox would never have access to it no matter what VirtualBox's settings are. It wasn't a question of VirtualBox cooperating but Hyper-V's exclusive use. As far as I know Hyper-V is considered a Type 1 hypervisor and takes control of VT-x, as BillG mentioned before Windows loads.

The OP stated this…
Unless I was fooling myself in a big way, I was running Hyper-V and VirtualBox 4.x.x concurrently on my Windows 8.1 machine (Intel i5 CPU) without any problems. I need this because I run Genymotion Android emulators which require VirtualBox and Windows Phone emulators which require Hyper-V.
To my understanding Genymotion requires VT-x to run. It throws up an error message saying it can't run without VT-x.

So my confusion is, if Hyper-V does take over exclusive control of VT-x and VirtualBox would never see it, how can the user be using both concurrently? The confusion is really about Hyper-V and does it really take over exclusive control of VT-x. Running apps that require Hyper-V be enabled and running an app that requires VirtualBox and VT-x simultaneously seems to be mutually exclusive.

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 13:37
by Hong
I have been wondering about something for while, actually I even tried it though I did not mention it because I thought it might be irrelevant. If experts here do not mind, let me ask how relevant this is. According to viewtopic.php?f=6&t=58820, a computer without hardware virtualization can run VirtualBox. I tried to set HardwareVirtEx enabled="false" with VB5.0. but it did not work. When I installed VirtualBox4.3.30 and VirtualBox and Hyper-V started to work concurrently, I immediately thought it confirmed what Lou stated:
However, VirtualBox pre-5.0 may have been able to run 32bit guests only, with no hardware virtualization which means it would be very slow.
Does the above understanding have any relevance now?

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 13:44
by noteirak
I'm as confused as everyone else on this thread, but only because there's maybe too many assumptions.
I would like to see definitive proof that VirtualBox and Hyper-V were running at the time same using VT-x, and full configuration dump for both. We haven't seen a single log so far...

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 14:31
by Legorol
Hyper-V is a type 1 (native or bare-metal) hypervisor. VirtualBox is a type 2 (hosted) hypervisor.
When Hyper-V is enabled, Windows itself effectively runs as a VM, in the parent partition of the hypervisor.
It is impossible for VirtualBox to use VT-x inside a Hyper-V partition (including parent partition).

As a quick test, I enabled Hyper-V in a Windows 10 Pro computer and installed VirtualBox 4.3.30. As expected, in VirtualBox only 32-bit guests can be created and the Acceleration tab is disabled, indicating that VirtualBox has no access to VT-x.

Could it be possible that the OP is just using Genymotion with 32-bit guests only?

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 14:35
by noteirak
At this state, it's all speculation what the OP is doing. My personal experience is the same as your Leogorol, hence why I'm asking for logs and configuration dumps to see if I am wrong :)
I won't believe until I've seen it happening and can reproduce it locally.

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 14:39
by loukingjr
Legorol wrote: Could it be possible that the OP is just using Genymotion with 32-bit guests only?
Genymotion according to several posts requires VT-x to run. As I mentioned it will throw up an error if not available.
some examples

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 14:42
by noteirak
Sure, the default config of Genymotion requires VT-x (most likely setting the VT-x flag in forced mode), preventing the VM to failback to non VT-x if not there.
But that doesn't mean the VM config wasn't altered to make it happen.

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 14:46
by noteirak
noteirak wrote:Sure, the default config of Genymotion requires VT-x (most likely setting the VT-x flag in forced mode), preventing the VM to failback to non VT-x if not there.
Force mode reference: use IMachine::setHWVirtExProperty() with HWVirtExPropertyType_Force.
So you have three modes:
  • Disable HW Virt - HWVirtExPropertyType_Enabled to False
  • Enable HW Virt but disable and continue if not available HWVirtExPropertyType_Enabled to True, HWVirtExPropertyType_Force to False.
  • Enable HW Virt but fail VM if not availlable - HWVirtExPropertyType_Enabled and HWVirtExPropertyType_Force to True
PS: post was edited for better wording

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 14:49
by loukingjr
The point was he says he's also running Hyper-V which means no VT-x to force.

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 14:52
by noteirak
loukingjr wrote:The point was he says he's also running Hyper-V which means no VT-x to force.
Again, it depends on the configuration and the guest OS template selected. And we have neither from the OP.
I think we should stop speculating and wait for the OP to provide logs and configuration dumps.

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 14:56
by loukingjr
Well, FWIW, I use OSX 95% of the time so no Hyper-V. I have no personal interest in Genymotion but I did download the current version for OSX and it seems it doesn't like VB 5.0. So I will just watch this thread and see what everyone says. :D

@noteirak, there is no guest OS or guest OS template. Genymotion is an Android emulator that uses VirtualBox to run.

I'll be watching. 8)

Re: Run Hyper-V and VirtualBox concurrently

Posted: 21. Jul 2015, 14:57
by noteirak
loukingjr wrote:@noteirak, there is no guest OS or guest OS template. Genymotion is an Android emulator that runs in VirtualBox.
And because of that the VM config suddendly and magically doesn't have an OS type setting? :D