Enable Nested Virtualization in VirtualBox on AMD Ryzen
In this article
Nested virtualization lets you run a hypervisor (like another VirtualBox, VMware, or Hyper-V) inside a virtual machine. On AMD Ryzen systems, VirtualBox can pass through the necessary virtualization extensions (SVM) to the guest, but you need to enable this feature explicitly. This guide walks you through the exact steps, from checking your CPU support to configuring the VM, and includes common pitfalls and fixes.
What You'll Need
- A computer with an AMD Ryzen CPU (most Ryzen models support SVM).
- VirtualBox installed (version 6.1 or newer recommended; the steps are similar for 7.x).
- Administrator/root access to your host OS (to change VirtualBox settings and possibly BIOS).
- The virtual machine you want to enable nested virtualization on (it should be powered off).
Step-by-Step
- Verify your CPU supports virtualization. On Windows, open Task Manager > Performance > CPU and check “Virtualization: Enabled”. On Linux, run
egrep -c '(vmx|svm)' /proc/cpuinfo(a number greater than 0 means support). On macOS, runsysctl -a | grep -i svm(if nothing appears, your Mac may not expose SVM to VirtualBox). - Enable SVM in your host's BIOS/UEFI. Restart your computer and enter BIOS (usually by pressing Del, F2, or F10 during boot). Look for a setting named “SVM Mode”, “AMD-V”, or “Virtualization”. Set it to Enabled. Save and exit. This is required even if your OS reports virtualization is already on—some BIOS versions disable it by default.
- Install VirtualBox if you haven't already. Download the latest version from the official VirtualBox website and install it. During installation, you may be prompted to install the VirtualBox Extension Pack—this is not required for nested virtualization, but it's useful for USB and RDP features.
- Open a command prompt or terminal as administrator. On Windows, right-click Command Prompt and select “Run as administrator”. On Linux/macOS, open your terminal (use
sudofor the commands). - Find the exact name of your VM. Run
VBoxManage list vmsto see all your VMs. Note the exact name in quotes, e.g., “My Ubuntu VM”. - Enable nested virtualization for that VM. Run the following command, replacing
VM_NAMEwith your VM's name:VBoxManage modifyvm "VM_NAME" --nested-hw-virt on
On Windows, the command is the same. On Linux/macOS, you may need to prefix withsudoif VirtualBox is installed system-wide. - Verify the setting was applied. Run
VBoxManage showvminfo "VM_NAME" | grep -i nested(Windows:VBoxManage showvminfo "VM_NAME" | findstr /i nested). You should see “Nested VT-x/AMD-V: on” or similar. - Start the VM and check inside the guest. Boot the VM. Inside the guest OS, check if virtualization extensions are visible. For example, on Linux run
egrep -c '(vmx|svm)' /proc/cpuinfo; on Windows, runsysteminfoand look for “Virtualization Enabled In Firmware: Yes”. If you see these, nested virtualization is active. - To disable it later: Use
VBoxManage modifyvm "VM_NAME" --nested-hw-virt off.
Common Mistakes
- Forgetting to enable SVM in BIOS. Even if VirtualBox shows the option, the host CPU must have SVM active. If you skip this, nested virtualization won't work.
- Using a 32-bit guest. Nested virtualization only works with 64-bit guests that have hardware virtualization enabled in the VM settings (under System > Acceleration).
- Running the command without admin rights. On Windows, if you don't run Command Prompt as administrator, you'll get “Permission denied” errors.
- Typing the VM name wrong. If the name contains spaces, you must enclose it in quotes. Otherwise, the command may apply to a different VM or fail.
- Assuming the setting applies to all VMs. The
--nested-hw-virtsetting is per-VM. You must run the command for each VM you want to enable.
Tips
- Use the latest VirtualBox version. Nested virtualization has improved significantly in recent releases. If you're on an older version, consider upgrading.
- Keep the guest OS updated. Some guest OSes (like Windows 10/11) may need updates to properly expose virtualization to nested hypervisors.
- Test with a lightweight VM first. If you're new to nested virtualization, try it with a small Linux VM before attempting a full Windows Server or Hyper-V setup.
- Check the VirtualBox user manual. The official manual has a section on nested virtualization that may include specific notes for your version.
Troubleshooting
- Guest still shows virtualization disabled. First, double-check that SVM is enabled in the host BIOS. Then, ensure the VM is fully powered off (not paused) before running the modifyvm command. Also, verify that the VM's processor settings have “Enable PAE/NX” and “Enable VT-x/AMD-V” checked (System > Processor > Acceleration).
- VM fails to start after enabling nested virtualization. This can happen if the guest OS doesn't support nested virtualization or if the VM has incompatible settings. Try disabling nested virtualization and see if the VM boots normally. If it does, check the guest OS requirements.
- Performance is poor inside the nested hypervisor. Nested virtualization always has a performance overhead. Ensure you have allocated enough RAM and CPU cores to the VM. Also, consider using paravirtualization (e.g., VirtIO) for disk and network drivers.
- “Nested paging” error in VirtualBox. If you see an error about nested paging, try disabling nested paging in the VM settings (System > Acceleration > “Enable Nested Paging”). This sometimes conflicts with nested virtualization.
- On Linux hosts, the command says “VBoxManage not found”. The command may not be in your PATH. Try using the full path, e.g.,
/usr/bin/VBoxManageor/opt/VirtualBox/VBoxManage.
Frequently Asked Questions
Does nested virtualization work on all AMD Ryzen CPUs?
Most Ryzen CPUs support SVM, which is required. However, some older or budget models may have it disabled in firmware. Check your CPU's specifications or use a tool like CPU-Z to confirm.
Can I run Hyper-V inside a VirtualBox VM on Ryzen?
Yes, but you must also enable the “Expose virtualization extensions to guest OS” option in VirtualBox (the same --nested-hw-virt setting). Inside the guest, you'll need to enable Hyper-V in Windows Features.
Will enabling nested virtualization affect my host's performance?
No, the setting only affects the specific VM. The host runs normally. However, the VM itself may run slightly slower due to the overhead of virtualization within virtualization.
Do I need the Extension Pack for nested virtualization?
No, the Extension Pack is not required. Nested virtualization is a core VirtualBox feature.
How do I know if my guest OS supports nested virtualization?
Most modern 64-bit OSes (Windows 10/11, Linux kernels 4.x+, FreeBSD) support it. Check the OS documentation for any specific requirements.
What's the difference between “Enable VT-x/AMD-V” and “Nested Virtualization”?
“Enable VT-x/AMD-V” tells VirtualBox to use hardware virtualization for the VM itself. “Nested Virtualization” (the --nested-hw-virt flag) tells VirtualBox to expose those virtualization extensions to the guest, allowing it to run its own hypervisor.