https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/binfmt-misc.rst
According to the doc to enable something you use:
#enable support for packed DOS applications (pre-configured dosemu hdimages):
echo ':DEXE:M::\x0eDEX::/usr/bin/dosexec:' > register
I have installed qemu-system-aarch64, qemu-user-static, qemu-user-static-binfmt.
cat /proc/sys/fs/binfmt_misc/status
enabled
ls /proc/sys/fs/binfmt_misc/
register status
I'd like to chroot to aarch64 systems, that's why I am doing this (from x86_64).
There is some binfmt file provided by one of qemu packages, you can cat it in the same way
I listed the files installed, I think that it is this:
cat /usr/lib/binfmt.d/qemu-aarch64-static.conf
:qemu-aarch64:M::\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-static:FP
Or maybe be-static?
qemu-user-static-binfmt /usr/lib/binfmt.d/qemu-aarch64-static.conf
qemu-user-static-binfmt /usr/lib/binfmt.d/qemu-aarch64_be-static.conf
I used this:
echo ':qemu-aarch64:M::\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-static:' > /proc/sys/fs/binfmt_misc/register
Is it correct?
I cannot cat the register:
cat /proc/sys/fs/binfmt_misc/register
cat: /proc/sys/fs/binfmt_misc/register: Invalid argument
Is that normal?
No, you need normal one
It's ok, aarch64 file should appear in the same directory if it was registered correctly
It worked I have the qemu-aarch64 file there and I can chroot.
Now I have all of them:
ls /proc/sys/fs/binfmt_misc
qemu-aarch64 qemu-mips qemu-riscv64
qemu-aarch64_be qemu-mips64 qemu-s390x
qemu-alpha qemu-mips64el qemu-sh4
qemu-arm qemu-mipsel qemu-sh4eb
qemu-armeb qemu-mipsn32 qemu-sparc
qemu-hexagon qemu-mipsn32el qemu-sparc32plus
qemu-hppa qemu-or1k qemu-sparc64
qemu-loongarch64 qemu-ppc qemu-xtensa
qemu-m68k qemu-ppc64 qemu-xtensaeb
qemu-microblaze qemu-ppc64le register
qemu-microblazeel qemu-riscv32 status
Not sure what triggered that.
Edit:
The binfmt service, from dinit-rc, should do that automatically.
So you can just restart that.
Instead of powering off the device I hibernated so it wasn't restarted.