Skip to content

Pin root= before the packages that can drop it - #6951

Merged
dhh merged 2 commits into
quattrofrom
fix-quattro-upgrade-cmdline-window
Oct 3, 2026
Merged

dhh merged 2 commits into
quattrofrom
fix-quattro-upgrade-cmdline-window

Conversation

@dhh

@dhh dhh commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Reproduced #6894 in a VM, upgrading a real 3.8.0 install from the ISO.

What is actually happening

limine-entry-tool falls back to /proc/cmdline for root= only while nothing appends to KERNEL_CMDLINE. Installing omarchy-settings lands omarchy-defaults.conf, which appends with += and switches that fallback off. A kernel bump in the same transaction then fires the limine hook and bakes a UKI whose cmdline is only:

initramfs_async=0 quiet splash loglevel=0 systemd.show_status=false rd.udev.log_level=0 vt.global_cursor_default=0

preserve_kernel_cmdline_root repaired that afterwards, so a completed upgrade did boot. The problem is the gap in between.

Measured

Sampling /boot/limine.conf and every UKI's embedded cmdline every 2s across the whole upgrade:

Scenario Result
Fresh 3.8.0 ISO install (/etc/default/limine already pins root=) root= never dropped, even though the kernel was bumped 7.0.3 → 7.1.8 and the UKI was rebuilt mid-upgrade. Booted fine.
Legacy install with no KERNEL_CMDLINE (pre-dates the ISO pin, root= resolved via the fallback) root= absent from the UKI for ~10 seconds, then repaired. Booted fine.
That same 10s state, booted ERROR: Failed to mount '' on real root → emergency shell

So this is not every upgrade, and not the multi-minute window it might look like — but on installs that pre-date the ISO pinning root=, there is a real interval where the machine will not boot, and anything that interrupts the upgrade there strands it exactly as reported.

The fix

Pinning cannot wait until after the packages land. The old guard could not simply be moved earlier either: it asked the tool for its effective cmdline, which still resolves root= through the fallback right up until the drop-in arrives — so it reports healthy on precisely the machines that are about to break, and would have made an early call a no-op.

So the guard now asks the config layers whether root= is stated explicitly, for the default profile alone, and the pin runs before the package transaction. Verification stays after it, since that is what rebuilds the UKIs. The pin also no longer gates on limine-mkinitcpio being installed, because it now runs before the transaction that can install it — a machine still missing it is exactly one that needs pinning first.

Verified

Same VM, same instrumentation, after the change:

  • Legacy install: 0 samples without root= across the entire upgrade, with the same 7.0.3 → 7.1.8 kernel bump. Boots.
  • Already-pinned install: correctly skipped, no duplicate pin appended, /etc/default/limine unchanged. Boots.

Reviewed with codex at xhigh; its findings on the guard (profile-specific matching, unquoted assignments, the extra config layer, root-side globbing, and the limine-mkinitcpio gate) are folded in. The ordering assertion in upgrade-to-quattro-test.sh encoded the old sequence and now asserts the new invariant in both directions.

Closes #6894

— 🤖 Claude, posting on behalf of @dhh

limine-entry-tool falls back to /proc/cmdline for root= only while nothing
appends to KERNEL_CMDLINE. Installing omarchy-settings lands a drop-in that
appends with +=, switching that fallback off, and a kernel bump in the same
transaction then bakes a UKI with no root= at all. preserve_kernel_cmdline_root
repaired that afterwards, so a completed upgrade booted — but the machine was
unbootable for the seconds in between, and an upgrade interrupted there left it
in an emergency shell.

Pinning cannot wait until after the packages land, and the old guard could not
be moved earlier as it was: it asked the tool for its effective cmdline, which
still resolves root= through the fallback right up until the drop-in arrives,
so it reported healthy on exactly the machines about to break. Ask the config
layers whether root= is stated explicitly instead, for the default profile
alone, and pin before the package transaction. Verification stays after it,
since that is what rebuilds the UKIs.

The pin no longer gates on limine-mkinitcpio being present, since it now runs
before the transaction that can install it, and a machine still missing it is
exactly one that needs pinning first.

Verified in a VM upgrading a 3.8.0 install, sampling the UKI every 2s across the
upgrade: a legacy install without the pin lost root= for ~10s, and booting that
state landed in "Failed to mount '' on real root". With this change the same
upgrade never loses it, and an install that already pins root= is untouched.

Closes #6894

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings August 15, 2026 10:46

Copilot AI left a comment

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.

Pull request overview

Pins Limine’s root= parameters before package installation to prevent transiently unbootable UKIs.

Changes:

  • Detects explicit root= configuration.
  • Moves preservation before package installation.
  • Verifies rebuilt UKIs afterward.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
bin/omarchy-upgrade-to-quattro Reorders and separates kernel command-line preservation and verification.
test/shell.d/upgrade-to-quattro-test.sh Updates ordering and guard assertions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed this against quattro. The mechanism checks out — README.md:380 of limine-entry-tool documents that += "Ignores /etc/kernel/cmdline and /proc/cmdline", so the drop-in really does switch the fallback off, and /etc/default/limine is the correct place to pin (last-loaded layer, += recommended there). Nothing before preserve_kernel_cmdline_root in the main sequence can install that drop-in, so the ordering claim in the title holds for the transaction. test/shell.d/upgrade-to-quattro-test.sh and ./test/cli both pass on a clean worker.

Three things.

1. The /boot/limine.conf gate is now evaluated too early, and nothing repairs that case afterwards. preserve_kernel_cmdline_root still returns on as_root test -f /boot/limine.conf || return 0, but that now runs before the transaction. The omarchy meta depends on limine / limine-mkinitcpio-hook / limine-snapper-sync, so on a pre-quattro install that is not already on limine — the GRUB and systemd-boot users manual/47-system-snapshots.md:19 acknowledges — that file does not exist before the transaction but does after, created either by the mkinitcpio hook on the kernel bump or by verify_kernel_cmdline_root's own limine-mkinitcpio call. The pin is skipped, the UKI is baked without root=, and verify_kernel_cmdline_root only rebuilds and warns; it never calls the pin. Under the old placement both gates passed after the transaction and this repaired itself.

Cheapest fix: call preserve_kernel_cmdline_root a second time immediately before verify_kernel_cmdline_root. It is already idempotent, so it is a no-op on every machine the first call pinned. upgrade-to-quattro-test.sh:142 would then need | head -1 on the cmdline_line lookup.

2. Two regex cases in kernel_cmdline_root_pinned, both verified against the exact expression.

^[^#]* admits a false positive, which is the dangerous direction:

OLD_KERNEL_CMDLINE[default]+="root=UUID=abc rw"   # matches -> reads as pinned

Someone who "commented out" a pin by renaming rather than prefixing # gets the real pin skipped. ^[[:space:]]*KERNEL_CMDLINE\[default\] closes it. The genuine comment case is fine — the stock /etc/limine-entry-tool.conf:53 example does not match.

And ([^\"']*[[:space:]])? cannot span an embedded quote, so the guard does not recognise its own output when a quoted parameter lands before root=:

KERNEL_CMDLINE[default]+=" dm-mod.create="foo" root=UUID=abc rw"   # does not match

boot_params is emitted in /proc/cmdline order, so this is reachable, and a re-run then appends a second pin block. Duplicated root= is usually harmless (getarg takes the last, same value) — unless the re-run happens from a snapshot or recovery boot, where the later, wrong one wins. Narrow, but it is the idempotence claim.

3. Scope, since #6894 sits in a cluster. This fixes the cmdline half only. #6876's etc/mkinitcpio.conf.d/omarchy_hooks.conf:1 is still a plain HOOKS=(...) replacement with no lvm2, and line 1233 here force-installs it with --overwrite. After this merges, an LVM-on-LUKS root gets its root=/dev/mapper/vg-root faithfully preserved onto a cmdline whose initramfs has no lvm2 hook to create that node — different error text, same dead machine. Worth saying out loud that this closes #6894 but not the cluster. (#6997 and #6976 are not boot failures at all — an autologin request and a performance regression.)

Also flagging that #6758 edits this same function in an incompatible direction: it keeps limine-entry-tool --get-cmdline default, which upgrade-to-quattro-test.sh:166 here now asserts is absent. And its central point — a bare root= does not prove an encrypted machine can boot — applies to both new helpers here, since kernel_cmdline_root_pinned and verify_kernel_cmdline_root each grep for root= alone.

…pin after the transaction

The pin check returned on any line that mentioned root= under KERNEL_CMDLINE[default]. limine-entry-tool merges its layers in order, /usr/share drop-ins, /etc/limine-entry-tool.conf, /etc drop-ins, then /etc/default/limine, where = replaces and += appends, so a later layer's = could remove a pin the check still counted, and a quote before root= let systemd.setenv="root=..." read as one. Both skip the pin, which is the direction that bricks the next boot. The check now merges the layers the same way, strips only the outer double quotes the tool strips, drops quoted values the kernel does not split, and looks for root= as a parameter of its own. It was checked against limine-entry-tool --get-cmdline on a worker for every fixture in the test.

Installing limine-mkinitcpio-hook runs limine-install, so a machine with no /boot/limine.conf when the pin runs ahead of the transaction can have one after it, and verification only warned about the UKI it found without root=. Verification now runs the pin for any machine the first call skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Sep 28, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed on a worker built from the Omarchy ISO, and pushed 2a8adba on top of your commit to fix the two defects the earlier review raised. Nothing is left for you to do; it is waiting on the maintainer.

Reproduction. The worker's limine config was put in the legacy state: the root= pin removed from /etc/default/limine, and the += drop-ins (omarchy-defaults.conf, resume.conf) moved aside so root= still resolved through the /proc/cmdline fallback. With quattro's guard, nothing was pinned, and limine-entry-tool --get-cmdline default lost root= as soon as the drop-ins landed. With this branch the pin was written before them, and root= survived.

What 2a8adba changes

  • kernel_cmdline_root_pinned counted any line that mentioned root= under KERNEL_CMDLINE[default]. limine-entry-tool merges four layers in order (/usr/share/limine-entry-tool.d, /etc/limine-entry-tool.conf, /etc/limine-entry-tool.d, /etc/default/limine), where = replaces and += appends. So a later = could remove a pin the check still counted, and systemd.setenv="root=…" read as a pin. Both skip the pin, which is the direction that leaves a machine unbootable. The check now merges the layers the same way and strips only the outer double quotes the tool strips. It also ignores anything inside a quoted value, which the kernel does not split. Every fixture in the test was compared against limine-entry-tool --get-cmdline on the worker, and they agree. The one exception is a profile-specific KERNEL_CMDLINE[default][name] pin, which the check does not count; that costs at most a duplicate pin.
  • Installing limine-mkinitcpio-hook runs limine-install. A machine with no /boot/limine.conf when the pin runs ahead of the transaction can therefore have one after it, and verification would only warn about the UKI it found without root=. verify_kernel_cmdline_root now runs the pin for any machine the first call skipped.

Tests. ./test/cli passed on the worker, and so did test/shell.d/upgrade-to-quattro-test.sh, which now exercises the pin check against fixture config layers and the re-pin behaviourally. Reverting each part of the fix fails the test.

Second opinion. Codex at medium effort reviewed four rounds. It found the superseded-assignment case, the missing /usr/share layer and the quoted-value cases; its last round on this head found nothing left to act on.

Still open elsewhere. This fixes the root= half of #6894 only. #6876, an LVM-on-LUKS root without the lvm2 hook, is unchanged. #6758 edits this same function in a direction that conflicts with it. #12548 is a migration for machines already on quattro that were never pinned, so it complements this change rather than competing with it.

@omarchybot omarchybot added ready Good to merge and removed ready Good to merge labels Sep 28, 2026
@dhh
dhh merged commit 393a43d into quattro Oct 3, 2026
buger added a commit to probelabs/omarchy that referenced this pull request Oct 3, 2026
One upstream commit (omacom#6951) changes bin/omarchy-upgrade-to-quattro and its
test, both outside the verification scope; no menu or lock file changed.
Research note review/upstream-393a43d4-research-delta.md; upstream_refresh_v1
steps 1-13 confirmed, coverage and the campaign stamp follow the audit.
omarchybot added a commit to gcarre/omarchy that referenced this pull request Oct 3, 2026
omacom#6951 moved the root= pin ahead of the package transaction and replaced the limine-entry-tool guard with kernel_cmdline_root_pinned, which touched the lines this branch adds beside. Both sides are kept: normalize_encrypt_hook_param sits before kernel_cmdline_root_pinned, and the PR's conversion tests sit before omacom#6951's pin tests. The PR's test for the old --get-cmdline guard is dropped, since omacom#6951 removed that guard and asserts it stays gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
pir-ahsan-raza pushed a commit to pir-ahsan-raza/omarchy-test that referenced this pull request Oct 29, 2026
pir-ahsan-raza pushed a commit to pir-ahsan-raza/omarchy-test that referenced this pull request Oct 29, 2026
pir-ahsan-raza pushed a commit to pir-ahsan-raza/omarchy-test that referenced this pull request Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System does not boot after upgrade to quattro

4 participants