tonistiigi / binfmt

Cross-platform emulator collection distributed with Docker images.
MIT License
964 stars 70 forks source link

Error when emulating linux/amd64 on linux/s390x host #128

Open Mon-ius opened 1 year ago

Mon-ius commented 1 year ago

Related commands:

linux1@t1:~$ sudo docker run --privileged --rm tonistiigi/binfmt --install all
installing: ppc64le OK
installing: mips64le OK
installing: mips64 OK
installing: arm64 OK
installing: arm OK
installing: 386 OK
installing: amd64 OK
installing: riscv64 OK
{
  "supported": [
    "linux/s390x"
  ],
  "emulators": [
    "qemu-aarch64",
    "qemu-arm",
    "qemu-i386",
    "qemu-mips64",
    "qemu-mips64el",
    "qemu-ppc64le",
    "qemu-riscv64",
    "qemu-x86_64"
  ]
}

First, install all platform; then run the container for linux/amd64,

linux1@t1:~$ sudo docker run --privileged --platform=linux/amd64 \
    --restart=always -itd \
    --name warp_one \
    --sysctl net.ipv6.conf.all.disable_ipv6=0 \
    --cap-add net_admin \
    -p 14888:9091 \
    -v /lib/modules:/lib/modules \
    ubuntu:focal

However, it wont start as it should be, it just keep restarting; actually same commands work when using the ARM platform, but it failed to run on S390x this time.

linux1@t1:~$ sudo docker ps -a
CONTAINER ID   IMAGE          COMMAND       CREATED              STATUS                            PORTS     NAMES
0951d5e0af79   ubuntu:focal   "/bin/bash"   About a minute ago   Restarting (132) 42 seconds ago             warp_one
Mon-ius commented 1 year ago

Looks like one update 3 days before fuck up the whole emulate... Today, I found the ARM one failed to do the same task, sad :(

Mon-ius commented 1 year ago

For ARM machine, I found a solution: just use docker run --privileged --rm tonistiigi/binfmt:qemu-v6.2.0 --install amd64 rather than docker run --privileged --rm tonistiigi/binfmt --install amd64.

However, the S390x still not work.

tonistiigi commented 1 year ago

You haven't included any indication of what syscall fails. If you can trace it to syscall and it is a QEMU regression you can report it in their tracker. It is possible that it is not a regression bug though and somebody just fixed missing error handling in the previous version.

bltcn commented 11 months ago

me too. [root@ecs-01 ~]# uname -a Linux ecs-01 4.18.0-80.7.2.el7.aarch64 #1 SMP Thu Sep 12 16:13:20 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux

[root@ecs-01 ~]# docker version Client: Docker Engine - Community Version: 24.0.6 API version: 1.43 Go version: go1.20.7 Git commit: ed223bc Built: Mon Sep 4 12:33:18 2023 OS/Arch: linux/arm64 Context: default

Server: Docker Engine - Community Engine: Version: 24.0.6 API version: 1.43 (minimum version 1.12) Go version: go1.20.7 Git commit: 1a79695 Built: Mon Sep 4 12:32:27 2023 OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.6.24 GitCommit: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523 runc: Version: 1.1.9 GitCommit: v1.1.9-0-gccaecfc docker-init: Version: 0.19.0 GitCommit: de40ad0

[root@ecs-01 ~]# docker buildx version github.com/docker/buildx v0.11.2 9872040

[root@ecs-01 ~]# docker run --privileged --rm tonistiigi/binfmt --install all installing: arm OK installing: s390x OK installing: ppc64le OK installing: riscv64 OK installing: mips64le OK installing: amd64 OK installing: 386 OK installing: mips64 OK { "supported": [ "linux/arm64", "linux/386", "linux/mips64", "linux/arm/v7", "linux/arm/v6" ], "emulators": [ "qemu-arm", "qemu-i386", "qemu-mips64", "qemu-mips64el", "qemu-ppc64le", "qemu-riscv64", "qemu-s390x", "qemu-x86_64" ] }

[root@ecs-01 ~]# docker buildx ls NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS default * docker
default default running v0.11.6+616c3f613b54 linux/arm64, linux/riscv64, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6, linux/mips64le log.txt