By default nested virtualization in Oracle VM VirtualBox on linux system is disabled. With the release of VirtualBox 6.1 we can enable nested virtualization on Intel CPUs starting with 5th generation Core i.
Prerequisites for VirtualBox Nested Virtualization:
- VirtualBox Version 6.1 or higher
- AMD CPU / Intel CPU ( Core i5 or higher)
In article we will demonstrate how to enable nested virtualization on Intel CPUs for VirtualBox VM on Linux.
Install / Upgrade VirtualBox to latest version
Note: You can Skip this step if already have VirtualBox 6.1 on your Linux system
At time of writing this article, latest version of VirtualBox is 6.1, so in case you are running an older version of virtualbox on system then run the following commands to install and upgrade it.
For Ubuntu / Debian
linuxtechi@ubuntu:~$ wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - linuxtechi@ubuntu:~$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - linuxtechi@ubuntu:~$ sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" linuxtechi@ubuntu:~$ sudo apt-get update linuxtechi@ubuntu:~$ sudo apt-get install virtualbox-6.1 -y
If you get the following error message while starting or creating a VM after upgrading VirtualBox,
To resolve this issue, execute the following commands
linuxtechi@ubuntu:~$ sudo apt-get remove virtualbox-dkms -y linuxtechi@ubuntu:~$ sudo /sbin/vboxconfig
For CentOS / RHEL / Fedora
Create VirtualBox 6.x repo file with following contents,
[root@linuxtechi ~]# vi /etc/yum.repos.d/virtualbox.repo [virtualbox] name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
save and exit the file,
Run below Yum / DNF command to install virtualbox 6.1
[root@linuxtechi ~]# yum install VirtualBox-6.1 -y or [root@linuxtechi ~]# dnf install VirtualBox-6.1 -y
Note: In case on your Linux system, if VirtualBox 6 repository is already configured then skip the repository configuration part, You can directly install or upgrade virtualbox.
Enable Nested Virtualization for VirtualBox VM
Let’s suppose i have a centos vm on my virtualbox, i want to enable nested virtualization for this vm, before enabling login to vm and execute the following command,
# grep -E --color 'vmx|svm' /proc/cpuinfo
Above command output confirms that nested virtualization is not enabled on centos vm.
Let’s power off this VM and enable VT-x /AMD-v , Select the VM for which you want to enable nested virtualization, then click on settings. Under the System Tab, select Processor and click on “Enable Nested VT-x/AMD-v” under the Extended Features Tab,
click on Ok to save the changes
In case “enable Nested VT-x/AMD-v” is greyed out then we can enable it via command line , execute the following command,
$ VBoxManage modifyvm <VM-Name> –nested-hw-virt on
Example :
linuxtechi@ubuntu:~$ VBoxManage modifyvm ubuntu18 --nested-hw-virt on
Now let’s verify from Centos VM whether nested virtualization is enabled or not, power on the VM and login to console and run following commands,
# egrep -E –color ‘svm|vmx’ /proc/cpuinfo # lscpu
Output of above commands confirm that Nested Virtualization has been enabled on CentOS VirtualBox VM.
That’s all from this article, I hope this article was informative and you get better understanding on how to enable Nested VT-x / AMD-v feature on Oracle VM VirtualBox. Please don’t hesitate to share your feedback and comments.
from Linuxtechi https://ift.tt/2TAXfYQ
0 Comments