#1099638 foreign architecture issues

#1099638#5
Date:
2025-03-05 11:22:46 UTC
From:
To:
Hi Adam and Johannes,

I tried using mmdebstrap for loong64 and that didn't go well. The
failure has multiple layers. I actually found the first layer last.

1. arch-test has no clue about loong64 and therefore mmdebstrap goes
   investigate what's the problem with it.

2. mmdebstrap figures that it has no clue what the qemu arch name for
   loong64 is. Please extend the mapping to loong64 => 'loongarch64'.

3. Then, mmdebstrap looks up qemu-loongarch64 using update-binfmts
   --display, but since Debian trixie, qemu-user-binfmt no longer
   installs its files to /usr/share/binfmts and no longer supports
   update-binfmts. They are only installed to /usr/lib/binfmt.d now.

Maybe the loong people can supply patches here?

Helmut

#1099638#10
Date:
2026-10-07 10:49:32 UTC
From:
To:
Hi,

Quoting Helmut Grohne (2025-03-05 12:22:46)

$ mmdebstrap --variant=apt --arch=loong64 unstable /dev/null
I: automatically chosen mode: unshare
I: loong64 cannot be executed natively, but transparently using qemu-user binfmt emulation
I: finding correct signed-by value...
done
I: automatically chosen format: null
I: using /tmp/mmdebstrap.S24GdoSNEI as tempdir
I: running apt-get update...
done
I: downloading packages with apt...
done
I: extracting archives...
done
I: installing essential packages...
done
I: installing remaining packages inside the chroot...
done
done
I: cleaning package lists and apt cache...
done
done
I: removing tempdir /tmp/mmdebstrap.S24GdoSNEI...
I: success in 95.2309 seconds

Can this bug be closed?

Thanks!

cheers, josch

#1099638#15
Date:
2026-10-07 11:14:11 UTC
From:
To:
Hi Johannes,

There were three distinct bugs reported. One was cloned as #1099639 and
fixed there. The second was about a missing arch mapping for loong64 and
that is definitely addressed in 1.5.7-3 (possibly earlier).

The third bug is about discovery of the qemu executable via binfmts in
the case where emulation turns out not to work. This code path is now
skipped thanks to the other fixes, but I still think that using
update-binfmts is no longer useful as the primary mechanism of loading
them has changed.

As you prefer. The main goal definitely is fixed. Or we can leave this
open and retitle it to a minor bug that asks for replacing
update-binfmts --display.

Helmut

#1099638#18
Date:
2026-10-08 13:40:29 UTC
From:
To:
Hi Helmut,

Quoting Helmut Grohne (2026-10-07 13:14:11)

do you have some reference text of what is wrong with update-binfmts and why it
is no longer useful? I do not see any deprecation notice in the description of
the binfmt-support binary package in unstable. The update-binfmts program still
exists in unstable and still has the --display option.

Thanks!

che

#1099638#23
Date:
2026-10-08 15:45:22 UTC
From:
To:
Hi Johannes,

There are two competing ways to configure binfmts. Let me call them
binfmt-support and systemd. (Guess which one existed earlier.)

binfmt-support uses /usr/{share,lib}/binfmts and expects extension-less
files in a multiline notation.

systemd uses /usr/lib/binfmt.d and expects .conf files containing a
single colon-separated line.

Please try apt-file search -x '[be]/binfmt[.s]' to get an idea of the
adoption of either formats.

Ideally, we only have one such format and despite binfmt-support being
the older one, I think we're having a difficult time converting the
systemd people. Also qemu does not provide the support files for
binfmt-support anymore. The only package in sid that does not yet
support the systemd way is jarwrapper.

So I'd suggest deleting binfmt-support from Debian. Not because it would
be buggy. Not because it came later (it came first). But because systemd
is too-big-to-fail and the competing standards evidently pose confusion.
I'm not going to push for this though.

Helmut

#1099638#26
Date:
2026-10-10 10:57:22 UTC
From:
To:
Quoting Helmut Grohne (2026-10-08 17:45:22)

Great stuff. Seems we need something for platforms which do not use systemd
which is able to consume the /usr/lib/binfmt.d format and registers them as
expected. The format is really simple, maybe i find some time. But this then
has to become another test case for mmdebstrap: foreign architecture emulation
using the kernel's binfmt support on platforms without systemd as init.

I'm re-opening this bug with a new title to not forget about this issue.

Thanks!

cheers, josch

#1099638#31
Date:
2026-10-10 12:34:33 UTC
From:
To:
Quoting Johannes Schauer Marin Rodrigues (2026-10-10 12:57:22)

OpenRC has its own implementation:

https://github.com/OpenRC/openrc/blob/14e11b7f5b09072aa1433e790bbf832800858fec/init.d/binfmt.in

Maybe it can be repurposed. Thanks to werdahias for the reference and for
packaging openrc.

cheers, josch