Repository navigation
Append the Surface keyboard modules instead of resetting MODULES - #14541
omarchybot wants to merge 1 commit into
Conversation
surface_device_modules.conf sorts after nvidia.conf in mkinitcpio's drop-in order, so writing MODULES=(...) dropped nvidia, nvidia_modeset, nvidia_uvm and nvidia_drm from the initramfs on every Surface with an NVIDIA GPU, along with any module an earlier drop-in or the main config listed. A migration repairs the file on existing installs and rebuilds the initramfs once per machine. It matches only the file the installer wrote, whole, so a hand-written drop-in that resets MODULES on purpose is left alone. It rebuilds whether or not nvidia.conf is present, since the reset also dropped modules from other sources; fresh installs mark every migration complete, so only machines that had the old file rebuild. Fixes #7111 Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
| [[ ! -e $rebuild_marker ]] || exit 0 | ||
| omarchy-cmd-present limine-mkinitcpio || exit 0 | ||
|
|
||
| sudo limine-mkinitcpio | ||
| sudo install -Dm644 /dev/null "$rebuild_marker" |
There was a problem hiding this comment.
Two users running omarchy-migrate together can both pass the shared marker check and call limine-mkinitcpio before either writes the marker. The marker prevents later runs, but not overlapping ones, so the expensive rebuild can run twice. Take a machine-wide lock and check the marker again inside it.
Knowledge Base Used: Migration framework
| rm -f "$marker" | ||
| : >"$calls" | ||
| run_migration | ||
| grep -Fxq 'limine-mkinitcpio' "$calls" || fail "the migration retries an interrupted rebuild" | ||
| ! grep -q $'^sudo\tsed$' "$calls" || fail "a retried rebuild leaves the repaired file alone" "$(cat "$calls")" | ||
| pass "the migration retries an interrupted rebuild" |
There was a problem hiding this comment.
The test called “retries an interrupted rebuild” only deletes a marker from a successful run. The limine-mkinitcpio stub always succeeds, so the test would miss a change that records completion after a failed rebuild. Make the stub fail once, assert a nonzero exit and no marker, then retry successfully with the already-repaired file.
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!
|
Two notes: Blocking: migration filename collision. Overlap: #8151 ("Preserve existing initramfs modules on Surface devices") is still open for the same issue (#7111). This version adds the migration and the |
|
Reviewed by Claude Opus 5.5, with a second opinion from Codex Medium. Both were source reviews against This competes with #8151, which is older and fixes #7111 with the same one-line What this one adds is the repair for existing installs. #8151 changes what the installer writes from now on, but a Surface that already has the old It cannot be carried over as it stands, for three reasons:
This now waits on the maintainer: #8151 is the fix to merge, with the migration added to it, and this one can then be closed. |
The installer now appends, but a Surface installed before this keeps the MODULES=(...) drop-in, which sorts after nvidia.conf and drops its modules from every initramfs. The migration rewrites only a file that is exactly what the installer wrote, then rebuilds once per machine, with a marker so another user skips a finished rebuild and an interrupted one is retried. Carried over from omacom#14541 under a fresh timestamp, since 1791403252 is already taken on quattro. The omarchy_hooks.conf comment now states the rule instead of describing the old Surface file as the exception. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
install/hardware/fix-surface-keyboard.shwrotesurface_device_modules.confasMODULES=(...). mkinitcpio concatenates its drop-ins in sorted order after/etc/mkinitcpio.conf, and that file sorts afternvidia.conf, so on a Surface with an NVIDIA GPU the reset removednvidia nvidia_modeset nvidia_uvm nvidia_drmfrom MODULES, along with anything the main config or an earlier drop-in listed. The installer now appends, asnvidia.conf,apple-t2.confandthunderbolt_module.confalready do.Existing installs keep the file they were given, so a migration repairs it and rebuilds the initramfs once per machine. It matches only the file the installer wrote, whole (one or more
pinctrl_modules followed by the installer's exact module list), so a hand-written drop-in that resets MODULES on purpose is left alone. It rebuilds whether or notnvidia.confexists, since the reset also dropped modules from other sources; fresh installs mark every migration complete, so only machines that had the old file rebuild. Like the other migrations that call it, it trustslimine-mkinitcpio's exit status, which stays 0 when a single kernel's build fails.The comment in
omarchy_hooks.confthat described the Surface file as the exception now states the rule: a drop-in sorting after it must append to MODULES, because it reads MODULES midway through sourcing to decide whether to drop thekmshook.install/hardware/apple/fix-spi-keyboard.shhas the sameMODULES=shape. It is left as it is:macbook_spi_modules.confsorts beforenvidia.confandomarchy_hooks.conf, so it collides with nothing Omarchy writes today.Fixes #7111