Repository navigation
Mount binfmt_misc when sysinit starts - #14485
joshuaswarren wants to merge 1 commit into
Conversation
|
| [[ -f /usr/lib/systemd/system/proc-sys-fs-binfmt_misc.mount ]] || | ||
| fail "systemd ships proc-sys-fs-binfmt_misc.mount, the unit both enables name" | ||
| grep -qx 'WantedBy=sysinit.target' /usr/lib/systemd/system/proc-sys-fs-binfmt_misc.mount || | ||
| fail "proc-sys-fs-binfmt_misc.mount must keep WantedBy=sysinit.target, or the enable creates no sysinit link" |
There was a problem hiding this comment.
Tests require host systemd files
If the test host lacks /usr/lib/systemd/system/proc-sys-fs-binfmt_misc.mount, these assertions make test/shell fail even when the checkout is correct. The suite is documented to run on any machine, including headless sandboxes. Move this check to the VM acceptance suite, or skip it when the required host files are unavailable.
| grep -rq 'systemctl enable proc-sys-fs-binfmt_misc.mount' "$ROOT/migrations" || | ||
| fail "existing installs have no migration enabling the binfmt_misc mount" | ||
| pass "a migration enables the binfmt_misc mount on existing installs" |
There was a problem hiding this comment.
Migration behavior goes untested
This check only searches for an enable command anywhere under migrations. It never runs 1791412720.sh, so a broken enabled-state check or an enable failure that unexpectedly stops migrations can still pass. Add a test with stubbed systemctl and sudo that checks the enable call, reruns with the unit enabled, and covers an enable failure.
|
Related binfmt_misch change: |
4e21446 to
5600993
Compare
|
Independent layers of the same stack: #6736 rewrites the binfmt registrations themselves (adds the O and C flags through /etc/binfmt.d overrides); this PR only moves the binfmt_misc mount earlier so sysinit.target stops waiting on the mount's rate-limited automount. The file sets are disjoint (this changes install/config/enable-services.sh plus a migration; #6736 adds its own apply command, pacman hook and tests), so they merge in either order and both stay useful together. |
|
Reviewed at 5600993. The stall is real, but #15175 (d100314, merged 2026-10-13) adds On a worker built from the current Omarchy ISO (systemd 262, x86_64, 31 binfmt formats, with #15175's drop-ins installed), boot mounted The only extra case this branch covers is mounting binfmt_misc at sysinit when The second opinion was Codex Medium. It reached the same conclusion: the mechanism is real and #15175 already covers it. It also raised the migration's exit status as its own finding. It may have read this review's notes, so its agreement is not guaranteed to be independent. This now waits on the maintainer, and I recommend closing it as superseded by #15175. Thanks for the measurements, @joshuaswarren. Your numbers match what #15175 found on its own test image. |
|
Thanks for looking at this. I'm closing it. #15175 handles it now. That one mounts binfmt_misc before registration. |
Left to its automount, the
binfmt_miscmount comes up about a second late, andsysinit.targetwaits with it.systemd-binfmtregisters the binfmt formats (33 withqemu-user-static-binfmt) right after the local file systems mount. Its first access triggers thebinfmt_miscautomount. The opening mount burst on an Omarchy machine (/home,/var/log,/var/cache/pacman/pkg,/boot,/boot/efi, fuse) trips systemd's mount rate limit of 5 events in 1 s (src/core/mount.c). While the limit holds,unit_start()returns-EAGAINfor every mount unit (src/core/unit.c). Thebinfmt_miscmount then waits about 1 s past the burst, and the network and sshd wait with it.Measured numbers, recorded in omacom/omarchy-mac-pkgs#16, which this change replaces:
Got automount request for /proc/sys/fs/binfmt_miscat 4.129 s,Mounting Arbitrary Executable File Formatsat 5.094 s. Gap 0.962 to 0.966 s, and no unit started or finished inside it. The one boot whose request came after the window mounted at once.SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST=64) and shortened the Limine timeout, so part of that userspace gain does not come from this change alone.systemd's own
proc-sys-fs-binfmt_misc.mountships[Install] WantedBy=sysinit.target, so enabling it mounts it as sysinit starts, before the burst. Nothing here is Mac-specific: any Omarchy machine with those binfmt formats sees the same stall.Change
install/config/enable-services.sh:systemctl enable proc-sys-fs-binfmt_misc.mount, for new installs.migrations/1791412720.sh: the same enable for existing installs. Idempotent, machine-wide, reports without failing if the enable fails.test/shell.d/systemd-test.sh: new installs enable it, a migration enables it, and systemd's unit keepsWantedBy=sysinit.target. That proves the link resolves, not the ordering or the timing of a live boot.Tests
test/allon this branch: 4122 checks pass, 33 skip, 41 fail. All 41 fail the same way on a cleanquattrocheckout on this host (23test/shell.dfiles and 1test/clicheck), so they are host-environment failures, not from this change.test/shell.d/systemd-test.sh: 16 pass, 0 fail. The migration ran against a stubbedsystemctl: it enables once, stays silent on a rerun, and reports without failing when the enable fails.