Repository navigation
Mount /boot/efi and /boot from the ESP the Mac booted - #229
allanclempe wants to merge 1 commit into
Conversation
|
Tested on a MacBook Pro 14" M5 Pro (J714s): one Omarchy install, encrypted root, our J714s build of kernel 7.3.0 (v272-18). I ran the generator from this PR's head (
Not tested here: two installs or a leftover ESP on this disk (it has one install now), and a boot with the generator installed. 🤖 Generated with Claude Code |
Every image mounts the ESP and /boot by IDs every image shares, so with a second install or a leftover attempt on the disk, fstab can mount the other install's partitions (omacom#219). The image now carries a systemd generator that mounts /boot/efi from the ESP the Stage 2 names in the device tree, and /boot from the partition after it when that is the image's Boot filesystem. When it can't tell, fstab stays in charge. mac-image-check requires it.
8f547a3 to
09bfb52
Compare
|
[Allan's agent] @TripleU613 Thanks for running it on the J714s. A second Apple silicon generation choosing the right ESP and Boot partition from the device tree is the main thing this needed. Rebased onto Still untested, as you noted: a disk with two installs or a leftover ESP, and a full boot with this exact generator installed. The M4 Max (J616c) boots with an earlier revision of it from its own image, which mounts |
[Medium impact] The PR appears safe to merge, with no actionable issues found. SummaryThe PR installs
No actionable issues were found. Tests were inspected but not run during this review.
|
Fixes #219, using the issue's second fix, as @TripleU613 suggested there.
What breaks
Every image mounts the ESP by
UUID=4F4D-5801and/bootby4f4d5801-424f-4f54-8000-000000000001. With a second install on the disk, or the partitions of an earlier install attempt, fstab can mount the other install's ESP or Boot partition, and kernel and boot updates are written where this Mac never reads them. #219 has both cases: two installs on a J714s, and a leftover attempt on a J616c.The fix
image-builder/builder/omarchy-esp-generatoris a systemd generator.build-mac-imageinstalls it at/usr/local/lib/systemd/system-generators/. It writes into the early generator directory, so its units replace the onessystemd-fstab-generatormakes from fstab:boot-efi.mountfor the PARTUUID in/proc/device-tree/chosen/asahi,efi-system-partition, the ESP the Mac booted from (asomarchy-mac-espreads it).boot.mountfor the partition that starts next after that ESP on the same disk, by start sector from sysfs, and only when its ext4 superblock carries the image's Boot UUID.When it can't tell, it writes nothing for that mount and fstab stays in charge: no property, a value that isn't one PARTUUID, the ESP's PARTUUID on two partitions, or no matching Boot partition. It logs why to the kernel log. fstab is unchanged, so
check_fstaband a plainmount /bootbehave as before.mac-image-checknow requires the generator in the image, mode 0755, byte for byte the builder's copy.Tested
image-builder/test/omarchy-esp-generator-test.sh(new, picked up bytest/all) models the J616c disk from Every image gives /boot and the ESP the same filesystem IDs; with two installs on one disk, fstab can mount the other install's partitions #219, leftovers included. It checks that both units match whatsystemd-fstab-generatormakes from the image's fstab lines and passsystemd-analyze verify. It also checks the fallbacks: another ext4 UUID, no ext4 magic, an unreadable device, no partition after the ESP, a reused slot number, a duplicated ESP PARTUUID and malformed properties.test_mac_image_check.py: 4 new tests for the image check. The test file passes (61 tests).mac-image-inputs-test.shand the Python tests pass.build-mac-image-test.shstops on this host with "hyprland-0.52.0-1-aarch64 does not have a valid architecture", and does the same on unmodifiedmain./boot/efiand/bootcame from the right partitions, both mounted from/run/systemd/generator.early/. With a leftover ESP still on the disk, it picked the booted one.build-mac-image(that needs an aarch64 host with Docker), other models, an unencrypted root, and M1 to M3 Stage 2s whose property isn't a PARTUUID. In that last case it writes nothing and fstab applies.@TripleU613, you offered to try it on the J714s with two installs. That's the case this most needs.