Skip to content

Rebuild a prebuilt image's boot image for the machine that boots it - #18756

Open
kill74 wants to merge 5 commits into
omacom:quattrofrom
kill74:fix/prebuilt-image-boot-image
Open

kill74 wants to merge 5 commits into
omacom:quattrofrom
kill74:fix/prebuilt-image-boot-image

Conversation

@kill74

@kill74 kill74 commented Nov 13, 2026

Copy link
Copy Markdown

Fixes #18080.

A prebuilt image is built away from the machine it runs on, so the boot image it carries describes the machine that built it: mkinitcpio's autodetect runs there, so the initramfs holds that machine's modules and none of the target's. On the reported machine that meant virtio-gpu and neither amdgpu nor i915, so amdgpu loaded only in the real root, after SDDM had already started Hyprland. Hyprland then picked the iGPU with no monitor attached as primary and blitted every frame to the AMD card, which failed with EGL_BAD_ALLOC and the page-flip errors in the log.

The machine's first boot now rebuilds the boot image for the hardware it runs on, with the same limine-mkinitcpio (mkinitcpio with autodetect) that fixes it by hand. It happens where the deferred hardware setup already runs, before the login screen, so the display driver is up before the session starts. A step that changed what the boot image is built from, or asked for the rebuild, still gets one rebuild, and the two share it.

A machine that booted a prebuilt image before this change still carries the builder's boot image; a migration rebuilds it once.

Tradeoff: the first boot of an image waits for that rebuild before the login screen appears, and mkinitcpio takes about a minute on a real machine. The initramfs that first boot runs from is still the builder's, so the module fix lands in the next boot's initramfs.

@greptile-apps

greptile-apps Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The changes appear safe to merge; no new blocking issue was found.

Summary

Prebuilt images now rebuild their boot image for the machine that boots them, with a one-time repair for machines that booted older images.

  • Prebuilt images rebuild their boot image for the machine that boots them.
  • Migrations rebuild boot images on older prebuilt-image installs.

No new actionable issues found. The earlier rebuild and interruption findings are addressed.

Reviews (7) · Last reviewed commit: "Confirm Limine installed boot images bef..." · Reviewed by Greptile

Comment thread bin/omarchy-provision-hardware Resolved
Comment thread shell/plugins/dock/Dock.qml Resolved
Comment thread bin/omarchy-provision-hardware Resolved
@omarchybot omarchybot added the bug Something isn't working label Nov 17, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 479c315. The boot-image fix does what it says. The branch also carries two other changes that need to come out before this can land.

What was checked, on a disposable Omarchy worker

What needs the author: split the branch

Besides the boot-image work, this branch carries the dock change from #17339 (shell/plugins/dock/Dock.qml, test/shell.d/dock-test.sh) and the T480 TrackPoint fix from #18057 (install/hardware/lenovo/fix-thinkpad-t480-trackpoint.sh, install/hardware/all.sh, migrations/1794067040.sh, test/shell.d/hardware-quirks-test.sh), plus follow-up commits to both: 83e3ff5 fixes the dock's refresh() and c3fc685 has the T480 migration run its leaf. Those follow-ups are not in #17339 or #18057. #17339's head still pushes into an ids list it never declares, so its refresh() still throws. The change #18080 needs is bin/omarchy-provision-hardware, install/helpers/image-target.sh, migrations/1794576032.sh, the docs/file-layout.md paragraph and the image test additions. Rebuilding this branch from quattro with only those commits, and moving 83e3ff5 to #17339 and c3fc685 to #18057, would leave three pull requests that can each be merged on their own. As it stands, landing either sibling first makes this one conflict.

What needs the maintainer: what a failed rebuild should do

When the rebuild fails, this keeps the service armed, so the rebuild runs again before the login screen on every boot until one succeeds. #14872, which is older and still open, changes the same failure handling in the same files the other way: it finishes with a warning and leaves the repair to owner setup. The two conflict, and choosing between them is the maintainer's call.

Second opinion

Codex Medium and muse-wonder via pi (thinking high) reviewed the same head. Both independently raised the split and the overlap with #14872 (independence is not guaranteed, since they can read this session). Their other findings, checked against the source:

  • Codex: limine-mkinitcpio can fail to copy the UKI onto the boot partition and still exit 0, which would record the rebuild as done. That holds for limine-mkinitcpio-hook 1.40. The 1.41 the current ISO ships exits 1 when an install fails, so the exit-status check here catches it. Nothing to change.
  • muse-wonder: the migration should check the platform before rebuilding. Not changed: a Mac's setup-boot image-first-boot asks for this same generic rebuild (docs/lifecycle-dispatch.md), and the migration runs the commands the first boot already uses.
  • muse-wonder, noted and not blocking: the migration gives an image machine whose first boot already rebuilt (because a step changed an input) one extra rebuild. reboot-required is set only for the user who runs the migration first. The "request alone" test no longer tells the request apart from the now-unconditional rebuild.

Nothing was pushed to the branch. It is waiting on the author for the split and on the maintainer for the failure policy.

A prebuilt image is built away from the machine it runs on, so the boot
image it carries describes the machine that built it: mkinitcpio's
autodetect ran there, so the initramfs holds that machine's modules and
none of the target's. A display on a discrete GPU then has no driver
before the session starts, and the session picks the wrong card.

The machine's first boot now rebuilds the boot image for the hardware it
runs on, next to the rebuild a step's changed configuration already
asked for. A machine that booted an image before this rebuild existed
still carries the builder's, and a migration rebuilds it.

(cherry picked from commit bdbdf68)
limine-mkinitcpio reports a kernel it could not rebuild and still exits 0,
so a run that trusted the exit status recorded a boot image that was never
built: the machine kept the boot image it had, and the marker told the
migration that the machine's boot image was its own, so the repair was
skipped.

The first boot and the migration now read the rebuild's output as well as
its exit status. A rebuild that failed leaves the machine with the boot
image it had, and the rebuild owed.

(cherry picked from commit a1da1f7)
The rebuild request was written after the image's manifest was retired, so a
first boot that stopped between the two lost the request. The next run found
no manifest, no changed input and no request, skipped the rebuild and
disabled the service, leaving the builder's boot image and its missing
drivers in place.

Write the request before the manifest is retired, and owe the rebuild to
every machine that booted an image until one lands.

(cherry picked from commit e3a123c)
The migration called limine-mkinitcpio outright, but the hook that provides
it is not in the default package set. On a machine without it the migration
failed and stopped the update with an error the user could not act on.

Use the same rebuild the first boot makes: Limine's where the machine has
it, mkinitcpio's presets where it does not.

(cherry picked from commit 73c63f6)
@kill74
kill74 force-pushed the fix/prebuilt-image-boot-image branch from 479c315 to 8896a50 Compare November 17, 2026 18:18
@greptile-apps

greptile-apps Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@kill74

kill74 commented Nov 17, 2026

Copy link
Copy Markdown
Author

@greptile review

limine-entry-tool can report an installation error and still exit successfully, including with limine-mkinitcpio-hook 1.41.0. Use Scott Jones's confirmation predicate from omacom#14872 in both deferred hardware setup and its repair migration, so failed installations, incomplete builds and empty runs cannot write the completion marker. Keep the existing retry behavior; the owner-setup handoff in omacom#14872 remains a separate maintainer decision.

Co-Authored-By: Scott Jones <scottajones@gmail.com>
Co-Authored-By: Codex High <noreply@openai.com>
Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
Co-Authored-By: muse-wonder via pi, thinking high <noreply@openrouter.ai>
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed cbc5f28f1e81fa04a1530d2d8aa8e4ab831fdadf. The unrelated dock and TrackPoint changes are gone. The branch now contains only the boot-image fix.

Pushed cbc5f28f1 to prevent a failed rebuild from being recorded as complete, in both first-boot hardware setup and the migration. Limine's entry tool can print an error and exit 0 even with limine-mkinitcpio-hook 1.41: the installed tool on the worker did that for a missing UKI file. The shared confirmation predicate comes from Scott Jones's #14872, with credit in the commit. It checks that every started image completed and no entry-tool error occurred. This retains this branch's retry behavior; #14872's owner-setup handoff remains a maintainer decision.

On disposable Omarchy workers:

  • My missing-rebuild reproduction failed on the base, passed with the fix, and failed again with it removed.
  • ./test/cli passed 136 checks. The four focused test files passed 100 checks: image-deferred-hardware, image-target-platform, platform-setup and migrate-scope.
  • The new regression failed on the original PR source when a copy error incorrectly cleared the pending rebuild. The corrected source keeps it pending. A separate migration probe likewise showed the original recording completion after an entry-tool error and the corrected version refusing it.
  • The corrected migration rebuilt a real UKI, wrote the root-owned completion marker and reboot flag, skipped a machine without image history, and left the UKI and marker unchanged on a second run.

Codex High reviewed and tested the change. Opus 5.5 High and muse-wonder via pi (thinking high) identified the completion-check defect and reviewed its correction; their final round found no further actionable code defects. Their agreement is not guaranteed independent of this session.

The workers have no AMD/Intel GPU pair, so these checks establish the rebuild path, not the display result in #18080. @bitta-boo, please test the full commit cbc5f28f1e81fa04a1530d2d8aa8e4ab831fdadf on an affected image install. It needs /var/lib/omarchy/image/target.booted present and boot-image-rebuilt absent; otherwise this migration intentionally skips it. To run this revision's migration:

git clone --no-checkout https://github.com/omacom/omarchy.git ~/omarchy-pr-18756
cd ~/omarchy-pr-18756
git fetch origin pull/18756/head
git checkout --detach cbc5f28f1e81fa04a1530d2d8aa8e4ab831fdadf
OMARCHY_PATH="$PWD" PATH="$PWD/bin:$PATH" bash -euo pipefail migrations/1794576032.sh

After a successful rebuild, reboot and report whether amdgpu/i915 initialize before SDDM and whether the black screen and cursor problem are gone, naming the full commit in the reply. This waits on that hardware confirmation; verified and ready are withheld.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4.5 pre-built UKI ships without amdgpu/i915 → long black screen + black-square cursor after login on dGPU systems

2 participants