Ubuntu – Nested KVM won’t work (guest freezes)


I'm running, as host, Ubuntu 19.10 with kernel 5.3.0-40-generic. In the guest, Ubuntu 18.04.4 with kernel 5.30.0-40-generic.

When I launch the Android Emulator from Android Studio, the entire guest freezes. I tried 4.15.0-60 on guest, same problem. Tried 4.15.0-1050-oem on host, same problem.


Problem not related to Android Studio emulator, happens on virt-manager too. Seems totally related to KVM

So the problem is:

running any KVM emulation inside the guest makes the guest freeze

Best Answer

KVM Virtual Machine Manager

The recommended amount of RAM for running Android Studio Ubuntu is 8GB. In Virtual Machine Manager the settings for virtual RAM are accessed by selecting the guest OS, then from the Virtual Machine Manager menu select EditVirtual Machine Details → click the blue icon (Show virtual hardware details) to open a new window from which you select Memory and allocate at least 8GB memory to the guest OS.

guest OS on KVM/QEMU

Virtual Machine Manager configures the graphics and hardware-assisted virtualization settings automatically by default, but you may need to enable Intel VT-x or AMD-V hardware-assisted virtualization in UEFI/BIOS.


VT-x/AMD-V needs to be enabled to run the Android Emulator which is included with Android Studio in VirtualBox. If your computer's processor supports Intel VT-x or AMD-V hardware-assisted virtualization, there should also be settings to enable it in UEFI/BIOS. Make sure that the appropriate Intel VT-x or AMD-V settings are enabled in UEFI/BIOS. The following two checkboxes should be checked in VirtualBox SettingsSystemAcceleration tab.

  • Enable Vt-x/AMD-V

  • Enable Nested Paging

Enable Vt-x/AMD-V

Android Studio is a very feature rich IDE, and you need to give it enough resources in order to use all of its great features. The recommended amount of RAM for running Android Studio Ubuntu is 8GB. As you get deeper into Android Studio you'll find out again and again what a resource hog it is. On a guest OS with only 4GB RAM whenever you run Android Studio's emulator, your guest OS will stop responding. Your guest OS will run smoothly if you add another 4GB RAM making it 8GB.

VirtualBox base memory

If you assign too much memory to the virtual machine, the machine might not start, so make sure there is enough memory left over for running the physical machine.

A guest OS in VirtualBox can be configured to use up to 256MB video memory. To increase the video memory to 256MB, open the terminal and type:

VBoxManage modifyvm "Name of VM" --vram 256  

VirtualBox video memory

You can also configure the number of processors in VirtualBox SettingsSystemProcessor tab.

Related Question