Open saied89 opened 2 years ago
I think we need to try qemu-system-x86_64 -M accel=hvf --cpu host
or something
Does the iPhone simulator work?
yes the iPhone simulator works
If we add these and build a new docker image, can it handle an existing mac disk image or do we need to create a new one from scratch?
You can always use existing images, in fact, you can change serial numbers on an existing machine.
I need to install and run docker inside of an running OSX image. When I start docker, it reports that the hardware is incompatible with Docker Desktop
, a problem which I think is kinda similar to the one in question.
Is there anything that can be done in order to make it work?
sysctl kern.hv_support
reports 0
.
I just landed on the same issue as we speak. I'm currently running this stack on top of WSL, everything works fine, but when trying to run Lima the Qemu machine inside refuses to work. Is there a way I can workaround this even without waiting for an offical patch to come up?
//EDIT: Regarding the how I found we can pass an EXTRA
env var to the container, now I need to figure out which is the right set of flags to pass to enable the nested virtualization.
//EDIT2: I see the image by default assigns the kvm:tcg
accelerators via the KVM env var. Maybe enabling hvf
is enough? Although on my own Arch system when I install qemu and run the help command this is the output I get:
$ qemu-system-x86_64 -accel help
Accelerators supported in QEMU binary:
tcg
kvm
Is hvf
supported on the binary provided in this container?
//EDIT3: Ok scratch that, hvf
is supposed to be used on Apple Host machines. So what is missing to correctly allow nested virtualization inside macOS itself? 🤔
//EDIT4: I was successfully able to get nested virtualization by simply passing these two ENV vars to the container!
-e "CPU=max" \
-e "BOOT_ARGS=+vmx" \
Tested on an Intel i7-8550U machine that runs Arch with KDE/Wayland and it works 🎉 sysctl kern.hv_support
now returns 1
and lima VMs can be successfully started.
I'll test it later on WSL on Win11 which runs on an AMD Ryzen 7 5800H.
That's awesome thank you. Do you want to submit a PR to update the docs? I can otherwise
You're welcome :) Feel free as I'd have no idea where to put it at the moment. Thanks for all the great work you've put around this project!
Oh forgot to mention that unfortunately this method does NOT work on AMD CPUs as QEmu needs to pass the CPU capabilities 1:1 and VMX is not a supported extension on AMD CPUs. This is why this method works only on Intel CPUs.
I did try to do a bit of research regarding emulating this extension on AMD CPUs but unfortunately I wasn't able to find anything useful. In case you do please let me know!
I can't run android emulator inside the vm with android studio complaining that "Your CPU does not support VT-x" I think it might be due to the virtual cpu that is set. When I run
sysctl -n machdep.cpu.brand_string
from here it reports a core 2 Dou Penryn which surely doesn't support VT-x. Is is possible to set a more up to date virtual cpu for the vm?