Home FAQ How To Enable Nested Virtualization In VirtualBox
How To Enable Nested Virtualization In VirtualBox

How To Enable Nested Virtualization In VirtualBox

By sk
3470 Views

This brief guide describes how to enable nested virtualization in VirtualBox in Linux. Nested virtualization is a feature that allows us to run virtual machines within virtual machines. For instance, let us say you run a CentOS VM using Oracle VirtualBox in your Ubuntu Linux system. If nested VT feature is enabled on your Ubuntu, you can install virtualbox or KVM in the CentOS VM and run other VMs inside of it. So basically it is a method of running virtualization environment inside another virtualization environment.

Enable Nested Virtualization In VirtualBox

Starting from version 6.1, Oracle VirtualBox supports nested virtualization feature on host systems that run AMD and Intel CPUs. So make sure you have running the latest virtualbox version.

We can enable nested feature either from command line or GUI. First, let us see the command line way.

Enable Nested Virtualization Feature For VirtualBox VM From Commandline

First, let us find the list of available VMs using command:

$ vboxmanage list vms

Sample output:

"CentOS 8 Server" {73997fc7-4ae2-42bf-a11d-fcbe00721e13}
"Ubuntu 20.04 Server" {a7cab540-51c2-4110-b489-a4ad13b71f96}

list available virtualbox VMs

As you can see, I have created two VMs in my Virtualbox.

Now, I am going to enable nested feature for a CentOS 8 VM using command:

$ VBoxManage modifyvm "Ubuntu 20.04 Server" --nested-hw-virt on

Also, you can use vboxmanage command in lowercase:

$ vboxmanage modifyvm "Ubuntu 20.04 Server" --nested-hw-virt on

This command enables nested virtualization, with passthrough of hardware virtualization functions to the guest VM.

Here, I have included the virtual machine name in quotes, because it contains spaces in the name. If it doesn't has spaces in the name, you don't need to mention it inside quotes.

Enable Nested Virtualization Feature For VirtualBox VM From GUI

Open VirtualBox manager either from Dash or Menu. Click on the VM in which you wanted to enabled the nested feature and then select "Settings".

virtual machine settings in virtualbox

Go to "System -> Processor" and click the "Enable Nested VT-x/AMD-V" check box. Click OK to save the changes.

Enable nested virtualization in virtualbox manager

From now on this VM will act as a hypervisor, so that you can run VMs inside it.

Like I already mentioned, Nested VT feature is available on host systems that run AMD and Intel CPUs. However, for Intel CPUs, the option is grayed out. So, you can't directly enable it from Virtualbox manager.

Enable Nested VT-x option is greyed out in virtualbox

To enable nested feature on Intel CPUs, follow the command line way as described in the previous section.

Verify if nested virtualization is enabled for VMs

Start the VM in which you just enabled the nested feature.

Log in to the VM and run the following command to check if nested feature is enabled or not:

$ egrep --color -i "svm|vmx" /proc/cpuinfo

Verify If nested virtualization is enabled in virtualbox VM

If you see “vmx” (Intel-VT technology) or “svm” (AMD-V support) in the output, the virtualbox guest machine can work as a hypervisor and host VMs. As you can see in the above output, my Ubuntu 20.04 VM supports virtualization.

Check the following guide to learn more ways to check if a Linux system supports VT or not.


Related read:


Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More