I would like to do some lib testing on my OS. So I need several environment to run KVM. And I found my guest machine was not able to run KVM.
I was using virtualbox 4.2.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityI would like to do some lib testing on my OS. So I need several environment to run KVM. And I found my guest machine was not able to run KVM.
I was using virtualbox 4.2.
KVM requires VT-X/AMD-V, but VirtualBox does not pass VT-X/AMD-V to the guest operating system.
Therefore, KVM can't run in VirtualBox (yet). Please track bug ticket #4032.
VT-X and AMD-V (so-called virtualization extensions) run the guest operating system natively in the CPU. Without them, the virtualization software must interpret the operating system opcodes in software, which is very slow.
For now, you can either
egrep -c "(svm|vmx)" /proc/cpuinfo
. 0 means no.
Virtualbox just released (12/18/2018) version 6 in which is expected to have nested virtualization. However, at this moment it seems is still unavailable on Intel procs. https://www.virtualbox.org/wiki/Downloads
Regarding the main question (Enable nested virtualization in Ubuntu) - KVM module is supporting nested virtualization on Ubuntu 16 and above (maybe lower versions too). Not sure about using XEN on host, but you can nest XEN in KVM for sure.
Enable nested virtualization in KVM in UBUNTU Before enabling nested VT feature, power off all running VMs.
Next, unload KVM modules.
To unload KVM module on INTEL systems, run:
$ sudo modprobe -r kvm_intel
On AMD systems:
$ sudo modprobe -r kvm_amd
Reload the KVM module with the nested feature enabled on INTEL CPUs with command:
$ sudo modprobe kvm_intel nested=1
Reload the KVM module with the nested feature enabled on AMD CPUs using command:
$ sudo modprobe kvm_amd nested=1
Enable nested virtualization permanently according with: