Package Details: binfmt-qemu-static 20210119-1

Git Clone URL: https://aur.archlinux.org/binfmt-qemu-static.git (read-only, click to copy)
Package Base: binfmt-qemu-static
Description: Register qemu-static interpreters for various binary formats
Upstream URL: http://www.freedesktop.org/software/systemd/man/binfmt.d.html
Licenses: GPL
Submitter: net147
Maintainer: crab2313
Last Packager: crab2313
Votes: 34
Popularity: 1.68
First Submitted: 2013-12-31 06:30 (UTC)
Last Updated: 2021-01-19 04:05 (UTC)

Latest Comments

whynothugo commented on 2022-08-05 23:11 (UTC)

This package is not arch=('any'). any means that the same package can be used on any architecture without rebuilding. Installing this package on any of the following architectures results in an unbootable system:

aarch64
alpha
arm
armeb
cris
m68k
microblaze
mips
mipsel
ppc
ppc64
s390x
sh4
sh4eb
sparc
sparc32plus
sparc64
riscv64

This is because it registers binfmt for those architectures, so when attempting to run any binary compiled for the local architecture, the system will attempt to run the binary with qemu-static and fail.

Can you please update arch=('x86_64')?

rapiz commented on 2021-12-16 12:48 (UTC)

Can P flag be added for the binfmt? Without P, some programs that rely on argv[0] will behave incorrectly, like failing self-test.

bageljr commented on 2021-08-16 17:06 (UTC)

Chroot and remove the package

vglinden commented on 2021-08-13 11:19 (UTC)

To anyone reading this using suite66 (or any non systemd), the /etc/66/script/binfmt.sh does not run at first:

:: Running post-transaction hooks...
(1/1) Registering binary formats...
/etc/66/script/binfmt.sh: 15: printf: printf: I/O error

You have to make a small modification:

#!/bin/sh

mountpoint -q /proc/sys/fs/binfmt_misc || \
mount -t binfmt_misc binfmt /proc/sys/fs/binfmt_misc

for path in /usr/lib/binfmt.d /etc/binfmt.d /run/binfmt.d; do
    [ ! -d $path ] && continue
    [ -z "$(ls $path)" ] && continue
    grep -h "^:" $path/* | \
        while read -r line; do
            reg=${line#*:}
            if [ -e /proc/sys/fs/binfmt_misc/${reg%%:*} ]; then
                echo -1 > /proc/sys/fs/binfmt_misc/${reg%%:*}
            else
                printf "%s" "$line" > /proc/sys/fs/binfmt_misc/register
            fi
        done
done

Then add a script for your init system. In suite66:

/etc/66/service/binfmt_qemu

[main]
@type = classic
@version = 0.0.1
@description = "bitfmt for other architectures"
@user = ( root )
@options = ( log )

[start]
@execute = ( /etc/66/script/binfmt.sh )

And finally enable the service: sudo 66-enable -t default binfmt_qemu.

sporos commented on 2021-07-21 23:30 (UTC)

So is there any way to recover my aarch64 system after installing this? Because it seems that removing /usr/lib/binfmt.d/qemu-static.conf from my rootfs is not enough to allow the system to boot again.

Anty0 commented on 2021-06-27 11:40 (UTC)

@wubo2929 status=0/SUCCESS - It did what it was supposed to do and exited. :) It isn't supposed to keep running. systemd-binfmt.service will setup kernel to handle binfmt according to your configuration and then it will exit.

ArchGuyWu commented on 2021-06-27 02:13 (UTC)

Service systemd-binfmt.service cannot start: Active: active (exited) Process: 257 ExecStart=/usr/lib/systemd/systemd-binfmt (code=exited, status=0/SUCCESS) Main PID: 257 (code=exited, status=0/SUCCESS)

khvalera commented on 2021-01-06 13:01 (UTC)

Line: qemu-ppc64abi32: throws an error!

ogarcia commented on 2020-12-16 07:44 (UTC)

@solstice confirmed!

@Stykers can you update package?

solsticedhiver commented on 2020-12-14 11:06 (UTC) (edited on 2020-12-14 11:06 (UTC) by solsticedhiver)

qemu-arch-extra does not include /usr/bin/qemu-ppc64abi32-static anymore.

So systemd-binfmt.service fails to start because of this.

/lib/binfmt.d/qemu-static.conf needs to be modified to remove the line about /usr/bin/qemu-ppc64abi32-static

jpegxguy commented on 2020-11-25 00:35 (UTC)

To anyone reading this: You might be interested in binfmt-qemu-static-all-arch instead.

phire commented on 2020-08-24 07:58 (UTC)

This package claims to support 'any' architecture.

In reality, it essentially bricks any non-x86 machine it's installed on (for example, aarch64, which qemu-user-static-bin provides)

This is because it always installs an qemu-aarch64 binfmt handler, causing every single native executable to fail with: "cannot execute binary file: Exec format error"

gamezelda commented on 2020-03-05 16:35 (UTC) (edited on 2020-03-05 20:24 (UTC) by gamezelda)

Like I also posted in binfmt-qemu-static-all-arch, relative to the binaries in qemu-user-static-bin, those architectures files are still missing:

qemu-aarch64_be
qemu-hppa
qemu-microblazeel
qemu-mips64
qemu-mips64el
qemu-mipsn32
qemu-mipsn32el
qemu-nios2
qemu-or1k
qemu-ppc64le
qemu-riscv32
qemu-tilegx
qemu-xtensa
qemu-xtensaeb

It looks like definitions can be found here: https://github.com/qemu/qemu/blob/master/scripts/qemu-binfmt-conf.sh , except I didn't found qemu-nios2 and qemu-tilegx, but the rest should be there.

EDIT: I could generate a list of formats like this, however it looks like some of the existing binfmts have masks that are a bit different?! However this comes from the official qemu distribution so I guess it can be trusted?

rm -rf /tmp/qemubinfmts && mkdir -p /tmp/qemubinfmts && ./qemu-binfmt-conf.sh --systemd ALL --exportdir /tmp/qemubinfmts --qemu-path /usr/bin --qemu-suffix -static && for x in /tmp/qemubinfmts/*; do cat "$x" | sed 's/$/CF/'; done

commented on 2019-07-31 11:50 (UTC)

Can you add ppc64le to this?

falstaff_ch commented on 2019-01-11 14:03 (UTC)

Can you also add the C and F flag at the end?

C: to determine new process credentials based on program file rather than interpreter file (see setuid); implies O flag. F: to make the kernel open the binary at configuration time instead of lazily at startup time, so that it is available inside other mount namespaces and chroots as well.

SamWhited commented on 2018-11-02 15:07 (UTC) (edited on 2018-11-02 15:11 (UTC) by SamWhited)

Please add riscv64:

:qemu-riscv64:M::\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-riscv64-static:

(assuming https://wiki.debian.org/RISC-V is up to date)

Strit commented on 2018-10-09 18:13 (UTC)

Won't the interpretors need to be updated when the binaries get updated? I ask, because the binaries where updated in August and I have been having problems since that happened.

dariost commented on 2018-08-15 12:58 (UTC)

Could you add qemu-riscv32 and qemu-riscv64?

chungy commented on 2015-02-08 05:08 (UTC)

aarch64 can be enabled by uncommenting the arm64 line and replacing "arm64" with "aarch64". The existing magic and mask should be good.

chungy commented on 2014-05-29 10:40 (UTC)

Could the depends on qemu-static be dropped please, or at least changed to an optdepends=('qemu-static')? I'm just wanting to use the binfmt conf to assist with creating a Debian SPARC chroot, and since Debian has its own qemu-user-static package, I don't really need to install one from AUR. Thanks :)