From 1478b08f65595d81c323014525f5a5b612090db3 Mon Sep 17 00:00:00 2001 From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Date: Tue, 6 Oct 2026 19:03:47 -0500 Subject: [PATCH] Mount binfmt_misc at the start of boot, not through its automount 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. --- omarchy-mac-boot/README.md | 2 ++ .../proc-sys-fs-binfmt_misc.mount | 1 + omarchy-mac-boot/test/mac-boot-install-test.sh | 12 ++++++++++++ 3 files changed, 15 insertions(+) create mode 120000 omarchy-mac-boot/files/usr/lib/systemd/system/sysinit.target.wants/proc-sys-fs-binfmt_misc.mount diff --git a/omarchy-mac-boot/README.md b/omarchy-mac-boot/README.md index 5dee5f0e..2cbf74d9 100644 --- a/omarchy-mac-boot/README.md +++ b/omarchy-mac-boot/README.md @@ -8,6 +8,8 @@ It covers what stays on an installed Mac and runs again when the Mac updates. Wh While first boot keeps the splash up, a laptop with its lid open shows it on the built-in screen only: `70-omarchy-mac-external-displays.rules` has `/usr/lib/omarchy/mac-boot/external-displays hold` force the Apple display card's external connectors off as the card appears, before Plymouth sees it. The lid is read from the kernel's lid switch (`/usr/lib/omarchy/mac-boot/lid-state`), since the card can appear before logind starts. Nothing is held on a shut or unknown lid, a desktop Mac or once the splash is over. `omarchy-mac-external-displays.service` turns them back on after Plymouth quits and owner setup or a password reset on tty1 ends, before the display manager starts, with a synthetic hotplug so the compositor rescans them. A held display may wake to a black console rather than stay asleep (the kernel console can light it before the hold), and a boot that never reaches multi-user.target keeps it off. +`sysinit.target.wants/proc-sys-fs-binfmt_misc.mount` mounts binfmt_misc as boot starts, instead of on the first access through its automount. `systemd-binfmt` (Omarchy's `qemu-user-static-binfmt` formats) is that first access, right after the local file systems mount. That burst of mounts puts systemd's mount-table rate limit (5 events per second) in effect, and systemd holds every mount start job until it expires. sysinit.target, and with it the network and sshd, then waited about 0.96 s on every boot. + The implementation was moved from runtime integration `e82fe3c8850b184dfa22eefd571646ad85446122`, preserving Marcelo's provenance recorded in the runtime source-port ledger. The payload in `files/` comes from the boot recipe paired with #503 (omarchy-mac/omarchy-pkgs-aarch64#65 at `617a907f99a1`) with maralcbr/omarchy-pkgs#202 applied (omarchy-mac-boot 20260921-10: the owner's keyboard layout and dock keyboards at the disk prompt). The owner wizard, recovery-slot operations, journal/retry handling and shared Limine menu/hash operations remain core code. Hardware setup reaches its setup leaves through `omarchy-lifecycle-dispatch setup-boot [image-first-boot]` (`entrypoints/setup-boot`: `setup/grub-console.sh`, then `setup/limine-boot.sh`, which on an image's first boot asks for the deferred rebuild instead of building the UKI); the image builder sources them directly. `entrypoints/update-takeover ...` answers an update that wants to move aside files no package owns (the step 6 seam asks before it moves anything): read-only, it refuses the whole takeover when any path is the Mac's boot chain, `/usr/lib/initcpio` or pacman configuration, which its image and this package write, or an mkinitcpio file whose own `HOOKS` carry the `asahi` or busybox `encrypt` hook (a legacy Mac's unlock), and lets anything else go, including the memory, USB and mkinitcpio drop-ins omarchy-settings ships on aarch64 too. Owner provisioning, factory reset and `omarchy-drive-password` reach this package only through `omarchy-lifecycle-dispatch`, which runs the `entrypoints/` staged in `/usr/lib/omarchy/mac-boot` and fails on Apple Silicon when they are missing. ## Device tree overlays diff --git a/omarchy-mac-boot/files/usr/lib/systemd/system/sysinit.target.wants/proc-sys-fs-binfmt_misc.mount b/omarchy-mac-boot/files/usr/lib/systemd/system/sysinit.target.wants/proc-sys-fs-binfmt_misc.mount new file mode 120000 index 00000000..7e5d7ba7 --- /dev/null +++ b/omarchy-mac-boot/files/usr/lib/systemd/system/sysinit.target.wants/proc-sys-fs-binfmt_misc.mount @@ -0,0 +1 @@ +../proc-sys-fs-binfmt_misc.mount \ No newline at end of file diff --git a/omarchy-mac-boot/test/mac-boot-install-test.sh b/omarchy-mac-boot/test/mac-boot-install-test.sh index 8ecc3e4d..a20b9457 100644 --- a/omarchy-mac-boot/test/mac-boot-install-test.sh +++ b/omarchy-mac-boot/test/mac-boot-install-test.sh @@ -33,6 +33,18 @@ for file in "$ROOT"/bin/*; do done pass "every payload file keeps its installed path, content and mode" +# A vendor .wants link pulls its unit only when it names a unit this package +# or systemd ships; a dangling one is skipped at boot without a word. +require_command systemctl +units=$(dirname "$(realpath "$(command -v systemctl)")")/../lib/systemd/system +while IFS= read -r -d '' link; do + unit=$(readlink "$link") + [[ $unit == "../${link##*/}" ]] || fail "${link#"$stage"} names its own unit: $unit" + [[ -f $stage/usr/lib/systemd/system/${link##*/} || -f $units/${link##*/} ]] || + fail "${link#"$stage"} pulls a unit that neither this package nor systemd ships" +done < <(find "$stage/usr/lib/systemd/system" -path '*.wants/*' -type l -print0) +pass "every unit this package pulls in at boot exists" + # omarchy-lifecycle-dispatch runs only root-owned entrypoints nobody else can write. for file in "$ROOT"/entrypoints/*; do staged=$stage/usr/lib/omarchy/mac-boot/${file##*/}