Hi Am 01.05.25 um 19:29 schrieb Santiago Vila:
El 1/5/25 a las 19:16, Paul Gevers escribió:Package: binfmtc Version: 0.17-3 Severity: serious Justification: fails to install Hi, I just saw this on one of my hosts: $ sudo apt install -f Summary: Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 427 1 not fully installed or removed. Space needed: 0 B / 140 GB available Setting up binfmtc (0.17-3) ... /var/lib/dpkg/info/binfmtc.postinst: 6: update-binfmts: not found dpkg: error processing package binfmtc (--configure):installed binfmtc package post-installation script subprocess returned error exit status 127Errors were encountered while processing: binfmtc needrestart is being skipped since dpkg has failed Error: Sub-process /usr/bin/dpkg returned an error code (1)I think this was introduced in commit [226f58c], where the Depends line was changed from "binfmt-support" to "binfmt-support | systemd". Question for Michael: Is systemd supposed to provide another alternative implementation of "update-binfmts"? Or maybe postinst should do nothing when systemd is present?
There is a trigger for systemd-binfmt: https://salsa.debian.org/systemd-team/systemd/-/blob/debian/master/debian/systemd.postinst?ref_type=heads#L48So, I'd say just make the code that runs update-binfmts conditional on the presence of the update-binfmts binary. Something like the attached (untested) patch.
Michael
diff --git a/debian/binfmtc.postinst b/debian/binfmtc.postinst
index 0bcfc04..55d52c4 100644
--- a/debian/binfmtc.postinst
+++ b/debian/binfmtc.postinst
@@ -2,7 +2,7 @@
set -e
#import binfmt.
-if [ configure = "$1" ]; then
+if [ configure = "$1" ] && [ -x "$(command -v update-binfmts)" ]; then
update-binfmts --import ccompile
update-binfmts --import cxxcompile
update-binfmts --import asmassembly
diff --git a/debian/binfmtc.postrm b/debian/binfmtc.postrm
index 8c0098a..a15102d 100644
--- a/debian/binfmtc.postrm
+++ b/debian/binfmtc.postrm
@@ -2,7 +2,7 @@
set -e
#remove binfmt
-if [ remove = "$1" ]; then
+if [ remove = "$1" ] && [ -x "$(command -v update-binfmts)" ]; then
update-binfmts --package binfmtc --remove ccompile /usr/bin/binfmtc-interpreter
update-binfmts --package binfmtc --remove cxxcompile /usr/bin/binfmtcxx-interpreter
update-binfmts --package binfmtc --remove asmassembly /usr/bin/binfmtasm-interpreter
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature