Bug ID 1143725
Summary qemu-aarch64-binfmt, from qemu-linux-user, not working (no output)
Classification openSUSE
Product openSUSE Tumbleweed
Version Current
Hardware x86-64
OS Other
Status NEW
Severity Normal
Priority P5 - None
Component Basesystem
Assignee bnc-team-screening@forge.provo.novell.com
Reporter dfaggioli@suse.com
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

Context: I want to run an ARM64 (aarch64) container on an x86 host. This is
possible using qemu Linux user emulation and Linux binfmt. It is supposed to
work like this:

//Fetching an ARM container on x86 (long story)
$ skopeo --override-arch arm64 copy docker://opensuse/leap
docker-daemon:opensuse-arm64/leap:latest

//Install qemu Linux user, and setup binfmt for aarch64
# zypper install qemu-linux-user
$ cp /usr/bin/qemu-aarch64-binfmt .
# echo -1 > /proc/sys/fs/binfmt_misc/qemu-aarch64 
# echo
':qemu-aarch64:M:0:\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-aarch64-binfmt:POCF'
> /proc/sys/fs/binfmt_misc/register

//Build our container
$ cat << EOF > Dockerfile
FROM opensuse-arm64/leap
COPY qemu-aarch64-binfmt /usr/bin/qemu-aarch64-binfmt
EOF
docker build -t qemu-leap .

//Now I should be able to run the ARM container, like this:
# docker run -it qemu-leap-aarch64-binfmt /bin/sh

But, basically, nothing happens. No output at all, and I'm definitely not
inside an ARM container. Actually, it appears the container exited:

$ docker ps --all
CONTAINER ID        IMAGE                      COMMAND                  CREATED
            STATUS                       PORTS               NAMES
ea2252caf90a        qemu-leap                  "/bin/sh"                4
seconds ago       Exited (255) 3 seconds ago                      
relaxed_goodall

Now, if I, instead of qemu-aarch64-binfmt, use a qemu-aarch64-static binary
copied from a Debian unstable box I have in my home network, i.e., this one:

# ./qemu-aarch64-static -version
qemu-aarch64 version 3.1.0 (Debian 1:3.1+dfsg-8)

Things work! In fact:

$ docker run -it --rm qemu-leap uname -a
Linux bf12752f6a51 5.1.16-1-default #1 SMP Wed Jul 3 12:37:47 UTC 2019
(2af8a22) aarch64 aarch64 aarch64 GNU/Linux

Note the *aarch64*. Of course, we need to change the aarch64 interpreter file
too, in /proc/sys/fs/binfmt

So, basically, it looks like the procedure is correct, or at least can work.
But our qemu-linux-user packages contain binaries that are not adequate for
being used for this use case.

Things/differences to check:
- QEMU version (the debian stolen from Debian, that makes things works is from
QEMU 3.1.0, while we ship 4.0.0
- our patch queue
- our configuration and compile options


You are receiving this mail because: