-
Notifications
You must be signed in to change notification settings - Fork 255
Description
Component
None
Is your enhancement related to a problem? Please describe
This is related to the issues presented in #3483
I was running into issues with amd64 containers with Go based binaries not running correctly with the existing QEMU user mode emulation. I understand there are some incompatibilities/bugs with either QEMU or the Go runtime that cause the panics when under emulation.
By supporting Rosetta 2 on macOS, these issues can be mitigated.
FWIW I have tested this out. I modifed crc to create the vfkit vm with the rosetta device added. I then ssh'ed into the CRC VM and did the following to enable rosetta translation:
sudo mount -t virtiofs -o defcontext="system_u:object_r:bin_t:s0" rosetta /media/rosetta
- the default SELinux context is necessary in order to allow OpenShift containers to use Rosetta properly.sudo ln -s /dev/null /etc/binfmt.d/qemu-x86_64-static.conf
- Create the /etc/binfmt.d/rosetta-x86_64.conf with the following contents:
:rosetta:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00:\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/media/rosetta/rosetta:CF
sudo /usr/lib/systemd/systemd-binfmt --unregister
needed to unregistered the existing qemu x86_64 emulationsudo /usr/lib/systemd/systemd-binfmt
reregisters the qemu i386/i686 emulation as well as the rosetta x86_64 emulation
I then deployed a container that previously panic'ed due to the odd lfstack.push golang error and observed that the containers now ran perfectly well.
Besides mitigating the qemu bug, in theory rosetta emulation may result in a better experience.
Describe the solution you'd like
crc config set use-rosetta true
followed by crc start
when in an unstarted state should result in the crc vm being setup to use rosetta for x86_64 emulation on aarch64 base macOS devices instead of the default qemu-x86_64-static emulation.
It may be worthwhile to enable Rosetta by default.
Describe alternatives you've considered
Fixing QEMU. This probably should be done but as Podman supports Rosetta it seemed worthwhile to also support it with crc.
Additional context
No response