You are not logged in.
I'm trying to set up my system so that I can execute ARM binaries using qemu. The emulator works when
$ file hello
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, for GNU/Linux 2.6.27, not stripped
$ qemu-arm-static hello
Hello, World!
$ ./hello
bash: ./hello: cannot execute binary file
I have double checked that my kernel has support for it
$ cat /proc/config.gz | gunzip | grep BINFMT_MISC
CONFIG_BINFMT_MISC=y
And as far as I can tell, it is all configured correctly
$ cat /proc/sys/fs/binfmt_misc/status
enabled
$ cat /proc/sys/fs/binfmt_misc/qemu-arm
enabled
interpreter mask \xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff
flags:
extension .offset 0
$ update-binfmts --display qemu-arm
qemu-arm (enabled):
package = package qemu-user-static
type = interpreter /usr/bin/qemu-arm-static
offset = credentials yes
magic = offset 0
mask = magic \x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00
interpreter = mask \xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff
detector =
I even double checked the magic...
$ xxd hello | head -n2
0000000: 7f45 4c46 0101 0100 0000 0000 0000 0000 .ELF............
0000010: 0200 2800 0100 0000 008b 0000 3400 0000 ..(.........4...
I have an up-to-date Arch install with kernel 3.11.4-1.
What else can I check to get this working? I am clearly missing something...
-- EDIT --
Ok, so it seems that update-binfmt is lying to me. I just manually registered the handler and it worked fine. It also reports that the interpreter is correct when when looking in
/proc/sys/fs/binfmt_misc/
$ cat qemu-arm-static
enabled
interpreter /usr/bin/qemu-arm-static
flags:
offset 0
magic 7f454c4601010100000000000000000002002800
I will see if I can find out why that is.
Last edited by Alpaca (2013-10-09 07:46:45)
Offline
This issue seems to still be relevant. The problem might be that when registered with systemd-binfmt the F flag is not set:
$ doas systemctl restart systemd-binfmt.service
$ cat /proc/sys/fs/binfmt_misc/qemu-arm
enabled
interpreter /usr/bin/qemu-arm
flags:
offset 0
magic 7f454c4601010100000000000000000002002800
mask ffffffffffffff00fffffffffffffffffeffffff
$ chroot /tmp/raspios-armhf-root/
chroot: failed to run command '/bin/bash': No such file or directory
$ /usr/lib/systemd/systemd-binfmt --unregister
$ cat /usr/lib/binfmt.d/qemu-arm-static.conf > /proc/sys/fs/binfmt_misc/register
$ cat /proc/sys/fs/binfmt_misc/qemu-arm
enabled
interpreter /usr/bin/qemu-arm-static
flags: F
offset 0
magic 7f454c4601010100000000000000000002002800
mask ffffffffffffff00fffffffffffffffffeffffff
$ chroot /tmp/raspios-armhf-root/
root@clt-dsk-t-6010:/#
Last edited by pinsl (2022-09-19 09:23:00)
Offline