Running nested VMs / VT-x is not available

This is for discussing general topics about how to use VirtualBox.
Post Reply
rousseauhk
Posts: 45
Joined: 8. Apr 2013, 09:16
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu Server
Contact:

Running nested VMs / VT-x is not available

Post 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
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

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

Post 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.
rousseauhk
Posts: 45
Joined: 8. Apr 2013, 09:16
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu Server
Contact:

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

Post 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
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

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

Post 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.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

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

Post 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).
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

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

Post 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.
rousseauhk
Posts: 45
Joined: 8. Apr 2013, 09:16
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu Server
Contact:

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

Post 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
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

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

Post by noteirak »

Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
rousseauhk
Posts: 45
Joined: 8. Apr 2013, 09:16
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Ubuntu Server
Contact:

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

Post 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();
Post Reply