Skip to content

Install UEFI machines with systemd-boot - #489

Merged
omarchybot merged 16 commits into
quattrofrom
systemd-boot
Nov 25, 2026
Merged

omarchybot merged 16 commits into
quattrofrom
systemd-boot

Conversation

@omarchybot

@omarchybot omarchybot commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

UEFI installs now boot systemd-boot, the boot loader Secure Boot needs. BIOS installs keep Limine, because systemd-boot can't start on BIOS firmware. This builds on omacom/omarchy#19667 (omarchy-boot-switch install, factory reset of such an install) and omacom/omarchy-pkgs#3202 (omarchy-boot-systemd).

How an install boots

The root image is unchanged: it still carries Limine's stack (omarchy-boot on x86_64, Limine's packages by name on aarch64). On UEFI the installer:

  1. Swaps that stack for omarchy-boot-systemd from the offline mirror while the deferred boot hooks are masked. It runs pacman --root … --ask=4 so pacman removes the conflicting packages, then removes limine itself.
  2. Copies systemd-boot to EFI/systemd/ and registers an "Omarchy Boot" entry first in BootOrder, with BootNext. This is the same registration code Limine uses, with the label passed in. A removable install writes only EFI/BOOT/BOOT*.EFI.
  3. Writes the command line to /etc/kernel/cmdline after the usual normalisation (rd.luks.*, console). The aarch64 console parameters go to /etc/cmdline.d/. Nothing is written to /etc/default/limine or limine.conf.
  4. Once every boot drop-in exists, runs omarchy-boot-switch install --no-efi-register in the target. It is called with --no-fallback on a shared ESP the install doesn't own, and --prefer for a selected kernel. It builds and verifies the boot images exactly as a factory reset of this install will.

validate_boot checks:

  • systemd-boot and loader.conf are on the ESP;
  • there is a boot image for the installed kernel, and its embedded command line has root= (and cryptdevice= when encrypted);
  • an N1x's boot images carry its console parameters;
  • the boot store has its fstab line;
  • the firmware has a route to the loader: an NVRAM entry, or the fallback path where the ESP is ours.

An encrypted deferred-provisioning install's unlock goes in /etc/cmdline.d/99-omarchy-provisioning-unlock.conf, which the factory snapshot scrubs.

OMARCHY_ISO_BOOT_LOADER=limine keeps a UEFI install on Limine. So does an ISO whose mirror has no omarchy-boot-systemd.

The pre-built UKI is Limine's fast path and isn't used on systemd-boot. The boot images carry Omarchy's snapshot and restore hooks, so they are built on the machine.

Building the ISO

  • --local-source also builds omarchy-boot and omarchy-boot-systemd (aarch64: only the latter) from a pkgs checkout that has them.
  • omarchy-boot-systemd conflicts with the image's stack, so it is resolved in a transaction of its own. It is kept in the mirror and shipped, along with what it adds to the image (systemd-ukify).

Tested

An ISO built with --local-source from both branches, run through test/integration:

  • UEFI + LUKS, firmware-boot. systemd-boot on the ESP, "Omarchy Boot" first in BootOrder, systemd-boot started the boot, and the boot store is mounted with the switch active.
  • UEFI + LUKS, hibernate. Hibernate and resume work.
  • UEFI + LUKS, full-nvram. The firmware refuses the entry, and the install boots from the fallback loader.
  • UEFI + LUKS, factory-reset, now with a systemd-boot branch. Windows' payload and other systems' UKIs survive, and the old owner's boot images are gone. First-boot provisioning completes with a new machine identity that owns fresh boot images and a fresh boot store, and systemd-boot starts it.
    • The first run found two bugs in the reset, both fixed in omarchy#19667: a bind mount that propagated through the shared /run and pinned the next root, and an active recreated swapfile.
    • This run used the fixed reset scripts copied into the installed system rather than a rebuilt ISO.
  • BIOS, firmware-boot. Limine's BIOS stage and MBR boot code, as before.
  • ./test/all. The Python tests (470) and every shell unit test pass, apart from nightly-test.sh, which fails the same way on quattro. There's a new test_systemd_boot_install.py.

Not tested: aarch64 installs on hardware (Snapdragon, N1x, GB10). They take the same path with the aa64 loader, but none has been booted.

Screenshots

From an encrypted UEFI install of an ISO built from these branches:

A fresh install boots systemd-boot: switch active, Omarchy Boot first in BootOrder
systemd-boot's menu on a fresh install, shown by holding Space
First-boot setup after a factory reset of the systemd-boot install

Codex review (xhigh)

A Codex review found that an unencrypted install into free space mounts its ESP at /efi, where omarchy-boot-switch install didn't look. The installer now passes the ESP it mounted, and the runtime finds /efi on its own after that (omarchy#19667).

🤖 Generated with Claude Code

dhh and others added 3 commits November 21, 2026 16:15
The image keeps Limine's stack, which BIOS installs boot with. A UEFI
install swaps it for omarchy-boot-systemd, puts systemd-boot on the ESP
with an "Omarchy Boot" entry first in the boot order, writes the
command line to /etc/kernel/cmdline and /etc/cmdline.d, and has
omarchy-boot-switch install build and verify the boot images once every
boot drop-in is written, the way a factory reset of this install will.
validate_boot checks the loader, its config, a boot image carrying the
install's command line, the boot store's fstab line and a route to the
loader; an encrypted provisioning install's unlock rides in the
command line drop-in.

The ISO builds omarchy-boot and omarchy-boot-systemd from a pkgs
checkout that has them, keeps omarchy-boot-systemd in the mirror next to
the Limine stack it conflicts with, and ships it. An ISO without it, or
OMARCHY_ISO_BOOT_LOADER=limine, installs Limine as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CY6YBjgjqqbJnZaM3wihLS
aarch64 images carry Limine's packages by name rather than through
omarchy-boot, so only omarchy-boot-systemd is built and swapped in there.
An N1x's boot images are checked for the console parameters its Limine
entries had to carry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CY6YBjgjqqbJnZaM3wihLS
@greptile-apps

greptile-apps Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Confidence Score: 0/5 · Changes are needed before merging: replace loader files safely, fix the older-rehearsal failure, and update the rehearsal documentation.RetriggerView in GreptileConfidence Score: 0/5 Tier: plus

[High impact] The PR changes the boot path for eligible new UEFI installations.

Changes are needed before merging: replace loader files safely, fix the older-rehearsal failure, and update the rehearsal documentation.

Findings

  1. P0 Existing boot loader overwritten ▶
  2. P1 Rehearsal package sources misdescribed ▶
  3. P1 Older rehearsals fail during installation ▶
Fix with agent prompt
### Issue 1
configs/airootfs/usr/share/omarchy-iso/orchestrator/phases_impl.py:1836
On a protected install that reuses an ESP with systemd-boot, `_copy_required` overwrites the existing loader through `shutil.copy2`. A failed or interrupted copy can leave another installed system's loader incomplete.

The boot-safety rule requires staging boot binaries, checking them, and publishing with a same-filesystem atomic rename. Use that approach here and for the removable loader copy at line 1834.

### Issue 2
bin/omarchy-iso-make:181
`--rehearsal` now also builds `omarchy-boot-systemd` from the supplied checkout when its recipe exists. But `README.md:519` still says every package besides `omarchy` and `omarchy-settings` comes from edge as published. Maintainers are therefore told they are testing a published boot package when they are testing a local build.

The documentation rule requires updates in the same PR when documented operator behavior changes. Update the rehearsal section to include the local boot package.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

### Issue 3
bin/omarchy-iso-make:180-182
If the Omarchy checkout lacks `omarchy-boot-switch`, the rehearsal still adds `omarchy-boot-systemd` whenever its recipe exists. The local-package branch in `build-iso.sh` runs before the missing-command check, so the package ships anyway. The installer then selects systemd-boot and stops when it calls the missing command, after preparing the target disk.

Check for `omarchy-boot-switch` before adding the local swap package, and exclude that package from the mirror otherwise.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

UEFI installs use systemd-boot when the ISO bundles its stack. BIOS, Intel Macs, and explicit Limine overrides keep Limine.

  • Eligible UEFI installs boot with systemd-boot, while BIOS installs keep Limine.
  • ISO builds can ship the systemd-boot package and its offline dependencies.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Root image with Limine] --> B{Choose boot loader}
  B -->|BIOS, Intel Mac, override, or missing package| C[Configure Limine]
  B -->|Supported UEFI install| D[Install systemd-boot stack]
  D --> E[Copy EFI loader and register boot entry]
  E --> F[Write kernel command line and drop-ins]
  F --> G[Run target system setup]
  G --> H[Run omarchy-boot-switch install]
  H --> I[Build and check boot images]
  C --> J[Validate boot setup]
  I --> J
  J --> K[Create scrubbed factory snapshot]
Loading

Reviews (9) · Last reviewed commit: "Merge quattro into the systemd-boot bran..." · Reviewed by Greptile

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Install test passed

x86_64 vs quattro aarch64 vs quattro
Result ✅ passed ✅ passed
Build the ISO 90.0 s −72.0 s 170.0 s +5.0 s
Install 18.9 s −18.1 s 18.3 s −0.2 s
First boot 6.1 s −5.4 s 4.8 s −0.0 s
Everyday boot 6.0 s −2.5 s 4.7 s −0.0 s

Boots are loader, kernel and userspace, without the VM's firmware.

Install phases, x86_64
Phase This PR quattro
Preparing live environment 1.3 s 1.3 s
Preparing install target 7.4 s 8.8 s
Installing Arch + Omarchy 8.2 s 24.2 s
Configuring system 0.5 s 0.9 s
Staging provisioning 0 s 0 s
Finalizing boot and user 0.9 s 1 s
Configuring login 0 s 0 s
Configuring SSH access 0.4 s 0.5 s
Configuring Tailscale 0 s 0 s
Configuring DNS resolver 0 s 0 s
Validating boot setup 0 s 0 s
Creating factory snapshot 0.1 s 0.1 s
Install phases, aarch64
Phase This PR quattro
Preparing live environment 1.3 s 0.7 s
Preparing install target 5.1 s 5.6 s
Installing Arch + Omarchy 10 s 9.5 s
Configuring system 0.6 s 1 s
Staging provisioning 0 s 0 s
Finalizing boot and user 0.8 s 1.2 s
Configuring login 0 s 0 s
Configuring SSH access 0.3 s 0.3 s
Configuring Tailscale 0 s 0 s
Configuring DNS resolver 0 s 0 s
Validating boot setup 0.1 s 0.1 s
Creating factory snapshot 0.1 s 0.1 s

Run · 80c7301

dhh and others added 2 commits November 21, 2026 17:53
From a Codex review: an unencrypted install into free space mounts its
ESP at /efi, where omarchy-boot-switch install did not look.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CY6YBjgjqqbJnZaM3wihLS
From Greptile's review: a boot image whose command line cannot be read
was skipped, so a damaged one could pass next to a good one; it now
fails validation. The firmware scenario checks the loader the install
actually got, so an install that stayed on Limine (no
omarchy-boot-systemd on the ISO, or OMARCHY_ISO_BOOT_LOADER=limine)
still passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@emirb

emirb commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@dhh can we theme this like GRUB?

dhh and others added 10 commits November 25, 2026 13:24
On an encrypted install the boot stops at the disk passphrase, which the
desktop scenario never typed, so it timed out waiting for SSH. It waits
with wait_for_ssh, which types it, as every other scenario's boot does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
phases_impl.py conflicted where quattro's stale-entry pruning (replaced_guids)
met the branch's labelled boot entries, where finalize_boot_and_user now
buffers the user finalizer's log, and where validate_boot now joins the
deferred LUKS keyslot. replaced_guids now reaches the systemd-boot loader too,
and pruning also takes a wiped disk's dead "Omarchy Boot" entries; systemd-boot
gets the complete /etc/kernel/cmdline value, since quattro may leave the
console parameter to a Limine drop-in systemd-boot never reads; the deferred
keyslot join moved into the shared validate_boot tail; and
finalize_systemd_boot disables btrfs quotas from the host as Limine now does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI builds the ISO from published edge packages, which don't carry the
systemd-boot stack yet, so its installs use Limine and their Omarchy has no
omarchy-boot-backend. The factory-reset and firmware-boot scenarios called
it directly and died on the missing command before checking anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omarchy-boot-switch refuses to move an Intel Mac (an Apple DMI vendor, or
linux-t2 installed) to systemd-boot: their firmware needs testing with it
first. The installer gave them systemd-boot anyway on every UEFI install.
_boot_loader now keeps them on Limine the same way: Apple hardware, or
linux-t2 among the selected kernels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omarchy-boot-systemd's pacman hooks rebuild the boot images into the boot
store, and fail when it isn't mounted while pacman still exits 0.
omarchy-boot-switch install unmounts the store at the end of
finalize_systemd_boot, so an OEM script that installed firmware, a kernel
or a DKMS module left the machine with boot images that lack it. On
systemd-boot each OEM script now runs in a mount namespace of its own with
the store mounted from the target's fstab.

During system setup the store does not exist yet, so the stack's
60-mkinitcpio-remove.hook (n1x.sh drops the stock kernels) could only fail;
it is deferred with 90-mkinitcpio-install.hook there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- validate_boot accepted a missing systemd-boot when EFI/BOOT/BOOT*.EFI
  was there, which on a shared ESP can be another system's loader. The
  "Omarchy Boot" entry starts EFI/systemd's copy, and omarchy-boot-switch
  install always writes it, so that copy is what it requires now.
- A boot image whose file ends inside its .cmdline read back as the part
  before the cut, which can name the root while missing what follows. It
  reads as no cmdline now, as embed_cmdline already treats it.
- finalize_systemd_boot and the checks after it took the ESP from
  omarchy_install.boot alone, where Limine follows the mount the installer
  actually used (ESP_PATH). They follow it too now.
- A Limine install pruned stale "Limine" entries of the disk it wiped but
  not an earlier systemd-boot install's "Omarchy Boot" ones. Both go now,
  whichever loader is installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A build from an Omarchy checkout without omarchy-boot-switch shipped the
  channel's omarchy-boot-systemd all the same, and the install failed after
  wiping the disk when it came to run it. Such a build keeps Limine.
- pacman's resolution of the channel's omarchy-boot-systemd ran in a
  process substitution whose failure the build never saw. It stops now.
- A local omarchy-boot-systemd shipped with systemd-ukify, named by hand;
  it ships with every dependency its .PKGINFO names now.
- A release rehearsal built omarchy and omarchy-settings from the pinned
  checkout and took omarchy-boot-systemd, released in lockstep with them,
  from edge. It builds it too where the pkgs checkout has it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI's ISOs boot Limine only because no channel offers omarchy-boot-systemd
yet. Once one does, every UEFI install is on systemd-boot, and these
scripts still read Limine's files: arm64-install looked for omarchy_*.efi,
vm-seal copied omarchy_<kernel>.efi and edited limine.conf, vm-verify
rebuilt with limine-mkinitcpio and read limine.conf, and upgrade-test
counted limine.conf's groups. Each asks omarchy-boot-backend now (Limine
where it's missing) and checks systemd-boot's own: the machine's boot
images, the default loader.conf names, and omarchy-boot-rebuild and
omarchy-boot-sync verify on a clone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The desktop scenario polled wait_for_ssh, itself a wait of BOOT_TIMEOUT,
through wait_for_guest_state, which hid what it said and, with the VM
gone, called it again every second for the whole timeout. It is called
once, with its own ok or not ok.

The factory reset's fresh-store check passed when btrfs could not show
/var/lib/omarchy/boot at all: an empty UUID differs from the old one.
It wants a UUID now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread bin/omarchy-iso-make
Comment on lines +180 to +182
rehearsal_packages="omarchy-settings omarchy"
[[ ! -d $LOCAL_PKGS_PATH/pkgbuilds/omarchy-boot-systemd ]] || rehearsal_packages+=" omarchy-boot-systemd"
: "${OMARCHY_LOCAL_PACKAGES:=$rehearsal_packages}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Older rehearsals fail during installation

If the Omarchy checkout lacks omarchy-boot-switch, the rehearsal still adds omarchy-boot-systemd whenever its recipe exists. The local-package branch in build-iso.sh runs before the missing-command check, so the package ships anyway. The installer then selects systemd-boot and stops when it calls the missing command, after preparing the target disk.

Check for omarchy-boot-switch before adding the local swap package, and exclude that package from the mirror otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	configs/airootfs/usr/share/omarchy-iso/orchestrator/phases_impl.py
@omarchybot
omarchybot merged commit ad57b15 into quattro Nov 25, 2026
22 checks passed
emirb added a commit that referenced this pull request Nov 26, 2026
Brings in the hardware layers (#530), the library read before the first
pacman transaction (#531), systemd-boot installs (#489, #529) and the
setup form's XKB layouts (#528).

Two conflicts. In builder/build-root-image.sh both steps stay: the
hardware layers first, which write into the image tree, then the Try
layer against the finished image. In phases_impl.py the hardware layer
paths join the squashfs ROOT_IMAGE and its mount paths.
xdanger pushed a commit to xdanger/omarchy-iso that referenced this pull request Nov 26, 2026
The nightly fails on every x86 channel since ad57b15 (omacom#489), the stable
release ISO included:

  cat: /etc/machine-id: No such file or directory

vm-seal passed its main guest script to root() as one single-quoted
string. omacom#489 added a comment in it with an apostrophe ("a clone's").
That apostrophe ended the string on the runner. The runner then ran the
rest of the script itself, and the test container has no machine ID.
bash -n accepts the result, because the broken quoting still parses.

A quoted here-document ends only at its delimiter line, so no quote in
the script can end it. The guest runs the same commands as before.
if removable:
_copy_required(source, ctx.target / esp_mount.lstrip("/") / "EFI" / "BOOT" / f"BOOT{_efi_arch_suffix()}.EFI")
return
_copy_required(source, ctx.target / esp_mount.lstrip("/") / "EFI" / "systemd" / f"systemd-boot{arch_name}.efi")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 Existing boot loader overwritten

On a protected install that reuses an ESP with systemd-boot, _copy_required overwrites the existing loader through shutil.copy2. A failed or interrupted copy can leave another installed system's loader incomplete.

The boot-safety rule requires staging boot binaries, checking them, and publishing with a same-filesystem atomic rename. Use that approach here and for the removable loader copy at line 1834.

Rule Used: Never modify a published discoverable boot binary (such as EFI/Linux/*.efi on a live or target ESP) in place: write to a non-discoverable staging path, finish all mutations and PE/size checks, publish with a same-filesystem atomic rename (os.replace ... (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: configs/airootfs/usr/share/omarchy-iso/orchestrator/phases_impl.py
Line: 1836

Comment:
**Existing boot loader overwritten**

On a protected install that reuses an ESP with systemd-boot, `_copy_required` overwrites the existing loader through `shutil.copy2`. A failed or interrupted copy can leave another installed system's loader incomplete.

The boot-safety rule requires staging boot binaries, checking them, and publishing with a same-filesystem atomic rename. Use that approach here and for the removable loader copy at line 1834.

**Rule Used:** Never modify a published discoverable boot binary (such as EFI/Linux/*.efi on a live or target ESP) in place: write to a non-discoverable staging path, finish all mutations and PE/size checks, publish with a same-filesystem atomic rename (os.replace ... ([source](https://github.com/omacom/omarchy-iso/blob/667d29757d62f84d1db10ae61e4b94cc8464813f/.greptile/config.json))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment thread bin/omarchy-iso-make
# omarchy-boot-systemd is released in lockstep with them, where the pkgs
# checkout has it.
rehearsal_packages="omarchy-settings omarchy"
[[ ! -d $LOCAL_PKGS_PATH/pkgbuilds/omarchy-boot-systemd ]] || rehearsal_packages+=" omarchy-boot-systemd"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Rehearsal package sources misdescribed

--rehearsal now also builds omarchy-boot-systemd from the supplied checkout when its recipe exists. But README.md:519 still says every package besides omarchy and omarchy-settings comes from edge as published. Maintainers are therefore told they are testing a published boot package when they are testing a local build.

The documentation rule requires updates in the same PR when documented operator behavior changes. Update the rehearsal section to include the local boot package.

Rule Used: When a PR changes user-visible or operator-visible behavior documented in README.md, docs//*.md, builder/qualcomm/README.md, or test/fake-pci.md, update the doc in the same PR. When README.md or a file under docs//*.md is added, moved, or removed... (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: bin/omarchy-iso-make
Line: 181

Comment:
**Rehearsal package sources misdescribed**

`--rehearsal` now also builds `omarchy-boot-systemd` from the supplied checkout when its recipe exists. But `README.md:519` still says every package besides `omarchy` and `omarchy-settings` comes from edge as published. Maintainers are therefore told they are testing a published boot package when they are testing a local build.

The documentation rule requires updates in the same PR when documented operator behavior changes. Update the rehearsal section to include the local boot package.

**Rule Used:** When a PR changes user-visible or operator-visible behavior documented in README.md, docs/**/*.md, builder/qualcomm/README.md, or test/fake-pci.md, update the doc in the same PR. When README.md or a file under docs/**/*.md is added, moved, or removed... ([source](https://github.com/omacom/omarchy-iso/blob/667d29757d62f84d1db10ae61e4b94cc8464813f/.greptile/config.json))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants