qemu-user-static icon indicating copy to clipboard operation
qemu-user-static copied to clipboard

Unsupported ioctl: cmd=0x400454ca, Docker on Intelx86-64 Linux runs Armv7 Containers

Open lyon0417 opened this issue 5 years ago • 7 comments

/kind bug

Description:

Steps to reproduce the issue:

  1. I can build virtual network interface in local. (kernel : tun module)
  2. I can also build virtual network interface in others amd64 container (ex: ubuntu 16.04)
  3. I successfully run my program on docker avmv7 container.

as the title, when I runs Armv7 Container

root@a4cea7e5c656:/# tunctl Unsupported ioctl: cmd=0x400454ca TUNSETIFF: Function not implemented

Is the architecture not yet supported ? or I need to add ioctl mapping manually?

Environment:

linux version : Linux 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux (ubuntu 18.04)

qemu version : lastest

docker image : armv7/armhf-ubuntu tag: 16.04

docker version : Client: Docker Engine - Community Version: 19.03.5 API version: 1.40 Go version: go1.12.12 Git commit: 633a0ea838 Built: Wed Nov 13 07:29:52 2019 OS/Arch: linux/amd64 Experimental: false

Server: Docker Engine - Community Engine: Version: 19.03.5 API version: 1.40 (minimum version 1.12) Go version: go1.12.12 Git commit: 633a0ea838 Built: Wed Nov 13 07:28:22 2019 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.10 GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339 runc: Version: 1.0.0-rc8+dev GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657 docker-init: Version: 0.18.0 GitCommit: fec3683

lyon0417 avatar Dec 17 '19 03:12 lyon0417

For the steps to reproduce the issue, could you share it with the actual commands?

Is the architecture not yet supported ?

At least, the armv7 (ARM 32-bit) CPU architecture emulation is implemented in QEMU, and the binfmt_misc file /proc/sys/fs/binfmt_misc/qemu-arm is also available.

For example sudo command works with a specific binfmt_misc flags (credential option). Ref https://github.com/multiarch/qemu-user-static/issues/17#issuecomment-434423150 .

Does your case work with following command?

$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes

$ cat /proc/sys/fs/binfmt_misc/qemu-arm
enabled
interpreter /usr/bin/qemu-arm-static
flags: OCF
offset 0
magic 7f454c4601010100000000000000000002002800
mask ffffffffffffff00fffffffffffffffffeffffff

$ docker run something_to_run_arch_container

Some system calls in the container works for only docker run --privileged option.

Does your case work with x86_64 container on the x86_64 host?

or I need to add ioctl mapping manually?

I do not understand what you are saying, and not familiar with the topic.

junaruga avatar Dec 17 '19 16:12 junaruga

Dear @junaruga, thanks for your reply.

At least, the armv7 (ARM 32-bit) CPU architecture emulation is implemented in QEMU, and the binfmt_misc file /proc/sys/fs/binfmt_misc/qemu-arm is also available.

For example sudo command works with a specific binfmt_misc flags (credential option). Ref #17 (comment) .

I have seen this issues, but still have similar problem for ioctl.

Does your case work with following command?

$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes

$ cat /proc/sys/fs/binfmt_misc/qemu-arm
enabled
interpreter /usr/bin/qemu-arm-static
flags: OCF
offset 0
magic 7f454c4601010100000000000000000002002800
mask ffffffffffffff00fffffffffffffffffeffffff

$ docker run something_to_run_arch_container

yes, I have the same result as you. $ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes Setting /usr/bin/qemu-alpha-static as binfmt interpreter for alpha
Setting /usr/bin/qemu-arm-static as binfmt interpreter for arm
Setting /usr/bin/qemu-armeb-static as binfmt interpreter for armeb
Setting /usr/bin/qemu-sparc-static as binfmt interpreter for sparc
Setting /usr/bin/qemu-sparc32plus-static as binfmt interpreter for sparc32plus
Setting /usr/bin/qemu-sparc64-static as binfmt interpreter for sparc64
Setting /usr/bin/qemu-ppc-static as binfmt interpreter for ppc
Setting /usr/bin/qemu-ppc64-static as binfmt interpreter for ppc64
Setting /usr/bin/qemu-ppc64le-static as binfmt interpreter for ppc64le
Setting /usr/bin/qemu-m68k-static as binfmt interpreter for m68k
Setting /usr/bin/qemu-mips-static as binfmt interpreter for mips
Setting /usr/bin/qemu-mipsel-static as binfmt interpreter for mipsel
Setting /usr/bin/qemu-mipsn32-static as binfmt interpreter for mipsn32
Setting /usr/bin/qemu-mipsn32el-static as binfmt interpreter for mipsn32el
Setting /usr/bin/qemu-mips64-static as binfmt interpreter for mips64
Setting /usr/bin/qemu-mips64el-static as binfmt interpreter for mips64el
Setting /usr/bin/qemu-sh4-static as binfmt interpreter for sh4
Setting /usr/bin/qemu-sh4eb-static as binfmt interpreter for sh4eb
Setting /usr/bin/qemu-s390x-static as binfmt interpreter for s390x
Setting /usr/bin/qemu-aarch64-static as binfmt interpreter for aarch64
Setting /usr/bin/qemu-aarch64_be-static as binfmt interpreter for aarch64_be
Setting /usr/bin/qemu-hppa-static as binfmt interpreter for hppa
Setting /usr/bin/qemu-riscv32-static as binfmt interpreter for riscv32
Setting /usr/bin/qemu-riscv64-static as binfmt interpreter for riscv64
Setting /usr/bin/qemu-xtensa-static as binfmt interpreter for xtensa
Setting /usr/bin/qemu-xtensaeb-static as binfmt interpreter for xtensaeb
Setting /usr/bin/qemu-microblaze-static as binfmt interpreter for microblaze
Setting /usr/bin/qemu-microblazeel-static as binfmt interpreter for microblazeel
Setting /usr/bin/qemu-or1k-static as binfmt interpreter for or1k $ cat /proc/sys/fs/binfmt_misc/qemu-arm enabled interpreter /usr/bin/qemu-arm-static flags: OCF offset 0 magic 7f454c4601010100000000000000000002002800 mask ffffffffffffff00fffffffffffffffffeffffff

Some system calls in the container works for only docker run --privileged option.

yes, I already have used it.

Does your case work with x86_64 container on the x86_64 host?

yes, I successfully build virtual network interface in others x86_64 container.

or I need to add ioctl mapping manually?

I do not understand what you are saying, and not familiar with the topic.

I apologize for the misunderstanding caused, I guess it misses some ioctl (system call) implementations.

for example, the following simple steps : $ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes $ docker run --privileged -t -i armv7/armhf-ubuntu /bin/bash $ apt-get update $ apt-get install uml-utilities $ tunctl Unsupported ioctl: cmd=0x400454ca TUNSETIFF: Function not implemented

But it can work in x86-64 container.

lyon0417 avatar Dec 18 '19 03:12 lyon0417

Thank you for the steps.

By the way, there is a way for multiple lines code syntax in markdown format, if you do not know it.

That is "back quote x 3". The example is here. https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code-and-syntax-highlighting

junaruga avatar Dec 30 '19 15:12 junaruga

I have a similar issue, different cmd: Unsupported ioctl: cmd=0xffffffff8004f50c

Not using docker, just chrooting with qemu-arm-static in binfmts, then running fossil open repo.fossil (fossil-scm).

sh4r1k7 avatar Mar 23 '20 02:03 sh4r1k7

I also have a similar problem when trying to open /dev/video0 device inside aarch64 docker container (balena/resin). Although irrelevant, I'm using gstreamer to start a pipeline:

root@5bb9d1759c16:/usr/src/app# gst-launch-1.0 v4l2src device=/dev/video0 ! fakesink
Unsupported ioctl: cmd=0xffffffff80685600
Setting pipeline to PAUSED ...
Unsupported ioctl: cmd=0xffffffff80685600
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Error getting capabilities for device '/dev/video0': It isn't a v4l2 driver. Check if it is a v4l1 driver.
Additional debug info:
v4l2_calls.c(94): gst_v4l2_get_capabilities (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
system error: Function not implemented
Setting pipeline to NULL ...
Freeing pipeline ...

hosaka avatar Aug 05 '20 07:08 hosaka

@hosaka I've created a new issue #121 for this case.

vak avatar Oct 16 '20 10:10 vak

I also have a similar problem when trying to open /dev/video0 device inside aarch64 docker container (balena/resin). Although irrelevant, I'm using gstreamer to start a pipeline:

root@5bb9d1759c16:/usr/src/app# gst-launch-1.0 v4l2src device=/dev/video0 ! fakesink
Unsupported ioctl: cmd=0xffffffff80685600
Setting pipeline to PAUSED ...
Unsupported ioctl: cmd=0xffffffff80685600
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Error getting capabilities for device '/dev/video0': It isn't a v4l2 driver. Check if it is a v4l1 driver.
Additional debug info:
v4l2_calls.c(94): gst_v4l2_get_capabilities (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
system error: Function not implemented
Setting pipeline to NULL ...
Freeing pipeline ...

Hi, have you solve the issue? i have the same problem. thanks!

pppaulpeter avatar Oct 01 '21 17:10 pppaulpeter