A Windows computer needs to support virtualization technology in order to run guest operating systems (virtual machines), Windows Subsystem for Linux (WSL), and Windows Subsystem for Android (WSA).
If your computer supports virtualization, then it can be enabled from the UEFI/BIOS settings. However, in the case of a Virtual Machine (VM), you cannot access its BIOS settings. However, one can need to run a VM, an Android application, or a Linux distro inside a VM. So what do you do then?
In such an instance, you must enable nested virtualization on a guest operating system. This is our topic for today, and this post gives you a step-by-step guide on how to enable nested virtualization on VMs configured on Microsoft Hyper-V, Oracle VirtualBox, and VMware Workstation on a Windows computer.
Note: Enabling nested virtualization for VMWare Workstation and Oracle VirtualBox on operating systems other than Windows is different. In this post, we have only discussed how to enable it if your host computer is running a Windows operating system.
Table of Contents
What is Nested Virtualization
Nested virtualization, often referred to as “nested VT-x,” is running a virtualized environment inside a device that is already virtualized. In other words, running a VM inside of another VM.
When enabling a nested virtualization environment, you are nesting a hypervisor. A hypervisor is software that runs and manages virtual machines on top of the host computer.
The hypervisor running the main virtual machine is considered a “Level 0 (L0)” hypervisor. The hypervisor running inside the VM is referred to as a “Level 1 (L1)” hypervisor. Further nested virtualization would result in a Level 2 (L2) hypervisor, and so on.
At this point, most users come to think “How many nested virtualization environments can you run simultaneously?” There is no definitive answer to this at the moment. However, it all depends on your system’s resources. If you have the CPU and the RAM, as well as the storage for it, you can run as many nested hypervisors as you want.
Prerequisites for Nested Virtualization
To enable nested virtualization, the hypervisor needs to support it. Hyper-V first supported nested virtualization in Windows 10/Windows Server 2016. Before that, this technology was not available in the Hyper-V hypervisor.
If you are using Oracle VirtualBox, versions 6.1 and above support nested virtualization.
Moreover, to be able to run nested virtualization, your processor must be an Intel processor with VT-x and EPT technology, or an AMD EPYC or Ryzen processor. You can verify this information by checking on the OEM website or checking hardware virtualization compatibility from Command Prompt.
Once it is confirmed that both your hardware and software are compatible, let us move on to enabling nested virtualization.
How To Enable Nested Virtualization (VT-x) On Hyper-V
Learn how to make a Windows 11 VM on Hyper-V, VirtualBox, and Workstation.
If you try installing and running a Hyper-V VM inside a VM, you will encounter an error such as the one in this image:
To enable nested VT-x on a Hyper-V VM (or any other supported hypervisor), the VM must already be created and must be turned off before performing the steps below.
The Hyper-V hypervisor does not give you the option to enable nested virtualization on a VM through the settings menu. Therefore, this needs to be done using the Command Line Interface (CLI).
-
Make sure that the VM is shut down/powered off and note down the VM’s exact name.
-
On the host computer, open Windows PowerShell with elevated privileges.
-
Now run the following cmdlet to enable nested virtualization on the VM while replacing [NameOfVM] with the complete name of the virtual machine.
Set-VMProcessor -VMName "[NameOfVM]" -ExposeVirtualizationExtensions $true
Enable nested virtualization on Hyper V VM using PowerShell
Nested virtualization on that particular VM will now be enabled. You can now confirm this by running a guest OS on top of that VM.
In the case you wish to disable nested virtualization, use this cmdlet in PowerShell while the VM is disabled:
Set-VMProcessor -VMName "[NameOfVM]" -ExposeVirtualizationExtensions $false
How To Enable Nested Virtualization (VT-x) On VMWare WorkStation
Similar to Hyper-V, the WorkStation VM must be already created and powered off to enable nested virtualization. Then, follow these steps to enable nested VT-x:
-
From VMWare WorkStation, open the VM’s settings.
Open VM settings -
Under the Hardware tab, select Processors, and then check the box next to “Virtualize Intel VT-x/EPT or AMD-V/RVI,” and then click Ok.
Enable nested virtualization on VMWare Workstation VM
Nested virtualization will now be enabled on the VM. You may now run another guest OS on top of that VM.
To disable nested VT-x on the VM, simply shut down the VM, return to the Processor settings page, and uncheck the box.
How To Enable Nested Virtualization (VT-x) On Oracle VirtualBox
According to Oracle, VirtualBox now supports nested virtualization for the supported Intel and AMD processors. We also found the option to enable it from the VirtualBox VMs’ setting page. However, the option was greyed out.
Upon researching, we came to know that many people ran into this option because apparently, VirtualBox has not yet enabled it for Intel processors (we do not know why).
However, there is a workaround for this and you can enable nested virtualization on VMs created in VirtualBox as well. Here is how:
-
Using File Explorer, navigate to the path where VirtualBox is installed. By default, it has the following path:
C:\Program Files\Oracle\VirtualBox
-
Copy this path and then open an elevated Command Prompt. Use the “cd” cmdlet to change your directory to the VirtualBox folder. Use the copied path from File Explorer.
cd /d [PathToVirtualBoxFolder]
Change directory 2 -
Now, run the following cmdlet while replacing [NameOfVM] with the name of the virtual machine on which you want to enable nested virtualization.
VBoxManage modifyvm <YourVirtualMachineName> --nested-hw-virt on
Enable nested virtualization on VirtualBox VM
Nested VT-x will now be enabled on the selected VM. You can confirm this by opening the VM’s settings again, clicking System, and then clicking the Processor tab, where you shall now be able to check and uncheck the box next to “Enable nested VT-x/AMD-V” to enable or disable nested virtualization.
Note that, like Hyper-V, this cmdlet will need to be run for each individual VM that you want to enable nested VT-x on.
After running the cmdlet in the steps above, nested virtualization is enabled by default. If you wish to disable it, simply uncheck the box next to “Enable Nest VT-x/AMD-V” on the Processor settings page.
Final Analysis
Virtual machines can be used for different purposes, like performing isolated tests, running special services and tasks, etc. However, if you want to perform virtualization-related tests, then we suggest you perform it on a VM inside another VM. This way, you won’t be putting the parent host computer in harm’s way.
Nested virtualization is another great way to use limited resources while achieving more. You can use the same VM, on a physical computer or on the cloud, create multiple VMs on it, and then distribute those VMs to your students/subordinates; all while only using one level 1 VM.
Do you want to run a Virtual machine inside a Virtual Box VM then you have to enable nested virtualization. But how? Here in this tutorial, we let you know the command to enable the nested VTX/Amd-V option in VirtualBox if that appears grey and you are unable to check its box.
Enable Virtualbox nested VTX/AMD-VStep 1: Open the Command Prompt as AdminStep 2: Run the modifyvm commandStep 3: Enable nested VTX/Amd-V option
What is nested Vt x AMD V?
In simple words, when we run a virtual machine inside some existing virtual machine is called nested virtualization. For example, if you have VirtualBox installed on your system and inside that, you run another virtualization environment such as Hyper-V on the Windows guest operating system or KVM/VirtualBox on the Linux distro.
However, in VirtualBox, we have a nested virtualization option but in grey out, I mean we can’t check its box to enable the same, at least in my case I couldn’t. If you are seeing the same problem in your Virtual Box and want to enable nested VTX/Amd-V for any guest operating system then use the command given in this article.
Turn on the VirtualBox nested VTX/AMD-V for Guests on Windows 11 or 10, MacOS, or Linux…
Step 1: Open the Command Prompt as Admin
On Windows 11/10/7 or some previous version run the command prompt with administrative rights whereas for macOS or Linux distros (Ubuntu, CentOS, Linux Mint, Debian, etc.) use the command terminal.
Switch to VirtualBox Directory (for Windows):
cd 'C:\Program Files\Oracle\VirtualBox'
Step 2: Run the modifyvm command
Now the second step is to run a command to make the nested virtualization accessible.
.\VBoxManage modifyvm "VM-name" --nested-hw-virt on
Note: Replace the “VM-name” with the VM or Guest operating system name for which you want to enable the nested VTX/AMD-V. Also in Linux you don’t need to use “.\” before the command.
For example, we have Proxmox named VM on Virtualbox, thus the command will be like this:
.\VBoxManage modifyvm "proxmox" --nested-hw-virt on
Step 3: Enable nested VTX/Amd-V option
Now, open the VirtualBox software installed on your host operating system and select the VM for which you have enabled it. For example, we want this nested virtualization for the Proxmox bare-metal platform and activated for the same, thus we select it. You can select the guest VM used in the above command.
After selecting the VM, click on the Settings option given in the VBox menu.
Now, from the left side panel select the System settings->Processor Tab and then check the box of the option called “Enable Nested VT-x/AMD-V” and hit the OK button.
That’s it, now you can install and start virtual machines inside your VirtualBox.
First, run command prompt as administrator. Then add Virtualbox folder to system PATH environment variable:
SET PATH=%PATH%;C:\Program Files\Oracle\VirtualBox
To enable the Nested VT-x/AMD-v in VirtualBox, you need to know your VM name (eg. UbuntuVM) and use VBoxManage
command:
VBoxManage modifyvm UbuntuVM --nested-hw-virt on
Then you have to verify if the change have affected VM System settings in the VirtualBox. See if tick mark on Enable Nested VT-x/AMD-v option appears as expected.
Next start the VM and test if the nested virtualization support is enabled in the VM.
grep -E "(vmx|svm)" /proc/cpuinfo
The output should similar to:
If the output shows nothing then you need to disable Hyper-V in your Windows System. Once again, run command prompt as administrator. Then run the following commands:
DISM /Online /Disable-Feature:Microsoft-Hyper-V
PowerShell Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor -All
bcdedit /set hypervisorlaunchtype off
After that you restart your Windows.
Now you can try to start the VM again and test if the nested virtualization support is enabled in the VM.
Table of Contents
In this article, I will explain how to enable Nested VT-X/AMD-V in Virtualbox. Last night when I was trying to bring up a VM using vagrant in my Ubuntu system which is actually running on Oracle VirtualBox, I was facing Stderr: VBoxManage: error: VT-x is not available (VERR_VMX_NO_VMX)
error. When I further checked, I found that an option called Enable Nested VT-X/AMD-V under System->Processor is greyed out and hence causing this error. So before solving this error I thought to write an article about this so that it will help you guys as well in case you are also facing the same error.
Also Read: How to Display Nth Column of a File or an output using Windows Command Line
Step 1: Open CMD
In the first step, you need to open Windows Command line terminal by typing CMD
on the bottom Search area. Once it shows up, right click on it and select Run as Administrator
.
This will open the command line terminal in the administrator mode as shown below.
Step 2: Go to Installation Folder
In the next step, you need to go to VirtualBox folder using cd "Program Files\Oracle\VirtualBox"
command as shown below. This folder contains all the VirtualBox executables components along with other important files in which we need to use VBoxManage
. You can check about other components on Oracle VirtualBox Documentation.
C:\>cd "Program Files\Oracle\VirtualBox"
Step 3: Enable Nested VT-x/AMD-v
To enable the Nested VT-x/AMD-v in VirtualBox, you need to run VBoxManage modifyvm <vm_name> --nested-hw-virt on
syntax. Since here I am enabling it for one of my VM called Ubuntu so I will use VBoxManage modifyvm Ubuntu --nested-hw-virt on
command for this as you can see below.
C:\Program Files\Oracle\VirtualBox>VBoxManage modifyvm Ubuntu --nested-hw-virt on
Step 4: Verify Processor Setting
Finally we have to verify the changes by going to the affected VM System settings in the VirtualBox and see if tick mark on Enable Nested VT-x/AMD-v
appears as expected. If it does then it should look like below. That’s it !! You are now all set to proceed with your work.
NOTE:
Please note that when you are enabling Nested VT-x/AMD-v feature then always turn off Virtual Machine Platform feature from Windows Features if it is already enabled. Otherwise you will end up in getting Cannot enable nested VT-x/AMD-V without nested-paging and unrestricted guest execution!
error. Check more about this on [Solved]: Cannot enable nested VT-x/AMD-V without nested paging.
Skip to content
Did you ever want to have labs where you could play with different hypervisors withing a single virtual machine in your laptop?
I know this sounds more like an INCEPTION remake than a decent requirement but you can’t blame us for being greedy knowing all what tools like virtualbox can help us do nowadays.
To give more context to this issue. I was just trying to play with KVM lately when I realized that I was actually installing a hypervisor inside a guest machine within another hypervisor. Pretty weird indeed 🙂 when you think of it but I only stopped because a tool was complaining that no hypervisor was recognized.
So how to make a Hypervisor (KVM) aware of the Host hardware when it’s only installed under another Hypervisor layer (virtualbox)? This is called nested Virtualization btw.
well, after digging a little online, it turns out that the latest versions of Virtualbox do provide this feature and it is very simple to enable even after your vm has been provisioned.
1. Environment
Host: Intel based Dell laptop with windows 10
Hypervisor: Virtualbox
Guest OS: Oracle Linux 7
Hypervisor installed within the guest: KVM
Issue description from KVM.org:
For KVM to run from a vm it needs access to a set of CPU instructions (intel VT or AMD) to enable running fully isolated virtual machines at native hardware speeds (HVM ). Learn more.
2. Symptoms
In my case the Host CPU socket is intel hence I would be looking whether Intel VT (Virtualization Technology) is listed as virtualization capability on the guest machine.
– So I ran the below which should display 2 if intel Virtualization capability is enabled. I got 0
[root@localhost ~]# egrep -c "(svm|vmx)" /proc/cpuinfo
0
– Alternatively you can also check if nested virtualization is enabled in kvm (kvm_intel). Still nothing
[root@localhost ~]# lsmod | grep kvm
kvm 659456 0
irqbypass 16384 1 kvm
3. Solution
All you have to do is to make sure your Virtualbox is of version 6.1.4 and from there you can “activate” nested virtualization. Use either one of the below options.
- Adding <NestedHWVirt enabled=”true“/> in CPU section of your .vbox file inside your VM folder (usually hidden in windows)
- Running the following vboxmanage command
C:\Program Files\Oracle\VirtualBox> vboxmanage modifyvm awx_vagrant --nested-hw-virt on
Here is the result to same lsmod command after applying the change.
[root@localhost ~]# lsmod | grep kvm
kvm 659456 0
kvm 659456 1 kvm_intel
irqbypass 16384 1 kvm
Another quick way to check if the change is effective is by opening the processor setting tab in Virtualbox .
- Enable Nested Virtualization on Vagrant
If you are using vagrant to provision your vm you can also do it by adding below customize line in your vagrant file.
config.vm.provider "virtualbox" do |vb| vb.memory = var_mem_size vb.cpus = var_cpus vb.name = var_vm_name vb.customize ['modifyvm', :id, '--nested-hw-virt', 'on']