5 ms·
Wow, you can use Rosetta to run x86 Linux binaries inside the VM on ARM? That seems pretty awesome. https://developer.apple.com/documentation/virtualization/run
by modeless 4y ago
Wow, you can use Rosetta to run x86 Linux binaries inside the VM on ARM? That seems pretty awesome. https://developer.apple.com/documentation/virtualization/running_intel_binaries_in_linux_vms_with_rosetta https://developer.apple.com/documentation/virtualization/run...
- sascha_sl 4y agoOnly on Ventura, which isn't out yet (and quite frankly, the pre-release version is still a huge mess)
- zakjan 4y agoMaybe I'm missing something, what are the actual commands for running a Linux x64 binary on macOS ARM?
- sascha_sl 4y agoYou just run them after you/your distro registers a handler for them. It uses binfmt behind the scenes. https://en.wikipedia.org/wiki/Binfmt_misc https://en.wikipedia.org/wiki/Binfmt_misc (To be clear, this is for running Linux x86 inside Linux arm64 VMs on an Apple Silicon host)
- aliqot 4y agoYou can do this in UTM, it's a GUI that wraps QEMU.
- mattl 4y agoHas anyone seen a guide to installing OpenBSD on M1 Mac using UTM?
- aliqot 4y agoNo, but given that UTM is a graphical wrapper around QEMU would this be a worthy substitute? https://codeofconnor.com/running-an-arm64-openbsd-virtual-machine-on-apple-silicon-with-qemu/ https://codeofconnor.com/running-an-arm64-openbsd-virtual-ma...
- mattl 4y agoThanks. I’ll give it a go.
- oneplane 4y agoUTM can use both native Apple Virtualisation and QEMU virtualisaion+emulation. The QEMU one can't make use of the M1/M2 Intel memory translation acceleration the same way native virtualisation can, but it can make use of acceleration on ARM64 workloads.
- wtallis 4y agoYou don't run the Linux x64 binary on macOS ARM. You run the Linux x64 binary on Linux ARM inside a VM on macOS ARM.
- zakjan 4y agoIt seems overly complicated. Is there any benefit over using Docker?
- wtallis 4y agoI'm not sure what you think Docker on a Mac does. Docker is a Linux-specific piece of software, and the only way to use it within macOS is to run a Linux virtual machine, with Docker running inside the Linux VM. If the containers you want to run with Docker are x86 software, that Linux VM either needs to be an x86 Linux distro running in qemu emulation of a full x86 machine, or an ARM Linux distro using the new (not yet released in stable macOS) Rosetta for Linux translation.
- zakjan 4y agoSure, there is a VM in Docker as well. I'm sorry if it wasn't clear, I'm looking for the most straightforward way. With Docker it's a single command, it helps with documenting the steps for other coworkers. It feels slow though. I'm wondering if the new way with Rosetta is going to be better in performance.
- jen20 4y agoThe most straightforward way is to use a product. This article documents the APIs for those building those products.
- geofft 4y agoWell, kind of. Docker is a product, with official support for Linux containers on Mac (and Windows containers on Windows!). Docker for Mac comes with a Linux VM as a feature of the product; you don't need to install it yourself inside a VM (though that works, too). It does sound like adding Rosetta binfmt_misc support would allow Docker for Mac to ship an ARM64 kernel/VM image instead of an amd64 one and benefit from some performance boost, but potentially at the risk of reliability/fidelity. The entire idea of Docker is that the kernel ABI is a (supposedly) stable interface, and even if your userspace changed around it, a Docker container would have its own userspace and wouldn't care. Running a different-architecture kernel and dynamically translating it necessarily means that there will be visible differences in the kernel ABI. Sure, you can translate those differences, but that gets you farther from the promise.
- watermelon0 4y agoI've tried using this a while back, soon after Apple released Ventura beta to developers. I can say that documentation (and examples) are quite nice and easy to follow, I managed to start Linux VM with Rosetta support, and SSH, in 1-2 hours. Geekbench numbers were quite close when running in VM (via Rosetta) and natively, they were only a few percentages slower in VM, so it stands to reason that computation heavy workload would run great. However, using development tools regularly resulted in segmentation fault or crashing for other reasons (e.g. when doing `npm install`). I didn't dig deeper to figure out what are the reasons for this. Additionally, real-world (from developer's point-of-view) workloads such as running web servers, building software, or running tests, were quite slow compared to running in an ARM VM.
- gorkish 4y agoI found that the Rosetta/Linux support worked best to run x86_64 containerized workloads, and I never experienced crashes working this way. In my experience, this is far more reliable than using something like debian/ubuntu multiarch support to install both aarch64 and x86_64 into the base system. I ran x86_64 geekbench in a Linux/aarch64 VM using both Rosetta and QEMU binfmt_misc support and found that Rosetta outperformed QEMU by about 3x. The extra speed is welcome, but I do hope that all the dirty tricks Rosetta uses are eventually able to be used by both non-apple implementations of x86_64 emulation and on non-apple ARM CPUs.