#1061960 systemd-binfmt.service should get started when something gets added into a previously empty /usr/lib/binfmt.d

Package:
systemd
Source:
systemd
Description:
system and service manager
Submitter:
Johannes Schauer Marin Rodrigues
Date:
2024-02-22 10:03:03 UTC
Severity:
normal
Tags:
#1061960#5
Date:
2024-01-30 13:49:51 UTC
From:
To:
Hi,

steps to reproduce:

 $ debvm-create
 [...]
 $ debvm-run
 [...]
 root@testvm:~# systemctl status systemd-binfmt.service
 ○ systemd-binfmt.service - Set Up Additional Binary Formats
      Loaded: loaded (/usr/lib/systemd/system/systemd-binfmt.service; static)
      Active: inactive (dead)
   Condition: start condition unmet at Tue 2024-01-30 13:44:24 UTC; 25s ago
              ├─ ConditionDirectoryNotEmpty=|/lib/binfmt.d was not met
              ├─ ConditionDirectoryNotEmpty=|/usr/lib/binfmt.d was not met
              ├─ ConditionDirectoryNotEmpty=|/usr/local/lib/binfmt.d was not met
              ├─ ConditionDirectoryNotEmpty=|/etc/binfmt.d was not met
              └─ ConditionDirectoryNotEmpty=|/run/binfmt.d was not met
 root@testvm:~# apt install qemu-user-static
 [...]
 root@testvm:~# systemctl status systemd-binfmt.service
 ○ systemd-binfmt.service - Set Up Additional Binary Formats
      Loaded: loaded (/usr/lib/systemd/system/systemd-binfmt.service; static)
      Active: inactive (dead)
   Condition: start condition unmet at Tue 2024-01-30 13:44:24 UTC; 2min 47s ago
              ├─ ConditionDirectoryNotEmpty=|/lib/binfmt.d was not met
              ├─ ConditionDirectoryNotEmpty=|/usr/lib/binfmt.d was not met
              ├─ ConditionDirectoryNotEmpty=|/usr/local/lib/binfmt.d was not met
              ├─ ConditionDirectoryNotEmpty=|/etc/binfmt.d was not met
              └─ ConditionDirectoryNotEmpty=|/run/binfmt.d was not met


As a result, just installing a binfmt provider will not immediately enable it.

Starting or restarting makes it work as tested by Jochen Sprickerhof

Maybe the binfmt.d trigger should restart systemd-binfmt.service so that
enabling a new binfmt works without rebooting the machine.

Thanks!

cheers, josch

#1061960#10
Date:
2024-01-30 17:42:13 UTC
From:
To:
Am 30.01.24 um 14:49 schrieb Johannes Schauer Marin Rodrigues:
https://salsa.debian.org/systemd-team/systemd/-/blob/debian/master/debian/systemd.postinst?ref_type=heads#L16

I think replacing that with restart should be the most straight forward fix.

systemd-binfmt is not a long running service which might have been
stopped by the administrator and where we need to respect that and not
accidentally start it.

Michael

#1061960#13
Date:
2024-02-22 10:01:04 UTC
From:
To:
Hello,

Bug #1061960 in systemd reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/systemd-team/systemd/-/commit/c1d50874b1d2cccb50e24569df58d293806a66b4
------------------------------------------------------------------------
systemd-binfmt: use restart instead of try-restart on upgrade

It's not a long-running service so it doesn't matter, and it fixes installing a new binfmt provider

Closes: #1061960
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1061960