diff --git a/pmb/chroot/binfmt.py b/pmb/chroot/binfmt.py index c6cd270b..4328e372 100644 --- a/pmb/chroot/binfmt.py +++ b/pmb/chroot/binfmt.py @@ -18,10 +18,15 @@ def register(args, arch): Get arch, magic, mask. """ arch_qemu = pmb.parse.arch.alpine_to_qemu(arch) + + # always make sure the qemu- binary is installed, since registering + # may happen outside of this method (e.g. by OS) + if f"qemu-{arch_qemu}" not in pmb.chroot.apk.installed(args): + pmb.chroot.apk.install(args, ["qemu-" + arch_qemu]) + if is_registered(arch_qemu): return pmb.helpers.other.check_binfmt_misc(args) - pmb.chroot.apk.install(args, ["qemu-" + arch_qemu]) # Don't continue if the actions from check_binfmt_misc caused the OS to # automatically register the target arch