Repository navigation
Mount binfmt_misc at the start of boot, not through its automount - #16
joshuaswarren wants to merge 1 commit into
Conversation
systemd-binfmt registers Omarchy's qemu-user-static-binfmt formats right after the local file systems mount, and its first access triggers the binfmt_misc automount. That burst of mounts (/home, /var/log, /var/cache/pacman/pkg, /boot, /boot/efi, fuse) puts systemd's /proc/self/mountinfo rate limit (5 events in 1 s) in effect, and unit_start() holds every mount start job with -EAGAIN until it expires. sysinit.target, and the network and sshd behind it, waited for that: 0.96 s on 5 of 6 M2 Max boots (automount request 4.129 s, mount start 5.094 s; nothing else started or finished in between), and the same 0.965 s on an M1 Max. proc-sys-fs-binfmt_misc.mount carries WantedBy=sysinit.target for this: a vendor .wants link pulls it in as boot starts, before any burst, and systemd-binfmt finds it mounted. The install test now checks that every .wants link this package ships names a unit this package or systemd ships.
maralcbr
left a comment
There was a problem hiding this comment.
Nice diagnosis, and the evidence is solid. systemd's own proc-sys-fs-binfmt_misc.mount declares WantedBy=sysinit.target and systemd-binfmt orders after it, so early activation is an upstream-supported arrangement, and sharing systemd's .wants directory isn't a conflict.
But nothing in it is Mac-specific. The rate limit is tripped by Omarchy's own mount burst (/home, /var/log, the pacman cache, /boot, fuse) plus qemu-user-static-binfmt, which any Omarchy machine with those formats hits. Per CONTRIBUTING ("the fix helps other machines too → upstream"), please move this to omacom/omarchy (or wherever Omarchy ships its systemd defaults), with the boot timings. The .wants link-existence test is a good idea to bring along. Note it proves the link resolves, not the ordering or the timing.
|
Both points in review 5448427284, moved upstream in omacom/omarchy#14485 (commit 4e214461):
Closing this PR in favor of omacom/omarchy#14485. After that merges, |
On a Mac with the qemu-user-static-binfmt formats, boot waits about one second for the binfmt_misc mount. sysinit.target waits with it, and so do the network and sshd.
systemd-binfmtregisters the 33 formats right after the local file systems mount. Its first access triggers the binfmt_misc automount. That burst of mounts (/home,/var/log,/var/cache/pacman/pkg,/boot,/boot/efi, fuse) trips systemd's/proc/self/mountinforate 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). So the binfmt_misc mount waits until about 1 s after the burst.I measured it on a 14-inch M2 Max (systemd 262), in 5 of 6 boots.
Got automount request for /proc/sys/fs/binfmt_misccame at 4.129 s, andMounting Arbitrary Executable File Formatsat 5.094 s. The gap was 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. A 16-inch M1 Max shows the same 0.965 s gap.proc-sys-fs-binfmt_misc.mountalready saysWantedBy=sysinit.target. A vendorsysinit.target.wantslink pulls it in as boot starts, before any burst. Sosystemd-binfmtfinds it mounted and never waits on the automount. The automount stays as it is, and the README says why.mac-boot-install-test.shnow also checks that every.wantslink this package ships names a unit this package or systemd ships. Systemd skips a dangling link at boot without a word. A throwaway dangling link made the new check fail with "pulls a unit that neither this package nor systemd ships".Checked at 1478b08 on main f47d3db (no newer upstream commits at the time), on a Debian host with the runtime CI pins (omacom/omarchy bf659459):
.github/scripts/check-scopeandcheck-architecture-gatesexit 0.mac-boot-install-test.shpasses with the new check, and so do the other 21 test files that pass on main. Three omarchy-mac-boot test files also fail on main here, so they are not caused by this change:apple-silicon-boot-check-test.sh(exit 127, a missing tool),mac-external-displays-test.shandupdate-m1n1-locale-test.sh(exit 1).shellcheck -S warningfinds nothing in the files this adds; the two warnings in changed test files are already on main. CI runs the full suites in the Arch container once this is open.On a 16-inch M1 Max, a lab test boot with the mount enabled at boot start (2026-10-07) showed no automount request in two boots. The baseline had one at 3.621 s. Userspace went from 4.70 s to 3.68 and 3.75 s. That test also raised the mount rate limit on the kernel command line (
SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST=64) and shortened the Limine timeout. So I cannot say how much of the 1.0 s userspace gain comes from this change alone.The same stall likely hits any Omarchy install with this mount layout and qemu-user-static-binfmt. This change is Mac-only, because this package owns the Mac boot path.