Running Virtual Machines within Virtual Machine on Oracle VirtualBox

Tu Duong
1 min readMay 1, 2021

What am I trying to do here?

My main workstation is running Windows 10, and I am using Oracle VirtualBox (version 6.1) to manage and run multiple virtual machines. For particular, one of the VMs is Ubuntu Linux.

And within my Ubuntu Linux, I want to setup the Chef Test Kitchen… and behind the scene, it will spin up one or more virtual machines within my Ubuntu instance (technically it’s running virtual machines within virtual machine, or nested virtualization)

Then… I ran into this error message: VT-x is not available (VERR_VMX_NO_VMX)

What’s going on?

By default, Oracle VirtualBox disable the nested virtualization. To enable nested virtualization:

  • First, make sure you are running Oracle VirtualBox version 6.1 or newer
  • On your host machine:
vboxmanage modifyvm "<VM Name>" --nested-hw-virt on
  • To find your list of VMs, do:
vboxmanage list vms

That should do the trick… and to verify if nested virtualization is enabled for your VM:

  • Log in to the VM and run the following command:
egrep -c '(vmx|svm)' /proc/cpuinfo

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.

In addition, for Ubuntu, you can do the following to be sure your hardware supports KVM (Kernel-based Virtual Machine)

sudo apt-get install cpu-checker
sudo kvm-ok

You should get something like this:

INFO: /dev/kvm exists
KVM acceleration can be used

--

--

Tu Duong
0 Followers

Developer who love developing...