Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions install/config/enable-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ systemctl enable sddm.service
# whole session down. [Install] pulls in systemd-oomd.socket via Also=, which
# is what the user manager reports app.slice candidacy over.
systemctl enable systemd-oomd.service
# Mount binfmt_misc when sysinit starts. Left to its automount, the first
# binfmt registration fires it inside the opening mount burst, where systemd's
# mount rate limit holds the start back about a second, and sysinit.target
# waits with it.
systemctl enable proc-sys-fs-binfmt_misc.mount
20 changes: 20 additions & 0 deletions migrations/1791412720.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
echo "Mount binfmt_misc when sysinit starts, before the mount rate limit delays it"

# New installs get this from install/config/enable-services.sh. Existing ones
# keep waiting on the binfmt_misc automount, whose first trigger lands inside
# the opening mount burst, where the mount rate limit holds it back about a
# second past sysinit.

as_root() {
if (( EUID == 0 )); then
"$@"
else
sudo "$@"
fi
}

# Machine-wide, so a second user on the same box finds it already done.
if ! systemctl is-enabled --quiet proc-sys-fs-binfmt_misc.mount 2>/dev/null; then
as_root systemctl enable proc-sys-fs-binfmt_misc.mount >/dev/null 2>&1 ||
echo "Could not enable proc-sys-fs-binfmt_misc.mount; boot keeps waiting on its automount."
fi
20 changes: 20 additions & 0 deletions test/shell.d/systemd-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,23 @@ pass "systemd-oomd acts on sustained memory stall"
grep -Fx 'systemctl enable systemd-oomd.service' "$ROOT/install/config/enable-services.sh" >/dev/null ||
fail "new installs ship the oomd drop-ins with the daemon that reads them disabled"
pass "new installs enable systemd-oomd"

# Mount binfmt_misc when sysinit starts. Left to its automount, the first
# binfmt registration fires it inside the opening mount burst, where systemd's
# mount rate limit holds the start back about a second, and sysinit.target
# waits with it. The enable only works while systemd's unit keeps its
# [Install] section; that proves the link resolves, not the ordering or the
# timing of a live boot.
grep -Fx 'systemctl enable proc-sys-fs-binfmt_misc.mount' "$ROOT/install/config/enable-services.sh" >/dev/null ||
fail "new installs do not enable the binfmt_misc mount, so sysinit waits on its rate-limited automount"
pass "new installs enable the binfmt_misc mount for sysinit"

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"
Comment on lines +118 to +120

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.


[[ -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"
Comment on lines +122 to +125

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

pass "the enabled unit is systemd's own, pulled into sysinit.target"