Skip to content

Running mips/mipsel images fails #15

Open
@mayeut

Description

@mayeut

When trying to run mips/mipsel images, docker can't start the container.

Matt$ docker run -it --rm multiarch/debian-debootstrap:mipsel-jessie /bin/uname -a
panic: standard_init_linux.go:175: exec user process caused "no such file or directory" [recovered]
	panic: standard_init_linux.go:175: exec user process caused "no such file or directory"

goroutine 1 [running, locked to thread]:
panic(0x88f8a0, 0xc820152d90)
	/usr/local/go/src/runtime/panic.go:481 +0x3e6

After a while thinking about an error with the images, I finally found that the no such file or directory was related to the qemu binary.

We can check that the expected one is present in the image:

Matt$ docker run -it --rm multiarch/debian-debootstrap:mipsel-jessie /usr/bin/qemu-mipsel-static /bin/uname -a
Linux b9de7767a6d1 4.4.39-moby #1 SMP Fri Dec 16 07:34:12 UTC 2016 mips GNU/Linux

What happens in fact is that when running docker run --privileged --rm multiarch/qemu-user-static:register, 2 qemu binaries get registered for the mips magic/mask.The same goes for mipsel.

I moved a bit the lines from register.sh to emphasize this:

   echo ':mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:'${QEMU_BIN_DIR}'/qemu-mips-static:' > /proc/sys/fs/binfmt_misc/register
echo ':mipsn32:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:'${QEMU_BIN_DIR}'/qemu-mipsn32-static:' > /proc/sys/fs/binfmt_misc/register
   echo ':mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:'${QEMU_BIN_DIR}'/qemu-mipsel-static:' > /proc/sys/fs/binfmt_misc/register
echo ':mipsn32el:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:'${QEMU_BIN_DIR}'/qemu-mipsn32el-static:' > /proc/sys/fs/binfmt_misc/register

What happens when starting a mips image is that qemu-mipsn32-static is not found.

I worked around that issue (c.f. libjpeg-turbo/libjpeg-turbo#106) by creating a new image that adds another copy of qemu-mipsel-static with the name qemu-mipsn32el-static.

I don't know how this should/could be fixed (well, other than removing/commenting the n32 variants). Adding the real copy of qemu-mipsn32el-static to the image leads to qemu exiting with an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions