Bug#1012154: binfmt-support.service errors with "unable to close /proc/sys/fs/binfmt_misc/register: File exists"
Am 02.06.22 um 21:52 schrieb Colin Watson: Control: tag -1 fixed-upstream On Thu, Jun 02, 2022 at 01:01:11PM +0200, Michael Biebl wrote: Since we only need to ensure, that systemd-binfmt.service and binfmt-support.service do not run concurrently (and both trying to access /proc/sys/fs/binfmt_misc/register), we simply need to apply a proper ordering. Thankfully, this is rather simple and the attached patch is even more minimal then the previous one. I chose to run binfmt-support.service after systemd-binfmt.service, as the former is pulled in via multi-user.target and the latter via sysinit.target. Thanks, makes sense. I've pushed this patch upstream (https://gitlab.com/cjwatson/binfmt-support/-/commit/54f0e1af8a). Thank you, Colin! OpenPGP_signature Description: OpenPGP digital signature
Bug#1012154: binfmt-support.service errors with "unable to close /proc/sys/fs/binfmt_misc/register: File exists"
Control: tag -1 fixed-upstream On Thu, Jun 02, 2022 at 01:01:11PM +0200, Michael Biebl wrote: > Since we only need to ensure, that systemd-binfmt.service and > binfmt-support.service do not run concurrently (and both trying to access > /proc/sys/fs/binfmt_misc/register), we simply need to apply a proper > ordering. > Thankfully, this is rather simple and the attached patch is even more > minimal then the previous one. > I chose to run binfmt-support.service after systemd-binfmt.service, as the > former is pulled in via multi-user.target and the latter via sysinit.target. Thanks, makes sense. I've pushed this patch upstream (https://gitlab.com/cjwatson/binfmt-support/-/commit/54f0e1af8a). -- Colin Watson (he/him) [cjwat...@debian.org]
Bug#1012154: binfmt-support.service errors with "unable to close /proc/sys/fs/binfmt_misc/register: File exists"
Control: reassign -1 binfmt-support Control: tags -1 + patch Am 02.06.22 um 11:16 schrieb Michael Biebl: Am 01.06.22 um 13:18 schrieb Colin Watson: On Wed, Jun 01, 2022 at 11:25:21AM +0200, Michael Biebl wrote: what you see here is a race condition between binfmt-support.service and systemd-binfmt.service. E.g. qemu installs binfmt config files for both binfmt-support and systemd-binfmt leading to the issue you see. I plan to add a ConditionFileIsExecutable=!/usr/sbin/update-binfmts to systemd-binfmt.service. This will disable systemd-binfmt.service when binfmt-support is installed and should mitigate this issue. (thus reassigning to systemd) Thanks for investigating that. Thinking more about it, it might actually be preferrable, if this condition is shipped by binfmt-support via a drop-in config for systemd-binfmt.service. Thinking about this a bit more, binfmt.d might not strictly be a subset of the config files shipped for binfmt-support. So disabling systemd-binfmt.service via a Condition might not be the best way forward. Since we only need to ensure, that systemd-binfmt.service and binfmt-support.service do not run concurrently (and both trying to access /proc/sys/fs/binfmt_misc/register), we simply need to apply a proper ordering. Thankfully, this is rather simple and the attached patch is even more minimal then the previous one. I chose to run binfmt-support.service after systemd-binfmt.service, as the former is pulled in via multi-user.target and the latter via sysinit.target. Regards, Michael From 88ede367c9534481ac97faef6392000dc974e334 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Thu, 2 Jun 2022 12:56:11 +0200 Subject: [PATCH] Run binfmt-support.service after systemd-binfmt.service This fixes a race condition during boot when both services try to access /proc/sys/fs/binfmt_misc/register at the same time which can lead to the following error: systemd[1]: Starting Enable support for additional executable binary formats... update-binfmts[536]: update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: File exists update-binfmts[536]: update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: File exists update-binfmts[536]: update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: File exists update-binfmts[536]: update-binfmts: exiting due to previous errors systemd[1]: binfmt-support.service: Main process exited, code=exited, status=2/INVALIDARGUMENT systemd[1]: binfmt-support.service: Failed with result 'exit-code'. systemd[1]: Failed to start Enable support for additional executable binary formats. Fixes Debian bug #1012154. --- init/systemd/binfmt-support.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/systemd/binfmt-support.service.in b/init/systemd/binfmt-support.service.in index 25c30e2..f6d0d4d 100644 --- a/init/systemd/binfmt-support.service.in +++ b/init/systemd/binfmt-support.service.in @@ -20,7 +20,7 @@ Description=Enable support for additional executable binary formats Documentation=man:update-binfmts(8) DefaultDependencies=false -After=local-fs.target proc-sys-fs-binfmt_misc.automount +After=local-fs.target proc-sys-fs-binfmt_misc.automount systemd-binfmt.service [Service] Type=oneshot -- 2.36.1 OpenPGP_signature Description: OpenPGP digital signature
Bug#1012154: binfmt-support.service errors with "unable to close /proc/sys/fs/binfmt_misc/register: File exists"
Am 01.06.22 um 13:18 schrieb Colin Watson: On Wed, Jun 01, 2022 at 11:25:21AM +0200, Michael Biebl wrote: what you see here is a race condition between binfmt-support.service and systemd-binfmt.service. E.g. qemu installs binfmt config files for both binfmt-support and systemd-binfmt leading to the issue you see. I plan to add a ConditionFileIsExecutable=!/usr/sbin/update-binfmts to systemd-binfmt.service. This will disable systemd-binfmt.service when binfmt-support is installed and should mitigate this issue. (thus reassigning to systemd) Thanks for investigating that. Thinking more about it, it might actually be preferrable, if this condition is shipped by binfmt-support via a drop-in config for systemd-binfmt.service. This way, the condition is only evaluated when binfmt-support is actually installed. I've attached a possible patch for that. Colin, could you please review and if you agree, I'd re-assign this bug report back to binfmt-support. Michael diff --git a/debian/binfmt-support.conf b/debian/binfmt-support.conf new file mode 100644 index 000..be7b3b7 --- /dev/null +++ b/debian/binfmt-support.conf @@ -0,0 +1,4 @@ +[Unit] +# Do not run systemd-binfmt.service if binfmt-support is installed +# as this can lead to race conditions during boot. +ConditionFileIsExecutable=!/usr/sbin/update-binfmts diff --git a/debian/binfmt-support.install b/debian/binfmt-support.install new file mode 100644 index 000..48b7269 --- /dev/null +++ b/debian/binfmt-support.install @@ -0,0 +1 @@ +debian/binfmt-support.conf lib/systemd/system/systemd-binfmt.service.d/ OpenPGP_signature Description: OpenPGP digital signature
Bug#1012154: binfmt-support.service errors with "unable to close /proc/sys/fs/binfmt_misc/register: File exists"
On Wed, Jun 01, 2022 at 11:25:21AM +0200, Michael Biebl wrote: > what you see here is a race condition between binfmt-support.service and > systemd-binfmt.service. > E.g. qemu installs binfmt config files for both binfmt-support and > systemd-binfmt leading to the issue you see. > > I plan to add a > ConditionFileIsExecutable=!/usr/sbin/update-binfmts > to systemd-binfmt.service. This will disable systemd-binfmt.service when > binfmt-support is installed and should mitigate this issue. > (thus reassigning to systemd) Thanks for investigating that. > Afaics binfmt-support has remained a Debian-only solution, so long-term I'd > think it would be beneficial if we'd consider systemd-binfmt as a > cross-distro solution. > > There aren't that many packages installing config snippets in > /usr/share/binfmts, so a transition seems reasonably doable. I am not interested in this. -- Colin Watson (he/him) [cjwat...@debian.org]
Bug#1012154: binfmt-support.service errors with "unable to close /proc/sys/fs/binfmt_misc/register: File exists"
Control: reassign -1 systemd Control: severity -1 important Control: affects -1 binfmt-support Hi Facundo, what you see here is a race condition between binfmt-support.service and systemd-binfmt.service. E.g. qemu installs binfmt config files for both binfmt-support and systemd-binfmt leading to the issue you see. I plan to add a ConditionFileIsExecutable=!/usr/sbin/update-binfmts to systemd-binfmt.service. This will disable systemd-binfmt.service when binfmt-support is installed and should mitigate this issue. (thus reassigning to systemd) Afaics binfmt-support has remained a Debian-only solution, so long-term I'd think it would be beneficial if we'd consider systemd-binfmt as a cross-distro solution. There aren't that many packages installing config snippets in /usr/share/binfmts, so a transition seems reasonably doable. Colin, what's your take on this? Michael On Mon, 30 May 2022 19:22:09 -0300 Facundo Gaich wrote: Package: binfmt-support Version: 2.2.1-2 Severity: grave Justification: renders package unusable Dear Maintainer, The binfmt-support service fails to start, with the following output: systemd[1]: Starting Enable support for additional executable binary formats... update-binfmts[536]: update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: File exists update-binfmts[536]: update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: File exists update-binfmts[536]: update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: File exists update-binfmts[536]: update-binfmts: exiting due to previous errors systemd[1]: binfmt-support.service: Main process exited, code=exited, status=2/INVALIDARGUMENT systemd[1]: binfmt-support.service: Failed with result 'exit-code'. systemd[1]: Failed to start Enable support for additional executable binary formats. Best, Facundo -- System Information: Debian Release: bookworm/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.17.0-3-amd64 (SMP w/6 CPU threads; PREEMPT) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages binfmt-support depends on: ii libc6 2.33-7 ii libpipeline1 1.5.6-1 ii lsb-base 11.2 binfmt-support recommends no packages. binfmt-support suggests no packages. -- no debconf information OpenPGP_signature Description: OpenPGP digital signature
Bug#1012154: binfmt-support.service errors with "unable to close /proc/sys/fs/binfmt_misc/register: File exists"
Package: binfmt-support Version: 2.2.1-2 Severity: grave Justification: renders package unusable Dear Maintainer, The binfmt-support service fails to start, with the following output: systemd[1]: Starting Enable support for additional executable binary formats... update-binfmts[536]: update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: File exists update-binfmts[536]: update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: File exists update-binfmts[536]: update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: File exists update-binfmts[536]: update-binfmts: exiting due to previous errors systemd[1]: binfmt-support.service: Main process exited, code=exited, status=2/INVALIDARGUMENT systemd[1]: binfmt-support.service: Failed with result 'exit-code'. systemd[1]: Failed to start Enable support for additional executable binary formats. Best, Facundo -- System Information: Debian Release: bookworm/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.17.0-3-amd64 (SMP w/6 CPU threads; PREEMPT) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages binfmt-support depends on: ii libc6 2.33-7 ii libpipeline1 1.5.6-1 ii lsb-base 11.2 binfmt-support recommends no packages. binfmt-support suggests no packages. -- no debconf information