Package: qemu-user-static
Version: 1:8.1.1+ds-2
Severity: wishlist

I am using qemu-user-static in conjunction with binfmt-support and
Docker/Podman to allow running foreign-arch containers on amd64. This
approach works quite well, once you get past the speed hit.

The main step involved is making the appropriate static interpreter
executable available at the same path location within the container as
on the host system (because the kernel's binfmt support does not
differentiate between the two environments). For example, the aarch64
interpreter lives on the host at

    /usr/libexec/qemu-binfmt/aarch64-binfmt-P

so when I create an arm64 container, I need to copy in the interpreter
executable to that same location, so that the kernel can find it
whenever it is asked to run an arm64 binary inside the container.

Now, instead of copying the interpreter into the container, a simpler
approach would be to just bind-mount the host's /usr/libexec/qemu-binfmt/
directory inside the container, at the same location. This not only
keeps the foreign-arch container "pure" (no random amd64 binaries in the
image) but also ensures the interpreter is up-to-date, since no copy is
ever made of it that could become stale.

Unfortunately, this approach is currently not possible, because the
qemu-binfmt/ directory only contains symlinks. (I could copy over the
appropriate /usr/bin/qemu-*-static file and it would work, but that then
defeats the purpose of avoiding copies.) If the directory contained
hardlinks, then it would be amenable to bind-mounting into a different
filesystem root.


--Daniel


-- 
Daniel Richard G. || sk...@iskunk.org
My ASCII-art .sig got a bad case of Times New Roman.

Reply via email to