5

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.

UPDATE:

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

  • I had similar problem. Try to open "Software & updates -> Additional Drivers -> " and select NVIDIA driver for your GPU instead of "nouveau" video driver. For me it solved problem. I found solution here: "stackoverflow.com/questions/39584765/…" – Dmitry_L Mar 6 at 11:58
  • @Dmitry_L the problems happens inside the VM where there are no NVIDIA drivers – Guerlando OCs Mar 6 at 22:15
  • How many CPU Cores did you give the VM? You may need to give it a few more. Look at the system resources of the VM as you run android studio (or attempt to) and see what it requires more of. – Gordster Mar 6 at 22:29
  • @Gordster I have 7 which is enough, my setup has 16 – Guerlando OCs Mar 7 at 0:33
  • If the issue happened on the guest, and on the host, then the issue cannot be the guest/kvm. You are stating that you tried it on the host system, right? – Gordster Mar 7 at 0:38
3
+75

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.


VirtualBox

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.

| improve this answer | |
  • thank you but this is not the problem, I gave 10gb of RAM to the VM and had 20 left for the host – Guerlando OCs Mar 6 at 22:10
  • 1
    @GuerlandoOCs Just to double check, did you make sure you selected the options listed at the very top of the answer? The part about acceleration and nested paging? – Gordster Mar 7 at 2:03
  • 1
    @Gordster I'm using virt-manager, not virtualbox. I just searched "nested virtualization virt-manager" and the only post I found was about setting the CPU to copy host's configuration. I checked and mine is doing that. Do you know about anything more I should do? – Guerlando OCs Mar 7 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.