New Build with Nested Virtualization in MacOS VM

Hello everyone,

I want to build a new workstation for work and play.

The general idea of the workstation is to allow me to run Linux/Windows/MacOs VMs on the same box, and switch between them depending on the use case.

The setup would run on UNRAID, Proxmox or a Linux host with the other two OSs running in VMs.

Linux - as my default OS
Windows - as my gaming OS
MacOS - as my work OS

The first two I know how to setup, but the third one gets slightly more complicated.

As a mobile developer I need to be able to run multiple Simulators/Emulators of Mobile Devices inside MacOS, so I don’t have to own multiple physical devices for debugging.

Questions:

  1. What hardware would you recommend ?
  • I’m looking at the Ryzen 9 5950X (not set in stone but seems like a good price/performance option)
  1. Is this even possible at this moment in time with an AMD CPU ?
  • I’ve already tried to make this run on a i5 6600k just to see if it would work with UNRAID.
  • I’ve installed Macinabox and booted my MacOS VM, but as soon as I opened Android Studio and wanted to start an emulator, I was greeted with the message “Your CPU does not support VT-x”.
  • I’ve already seen posts on the forum about enabling VM nesting in UNRAID, but this didn’t help.

Any input is much appreciated.

Thank you.

Kind regards.

Any reason why your using Mac for developing android ? Why not just use Android studio in your Linux environment which you said was your default anyways … Just curious.

As for AMD and Mac OS yes it’s done without issues and I do use it with my threadripper. Now I have never tried nesting virtualization since when I do develop for Android I use intellij on Linux.

Are you going to pass gpus through to all machines? I ask because I want to do something similar but only a linux for main os and windows for gaming if I can find a work around for Tarkov. I ask because I have a 5900x and cores aren’t the issue it’s really the PCIe lanes. You run out quick on AM4 I was thinking threadripper would be a better solution. I am fairly new to this so if I’m way off please let me know.

@masc2279
I’ve mentioned Android Studio just as an example where the issue is evedent. I need to use MacOS because I’m developing apps for both platforms (iOS && Android) so I need to be able to run virtual devices for both of them.

I’ve also read on another forum that nested virtualization might not be possible on MacOS with an AMD CPU. Having virtualization working inside a VM is possible only with the passthrough of the CPU, and not possible to emulate with an emulated CPU. It might be a limitation of MacOS, because it expects to have VT-X available, not AMD-V.

Since you are running on an AMD platform, would you be so kind and try out running an emulator inside your MacOS VM ?

Your input would help a lot since this is quite a niche requirement.

Thank you :+1:

@Kilping
Yes, I’m planning to get my hands on a RX 6800 XT.
From my research it works like a charm on all 3 platforms and when passed to any VM. Please note, I’ll be running only one OS at a time, so I won’t need multiple GPUs, at least for now :slight_smile:

1 Like

Yes i can try later tonight for you …

Had a few mins between meetings … here you go, not an issue at all 3 devices without issues.

1 Like

also with the following

Having virtualization working inside a VM is possible only with the passthrough of the CPU, and not possible to emulate with an emulated CPU.

I am not passing the CPU directly this is normal emulation and not even passing a GPU in since the threadripper just chews threw anything in mac os.

Here is the steps to setup that i used …

absolutely no issues or special config to make it work it works out of box for AMD Threadripper.

Hi @masc2279 ,

Awesome! Thank you for the feedback!

I’ve already run a VM on linux using macOS-Simple-KVM, great project.
On a 4 core i5 6600k with no GPU passed to the VM, very slow. You could get some work done but I wouldn’t want to spent to much time in that environment.

Now, regarding your screenshot:

  1. Just to confirm you didn’t have to enable nested virtualization on the host, or in the config of the VM, it just works ? :slight_smile:

  2. I’ve read in another post that nested virtualization is very slow, can you confirm ?
    (Even on a 12 cores x299 overclocked to 5ghz && on a 32 thread 64GB dual xeon)

  3. The problem that I had might have been limited to just Android Studion checking if the CPU is capable of virtualization, I haven’t tried running any iOS Simulators because I don’t have Xcode installed at the time, might be something worth checking out ?

So far I’ve been getting contradicting sets of information, from NO it can’t be done unless you use an Intel CPU, to YES look at it running on my machine.
I prefer your answer :+1:

Once again, thank you, your help is much appreciated.

Cheers

So if you need i can install intellj and run those simulators but it will be mid week due to some project deadlines that is if you need.

Just to confirm you didn’t have to enable nested virtualization on the host, or in the config of the VM, it just works ? :slight_smile:

Correct just using the normal setup of simpleKVM no pass thru of any kind and it all works … And for me its extremely responsive. But thats with a caveat …

  1. Threadripper 3990x whcih i can throw a ton of cores and threads at it and to me it runs just like native. But as you can see i thru 64cores at it from the picture grated it could not fit them all on the Activity Monitor LOL.
  2. Highpoint 7540 NVMe 8xFirecudat 2TB drives raid card set in RAID0 which is crazy fast ! so there is never a wait for the VM to fetch things.
  3. And a but load of ram.

So let me know if you want me to test Android Simulation in MacOS VM.

Hi @masc2279,

I’ve found out some additional information yesterday:

The simulator is not an emulator, it runs the iOS APIs under macOS, so it’s fast. The Android Emulator runs in a VM, that is what’s slow, no matter the number of cores, what locks it down is single thread.

That’s a response from an user on redit. You can check the entire conversation here:

So to sum it all up, if I wanted to use MacOS just for Apple related things I should run like native, iOS Simulator included, but spinning up another VM inside of it is a no go, so I’ll just run the Android side of things in the Linux host. I can work with that :slight_smile:

Regarding your offer, if you have the time to install Android Studion and see how an Android Emulator behaves in a virtualized environment I would be more than happy to hear the results.

Thank you.

Cheers.

Ok i will test that in my next available window … But yes running android studio on the linux side would be better than it ever would be running in a VM so i agree with that assessment …

So out of box no change to configuration there is no nested VT-x by default. This is the first test since i had to stand my VM to run a task so i quickly tested it with out of box settings. Later when i am free i will enable pass thru and see what it does.

Theoretically it should be easy to enable by the following

sudo modprobe -r kvm_amd
sudo modprobe kvm_amd nested=1

then mod your config

qemu-system-x86_64 -cpu host

or in vert manager

i may be missing something but when i get a little time i will test it out.

1 Like