#1127314 systemd-binfmt: clobbers registrations from update-binfmts

Package:
systemd
Source:
systemd
Description:
system and service manager
Submitter:
Kevin Locke
Date:
2026-02-06 21:23:02 UTC
Severity:
normal
#1127314#5
Date:
2026-02-06 21:21:51 UTC
From:
To:
Dear Maintainer,

systemd-binfmts unregisters binfmt_misc formats registered by
update-binfmts (from the binfmt-support package).  To demonstrate:

1. `apt install jarwrapper`
2. `update-binfmts --display` shows "jarwrapper (enabled)"
3. `apt install python3.14-minimal` (anything with /usr/lib/binfmt.d/*)
4. `update-binfmts --display` now shows "jarwrapper (disabled)"

I believe this occurs because the installation or removal of a package
with a file in /usr/lib/binfmt.d causes systemd-binfmt.service to be
restarted by the systemd deb-triggers, which calls
/usr/lib/systemd/systemd-binfmt, which unregisters all binfmt_misc
registrations (both on stop due to --unregister and on start when
called without arguments[1]).

This issue affects any package with a registration in /usr/share/binfmts
without a corresponding one in /usr/lib/binfmt.d.  The only packages I
am aware of are jarwrapper and packages providing a jexec-binfmt
alternative (e.g. openjdk-*-jre-headless).

Has a plan for how to handle binfmt_misc registrations in Debian been
discussed?  Are packages expected to provide both?  Should
systemd-binfmts avoid removing registrations from update-binfmts (and
vice versa) or is failure to provide both a bug in the package making
the registration?

Thanks for considering,
Kevin

[1]: https://github.com/systemd/systemd/blob/v259/src/binfmt/binfmt.c#L246-L247