RPi-Distro / pi-gen

Tool used to create the official Raspberry Pi OS images
BSD 3-Clause "New" or "Revised" License
2.57k stars 1.61k forks source link

Register binfmt_misc entry for docker build #685

Closed moh53n closed 1 year ago

moh53n commented 1 year ago

In some distros (like some archlinux based distros) qemu-user-static package doesn't register qemu for binfmt and causes problem. multiarch/qemu-user-static solves this by a simple privileged docker run. AFAIK it doesn't make any conflict with existing qemu-user-static packages and it's a universal solution. I think it's good to use this in the docker build script in order to prevent possible problems on various distros.

XECDesign commented 1 year ago

Don't know enough to assess whether this is worthwhile. I'll wait for more feedback from docker users. I'm just a bit suspicious of trusting a random third party thing that can change under our feet.

moh53n commented 1 year ago

I agree. There is also another approach that makes sure binfmt works without relying on a third party; I'm going to update the pull request.

moh53n commented 1 year ago

Now, we check if qemu-arm-static and /proc/sys/fs/binfmt_misc are present and then register a binfmt_misc entry to ensure qemu-arm-static is registered (binfmt_misc won't care duplicate entries unless they have common names).

XECDesign commented 1 year ago

Cheers

JavanXD commented 8 months ago

This PR broke my build-docker.sh command which I've been using for years on MacOS. The Shell script exits with the error message qemu-arm-static not found (please install qemu-user-static) although the build is working fine the versions before the PR. I am using MacOS Sonoma Version 14.0 (23A344). I have not found any way to install the missing package so I moved back in time using a few tags before to git checkout 2023-02-21-raspios-bullseye.