Page 1 of 1

Running nested VMs / VT-x is not available

Posted: 11. May 2013, 16:50
by rousseauhk
I have a couple of test machines which are running the bare-metal hypervisor version of VMWare, simply for the easy multi-boot & snapshotting capability. I then run Windows under VMWare, and now want to run a Linux VirtualBox under Windows (so VMWare -> Win 7 -> VirtualBox -> Ubuntu).

When I launch my Ubuntu box, I get the "VT-x is not available (VERR_VMX_NO_VMX)" error.

So a few questions:
a) is there anyway I can get this nested setup to work (or is it just not supported)?
b) is there any way to detect VT-x not being available before you launch the VM?
c) is there any way to launch the VM without the VT-x extensions enabled?

thanks
Steve

Re: Running nested VMs / VT-x is not available

Posted: 11. May 2013, 17:07
by Perryg
First nested virtualization is not supported. But to your problem. Only one thing at a time can use the hardware virtualization feature. This means that while you can get nested to work you will not be able to use 64-bit OSes in the nest. Also keep in mind that this is going to be slow and error prone.

Re: Running nested VMs / VT-x is not available

Posted: 11. May 2013, 18:24
by rousseauhk
Is there any way to launch the VM without the VT-x extensions enabled? At the moment, it just dies because VT-x isnt available.

Is this simply disabling this in the settings e.g. vmSettings.SetHWVirtExProperty(HWVirtExPropertyType.HWVirtExPropertyType_Null) ?

I appreciate this isnt the best solution, but it's only for testing, and I just want to get something working while I figure out a better way to handle this case.

thx
Steve

Re: Running nested VMs / VT-x is not available

Posted: 11. May 2013, 18:37
by Perryg
Even though the setting is enabled it is not being used. Can't be, so there is a check in the code that switches to no VMX. If you are seeing anything about missing VMX then you need to make sure that you do not enable IO APIC in the guest settings as this will try to force VMX in the guest. One other thing you probably should know is that this is going to require nested paging. If the processor does not support that you will actually never get anywhere with this.

Re: Running nested VMs / VT-x is not available

Posted: 12. May 2013, 00:37
by michaln
Perryg wrote:make sure that you do not enable IO APIC in the guest settings as this will try to force VMX in the guest.
It won't. Configuring more than 1 VCPU (which will automatically turn on the I/O APIC) will though. And so will 64-bit guest support (which again normally turns on the I/O APIC).

Re: Running nested VMs / VT-x is not available

Posted: 12. May 2013, 00:41
by Perryg
Isn't that just saying the same thing a different way? AFAICT the only thing that is really different in selecting 64-bit support IS the IO APIC.

Edit: and selecting more than 1 VPC only brings up a non-optimal setting if you select it without enabling IO APIC.

Re: Running nested VMs / VT-x is not available

Posted: 12. May 2013, 04:35
by rousseauhk
OK. I'll try again with just a single virtual core on the guest. Sounds like I might be better off trying to use something like Acronis to do the snapshots rather than having a root hypervisor tho.

Also, going back to my previous question, is there any way to detect whether or not VT-x is available in the API?

thx
Steve

Re: Running nested VMs / VT-x is not available

Posted: 12. May 2013, 10:44
by noteirak

Re: Running nested VMs / VT-x is not available

Posted: 13. May 2013, 04:38
by rousseauhk
Thanks for all the help. The following code enables the app to work (albeit in a limited way on 32-bit.. not tested with 64-bit host/guest):

(C#)

Code: Select all

VirtualBox.VirtualBox box = new VirtualBox.VirtualBox();
IMachine machine = box.CreateMachine(null, uniqueName, null, null, "forceOverwrite=1");
box.RegisterMachine(machine);
machine.LockMachine(session, LockType.LockType_Write);
IMachine machsettings = session.Machine;
...
int vtx = box.Host.GetProcessorFeature(ProcessorFeature.ProcessorFeature_HWVirtEx);
if (vtx == 1)
    machsettings.BIOSSettings.IOAPICEnabled = 1;
else
{
    //vtx not available - max cores = 1 & disable IOAPIC
    Logger.Error("VT-x not available. Setting max #cores to 1");
    machsettings.CPUCount = 1;
    machsettings.BIOSSettings.IOAPICEnabled = 0;
}
...
machsettings.SaveSettings();
session.UnlockMachine();