[Rosetta] Prioritize rosetta over qemu-user-static by creating binfmt.d(5) configuration#2474
Conversation
bf0bfc3 to
52fb3eb
Compare
|
I haven't read the PR yet, but I have 2 questions so far:
|
I am trying to create an aarch64 binary of SwiftLint in my docker-swiftlint repo. While I was able to cross-compile the aarch64 binary using the x86_64 version of the Swift Toolchain, I encountered issues with crashes and hangs when running that aarch64 binary within a Dockerfile using To avoid this issue, I tried various methods of installing
After none of these methods resolved the issue, I tried using After your question, I investigated which distribution of I'll answer the second question in the next post. |
6f54d36 to
003f82a
Compare
I have fixed the issue with the
|
|
Another difference between |
I fixed the mount error that was occurring on Alpine due to this PR. |
Regarding binfmt, the behavior should remain unchanged on non-systemd machines. |
|
I cannot reproduce the kernel panic that occurred in the failed integration test on my local x86_64 machine.
|
837b249 to
b6580e4
Compare
Me too, this issue seems specific to the infra of GHA |
Sometime `qemu-user-static` interpreters are registered with `systemd-binfmt.service(8)` by creating configuration files for `binfmt.d(5)`. By creating a `binfmt.d(5)` configuration for Rosetta, Rosetta will be prioritized over `qemu-user-static` regardless of the execution timing of `systemd-binfmt.service(8)`. In subsequent startups, Rosetta will already be registered with binfmt_misc at this stage, so a check has been added to prevent errors due to duplicate registrations. Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
After creating the `binfmt.d(5)` configuration for Rosetta, `systemd-binfmt.service(8)` attempts to register at an earlier stage in subsequent boots. To prevent errors from not finding the Rosetta interpreter, `user-data` is used to mount the Rosetta volume earlier. Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
Since the mount option workaround for selinux to vz-rosetta will be covered in 05-lima-mounts.sh. Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
If `binfmt.d/rosetta.conf` already exists, Rosetta might already be registered by the time this script is called. To apply the settings in `lima.yml`, if Rosetta is already registered, the script will remove `binfmt.d/rosetta.conf` and unregister it from `binfmt_misc`. Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
b6580e4 to
5ef067b
Compare
|
rebased |
And there are additional patches that are only applied to the Docker Desktop version: https://github.com/tonistiigi/binfmt/blob/015fe68a09f75b84e7cf84cc54466d3add6d01c5/docker-bake.hcl#L80-L86 I've not had time to look into why these patches are relevant to Docker Desktop but not to other uses of I wish somebody could figure out what the ideal version would be for Lima and add it to our docs! |
|
Thanks! 🙏 |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [lima-vm/lima](https://github.com/lima-vm/lima) | minor | `v0.22.0` -> `v0.23.1` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>lima-vm/lima (lima-vm/lima)</summary> ### [`v0.23.1`](https://github.com/lima-vm/lima/releases/tag/v0.23.1) [Compare Source](lima-vm/lima@v0.23.0...v0.23.1) #### Changes - Fixed the CI to generate the release note ([#​2555](lima-vm/lima#2555)) #### Usage ```console [macOS]$ limactl create [macOS]$ limactl start ... INFO[0029] READY. Run `lima` to open the shell. [macOS]$ lima uname Linux ``` *** The binaries were built automatically on GitHub Actions. The build log is available for 90 days: https://github.com/lima-vm/lima/actions/runs/10441930092 The sha256sum of the SHA256SUMS file itself is `e93a48f3a011c25367da50ab3609bb28437fcde259371f005f8b234caa46efff` . *** Release manager: [@​AkihiroSuda](https://github.com/AkihiroSuda) ### [`v0.23.0`](https://github.com/lima-vm/lima/releases/tag/v0.23.0) [Compare Source](lima-vm/lima@v0.22.0...v0.23.0) - YAML: - Add a `param` field for defining variables ([#​2498](lima-vm/lima#2498), thanks to [@​norio-nomura](https://github.com/norio-nomura)) - vz: - Prioritize rosetta over qemu-user-static ([#​2474](lima-vm/lima#2474), thanks to [@​norio-nomura](https://github.com/norio-nomura)) - Configura AOT caching options using an abstract socket ([#​2489](lima-vm/lima#2489), thanks to [@​norio-nomura](https://github.com/norio-nomura)) - Templates: - add `alpine-image` ([#​2360](lima-vm/lima#2360), thanks to [@​jandubois](https://github.com/jandubois)) - remove `centos-stream-8`, `deprecated/centos-7` ([#​2457](lima-vm/lima#2457)) - update to the latest revisions ([#​2553](lima-vm/lima#2553)) - Governance: - MAINTAINERS: invite Oleksandr Redko ([@​alexandear](https://github.com/alexandear)) as a Reviewer ([#​2383](lima-vm/lima#2383)) Full changes: https://github.com/lima-vm/lima/milestone/46?closed=1 Thanks to [@​AdamKorcz](https://github.com/AdamKorcz) [@​AmedeeBulle](https://github.com/AmedeeBulle) [@​SmartManoj](https://github.com/SmartManoj) [@​afbjorklund](https://github.com/afbjorklund) [@​alexandear](https://github.com/alexandear) [@​danchr](https://github.com/danchr) [@​fwilhe2](https://github.com/fwilhe2) [@​jandubois](https://github.com/jandubois) [@​norio-nomura](https://github.com/norio-nomura) [@​tcooper](https://github.com/tcooper) [@​why168](https://github.com/why168) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
This change aims to ensure that Rosetta is prioritized over
qemu-user-staticwhen both are installed. The key steps and intentions of this change include:Creating a
binfmt.d(5)Configuration for Rosetta: This configuration ensures that Rosetta is registered withsystemd-binfmt, taking precedence overqemu-user-static.Early Mounting of Rosetta Volume: Using
user-datato mount the Rosetta volume earlier in the boot process, preventing errors related to the Rosetta interpreter not being found bysystemd-binfmt.service(8).Duplicate Registration Check: Adding a check to avoid errors from duplicate registrations in binfmt_misc during subsequent startups, ensuring smooth operation when Rosetta is already registered.
The expected methods for installing
qemu-user-staticare as follows:docker run --rm --privileged multiarch/qemu-user-static --reset -p yeson a Docker rootful VM.apt-get install qemu-user-staticwithin the provision script inlima.yaml.Both methods create configuration files for
binfmt.d(5).Thanks,