Skip to content

Preserve existing initramfs modules on Surface devices - #8151

Open
jovial-liu wants to merge 11 commits into
omacom:quattrofrom
jovial-liu:fix/surface-modules-append
Open

jovial-liu wants to merge 11 commits into
omacom:quattrofrom
jovial-liu:fix/surface-modules-append

Conversation

@jovial-liu

Copy link
Copy Markdown
Contributor

Fixes #7111

Append the Surface-specific modules to MODULES instead of replacing the existing list. This preserves NVIDIA modules when the Surface hardware setup runs after the NVIDIA configuration.

Copilot AI balanced review requested due to automatic review settings August 25, 2026 03:56
@jovial-liu jovial-liu closed this Aug 25, 2026
@jovial-liu
jovial-liu force-pushed the fix/surface-modules-append branch from 1cc93d8 to 43bfe9b Compare August 25, 2026 03:56
@jovial-liu jovial-liu reopened this Aug 25, 2026

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

Preserves existing initramfs modules when configuring Surface keyboard support.

Changes:

  • Appends Surface modules to MODULES instead of replacing existing entries.

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.


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

echo "Detected pinctrl module: $pinctrl_module"
mkdir -p /etc/mkinitcpio.conf.d
echo "MODULES=(${pinctrl_module} surface_aggregator surface_aggregator_registry surface_aggregator_hub surface_hid_core surface_hid surface_kbd intel_lpss_pci 8250_dw)" > \
echo "MODULES+=(${pinctrl_module} surface_aggregator surface_aggregator_registry surface_aggregator_hub surface_hid_core surface_hid surface_kbd intel_lpss_pci 8250_dw)" > \
@omarchybot omarchybot added bug Something isn't working compatibility Make Omarchy work better on everything! verified Omarchy Triage has verified that this issue is ready for final review labels Sep 27, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at e9dcebd against quattro 43bfe9b. Changing MODULES= to MODULES+= fixes #7111, and the fix is the right size for the problem. There is nothing for you to change.

Reproduced on a disposable Omarchy worker. I wrote nvidia.conf the way install/hardware/nvidia.sh does and ran install/hardware/fix-surface-keyboard.sh from each tree, with Surface detection and a pinctrl_tigerlake module stubbed in. Then I resolved the drop-ins the way mkinitcpio does and ran a real mkinitcpio build:

  • On quattro, surface_device_modules.conf sorts after nvidia.conf and resets MODULES, so the build never asks for nvidia, nvidia_modeset, nvidia_uvm or nvidia_drm.
  • On this branch, MODULES resolves to the NVIDIA modules, then the Surface modules, then thunderbolt, and the build asks for all four NVIDIA modules. The worker has no NVIDIA driver, so it reports them as not found, which proves they are requested. The Surface modules land in the image either way.

./test/cli passed on the worker, and so did test/shell.d/nvidia-kms-hook-test.sh (9/9). The only hardware involved is Surface detection, which was stubbed. The bug itself is in how the drop-ins combine, and that was run for real.

No second opinion. The configured reviewer (Codex Medium) refused this run because its daily review quota was spent. Only one model has checked this, so it is not marked ready.

Two things for the maintainer, neither a defect in this change:

  • Surface machines installed before this change keep the old MODULES= file, because nothing migrates it. Rewriting that file and regenerating the initramfs would be a separate migration.
  • The comment at etc/mkinitcpio.conf.d/omarchy_hooks.conf:12-16 says surface_device_modules.conf resets MODULES. That is no longer true for new installs, but it still is for the older installs above. Whether to reword it depends on whether that migration lands.

Waiting on the second opinion, then the maintainer.

Arthur031221 added a commit to Arthur031221/omarchy that referenced this pull request Oct 7, 2026
Use the pinctrl module change from omacom#8151 by @jovial-liu.

Co-authored-by: kaixin liu <184472154+jovial-liu@users.noreply.github.com>
@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Preserves existing initramfs modules when Surface keyboard setup runs.

  • Surface keyboard setup adds its modules without replacing earlier ones.

Reviews (6) · Last reviewed commit: "Keep the Surface migration pending when ..." · Reviewed by Greptile

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 8, 2026
omarchybot and others added 2 commits October 8, 2026 05:24
The rewritten comment says older surface_device_modules.conf files can strip nvidia_drm after kms was dropped, but no longer says why that never happens: every Surface Omarchy writes the file for has a non-NVIDIA iGPU, so the scan below keeps kms. Without that, the comment describes a hazard that cannot occur and drops the instruction that keeps it that way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
The sentence this reverts claimed every Surface has a non-NVIDIA iGPU that keeps kms, but a Surface Studio 2 reports its GTX 1070 as its only display controller, so the claim is not one the code can rest on. The contributor's wording, that an older file may strip nvidia_drm after kms was dropped, is the accurate one.

This reverts commit e7a1265.

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 Oct 8, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at e9dcebd against quattro 43bfe9b. Changing MODULES= to MODULES+= fixes #7111, and the fix is the right size for the problem. There is nothing for you to change.

Reproduced on a disposable Omarchy worker. I wrote nvidia.conf the way install/hardware/nvidia.sh does and ran install/hardware/fix-surface-keyboard.sh from each tree, with Surface detection and a pinctrl_tigerlake module stubbed in. Then I resolved the drop-ins the way mkinitcpio does and ran a real mkinitcpio build:

  • On quattro, surface_device_modules.conf sorts after nvidia.conf and resets MODULES, so the build never asks for nvidia, nvidia_modeset, nvidia_uvm or nvidia_drm.
  • On this branch, MODULES resolves to the NVIDIA modules, then the Surface modules, then thunderbolt, and the build asks for all four NVIDIA modules. The worker has no NVIDIA driver, so it reports them as not found, which proves they are requested. The Surface modules land in the image either way.

./test/cli passed on the worker, and so did test/shell.d/nvidia-kms-hook-test.sh (9/9). The only hardware involved is Surface detection, which was stubbed. The bug itself is in how the drop-ins combine, and that was run for real.

No second opinion. The configured reviewer (Codex Medium) refused this run because its daily review quota was spent. Only one model has checked this, so it is not marked ready.

Two things for the maintainer, neither a defect in this change:

  • Surface machines installed before this change keep the old MODULES= file, because nothing migrates it. Rewriting that file and regenerating the initramfs would be a separate migration.
  • The comment at etc/mkinitcpio.conf.d/omarchy_hooks.conf:12-16 says surface_device_modules.conf resets MODULES. That is no longer true for new installs, but it still is for the older installs above. Whether to reword it depends on whether that migration lands.

Waiting on the second opinion, then the maintainer.

@omarchybot

Copy link
Copy Markdown
Collaborator

The comment just above this one was posted by mistake. It is a stale copy of the September 28 review of e9dcebd, and what it says about the second opinion and readiness is out of date. This is the current review.

Reviewed again at ffe0fad against quattro 902fd8a, after your comment rewrite in 7910faf. The fix still holds, and there is nothing for you to change.

Reproduced on a disposable Omarchy worker. I stubbed Surface detection and a pinctrl_tigerlake module, wrote nvidia.conf the way install/hardware/nvidia.sh does, and ran install/hardware/fix-surface-keyboard.sh from each tree. Then I resolved the drop-ins in mkinitcpio's order and ran a real mkinitcpio build. On quattro, and on this branch with the fix reverted, MODULES loses all four NVIDIA modules. On this branch it keeps them ahead of the Surface modules, and the build asks for them. ./test/cli passed on the worker, and so did nvidia-kms-hook-test.sh, nvidia-kms-migration-test.sh and hyprland-keyboard-layout-test.sh.

Second opinion: Codex Medium, three rounds. It found no defect in the fix. In the first round it pointed out that your rewrite dropped the old comment's reason why an old surface_device_modules.conf is harmless: every such machine has a non-NVIDIA iGPU, so kms stays. I pushed e7a1265 to put that back. The next round showed the claim does not hold for every Surface. A Surface Studio 2 reports its GTX 1070 as its only display controller. So I reverted it in ffe0fad, and the tree is now exactly yours from 7910faf. Your wording, that an older file may strip nvidia_drm, is the accurate one, and the third round found nothing. Codex can read this session's transcript, so treat its agreement as agreement, not independent proof.

This is the only open fix for #7111. #14195 makes the same one-line change as part of its AMD Surface work, but its migration skips machines that already have a pinctrl module. So it does not compete with this one, and whichever lands second will need a trivial rebase.

One thing remains for the maintainer: Surface installs from before this change keep their MODULES= file, because nothing migrates it. Waiting on the maintainer.

@omarchybot omarchybot removed ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review labels Oct 15, 2026
omarchybot and others added 2 commits October 15, 2026 08:15
quattro moved the Surface keyboard script onto $mkinitcpio_dir and gated it on x86, so the append is carried onto that line. Its new tests pinned the old MODULES= form: surface-hardware-test now expects MODULES+=, and the hooks test's Surface fixture is what the installer writes now, so it keeps the NVIDIA modules ahead of the Surface ones and covers omacom#7111.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Installs from before this change still carry a MODULES= surface_device_modules.conf, so the hooks test composes both generations rather than only the new one.

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

Copy link
Copy Markdown
Collaborator

This stopped merging cleanly after #14820 changed install/hardware/fix-surface-keyboard.sh on quattro, so I merged quattro into your branch. There is nothing for you to change.

What I pushed. 22dbbeb is the merge. quattro now writes the drop-in into $mkinitcpio_dir and only runs the script on x86. I kept both of those and carried your MODULES+= onto that line. That merge also needed two test updates. quattro's new test/shell.d/surface-hardware-test.sh checked for the exact MODULES=( line, so it now expects MODULES+=(. b9cb375 adds a case to test/shell.d/mkinitcpio-hooks-test.sh where an appending Surface drop-in sits beside nvidia.conf, and the NVIDIA modules stay ahead of the Surface ones. I kept the existing case for the older MODULES= file, since installs from before this change still have one.

Reproduced on a disposable Omarchy worker at b9cb375, against quattro 246f33a. I stubbed Surface detection and a pinctrl_tigerlake module, wrote nvidia.conf the way install/hardware/nvidia.sh does, ran each tree's fix-surface-keyboard.sh, and sourced the drop-ins in mkinitcpio's order. On quattro, and on this branch with += reverted, MODULES loses nvidia, nvidia_modeset, nvidia_uvm and nvidia_drm. On this branch it keeps them. ./test/cli passed on the worker. So did surface-hardware-test.sh (1/1), mkinitcpio-hooks-test.sh (32/32) and nvidia-kms-hook-test.sh (11/11). With += reverted, surface-hardware-test.sh fails.

Second opinion: Codex Medium, two rounds. It found no defect in the fix or in how the conflict was resolved. In the first round it pointed out that replacing the older-drop-in case would lose coverage for existing installs. That is why the older case is kept beside the new one. The second round, at b9cb375, found nothing open. Codex can read this session's transcript, so treat its agreement as agreement, not independent proof.

One thing is still the maintainer's call: Surface installs from before this change keep their MODULES= file, because nothing migrates it. This pull request is waiting on the maintainer.

omarchybot and others added 2 commits October 16, 2026 07:48
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>
…rl module

Omarchy 3's installer wrote surface_device_modules.conf even when pinctrl detection failed, as MODULES=( surface_aggregator ...). That file resets MODULES the same way, so the migration matches it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@omarchybot omarchybot removed the ready Good to merge label Oct 16, 2026
Comment thread migrations/1792129609.sh Resolved
@omarchybot omarchybot added the ready Good to merge label Oct 16, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed by Claude Opus 5.5, with a second opinion from Codex Medium over two rounds, and run on a worker.

This now carries the repair for existing installs from #14541, which competed with this pull request for #7111. This one is older and makes the same installer change, so it is the one to land. The installer fix alone only changes what new installs get. A Surface that already has the MODULES=(...) drop-in keeps losing its NVIDIA modules until that file is rewritten. Two commits were pushed here:

  • migrations/1792129609.sh rewrites surface_device_modules.conf to append, but only when the file is exactly what an installer wrote, and then rebuilds the initramfs once per machine. A marker under /var/lib/omarchy/migrations lets another user's run skip a finished rebuild and still retry an interrupted one. It carries Append the Surface keyboard modules instead of resetting MODULES #14541's migration under a fresh timestamp, because 1791403252 is already taken on quattro.
  • Codex found that Omarchy 3's installer wrote the file even when no pinctrl module was detected, as MODULES=( surface_aggregator ...). That file resets MODULES the same way, so the migration matches it too.
  • The comment in etc/mkinitcpio.conf.d/omarchy_hooks.conf now states the rule: a drop-in that sorts after it must append to MODULES.

On the worker, with the old drop-in beside nvidia.conf in /etc/mkinitcpio.conf.d, MODULES came out without the NVIDIA modules. After the migration it kept them, and a second run did nothing. test/shell.d/surface-keyboard-modules-migration-test.sh covers one, several and no pinctrl modules, hand-written files that must be left alone, and a failed rebuild. It fails with the migration removed. ./test/cli, surface-hardware-test, mkinitcpio-hooks-test and nvidia-kms-hook-test pass. ./test/all has 8 failures in shell rendering, i18n and the sudo grant tests, and the same 8 fail on quattro at 246f33a.

One limit: limine-mkinitcpio can exit 0 after skipping a kernel it failed to build, and the migration trusts that exit status. The repaired config file is written first and stays, so the next kernel or mkinitcpio update rebuilds from it. Codex raised this and then agreed with that reasoning, though its independence is not guaranteed.

This now waits on the maintainer. Once it lands, #14541 can be closed.

@omarchybot omarchybot removed ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review labels Oct 27, 2026
omarchybot and others added 3 commits November 1, 2026 00:03
quattro folded surface-hardware-test.sh into the table-driven hardware-quirks-test.sh, so the Surface installer assertion moves there and now expects MODULES+=(.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
quattro's AGENTS.md now forbids tests for migrations, since a migration is frozen once it ships, so the test file goes and with it the OMARCHY_SURFACE_* overrides that only it used. The migration takes a fresh timestamp so it sorts after the ones quattro has added since, keeping the queue in order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
limine-mkinitcpio reports a kernel it could not rebuild and still exits 0, so the migration wrote its marker and omarchy-migrate marked it done while that kernel's image still lacked the NVIDIA modules. Check its output for the failure the way migrations/1791621765.sh does, and exit non-zero so the migration stays pending.

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 and removed verified Omarchy Triage has verified that this issue is ready for final review labels Oct 31, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed again by Claude Opus 5.5, with second opinions from Codex Medium and muse-wonder (pi, thinking high) over two rounds, and run on a worker.

This had stopped merging cleanly into quattro, so I merged quattro into your branch and pushed three commits. There is nothing for you to change.

  • ec61ee6 merges quattro. quattro folded test/shell.d/surface-hardware-test.sh into the table-driven test/shell.d/hardware-quirks-test.sh, so the Surface installer assertion now lives there and expects MODULES+=(.
  • 92be065 removes test/shell.d/surface-keyboard-modules-migration-test.sh, because quattro's AGENTS.md now says migrations get no tests, and drops the OMARCHY_SURFACE_* overrides that only that test used. The migration is renumbered to migrations/1793487813.sh so it sorts after quattro's newest one.
  • d654949 is the fix both reviewers asked for. limine-mkinitcpio can skip a kernel it failed to build and still exit 0, and the migration used to write its marker anyway. Now it checks the output for mkinitcpio failed for kernel, the same way migrations/1791621765.sh does, and exits 1 so the migration stays pending.

Here is what ran on the worker, against quattro at d367a56:

  • With nvidia.conf written the way install/hardware/nvidia.sh writes it, quattro's installer drops the NVIDIA modules from MODULES. So does this branch with the installer line reverted. This branch keeps them.
  • The migration rewrites both installer forms (with a pinctrl module, and Omarchy 3's form without one) to MODULES+=(. It leaves a hand-written file alone. Once it has run, a second run does nothing.
  • When a rebuild failed, the migration exited 1 with the file repaired and no marker. The retry only rebuilt.
  • hardware-quirks-test fails with the installer line reverted and passes here. mkinitcpio-hooks-test, nvidia-kms-hook-test and ./test/cli pass.
  • ./test/all fails the same four files on this branch and on quattro: agent-account-exec, ascii, branding-about-animation and first-run.

CI's test job failed on one file, test/shell.d/dropdown-test.sh. That is shell UI code this pull request does not touch, and it passed in the worker's full run of the merged branch before the last commit, which changes only the migration. A re-run should clear it.

Both reviewers found the rebuild issue above, and both came back clean on the second round. Their independence is not guaranteed.

One choice is left for the maintainer. The migration rebuilds the boot image on every Surface with the installer's file, even one without nvidia.conf. On an x86 Surface, nvidia.conf is the only drop-in that adds modules ahead of the Surface file, so without it the rebuild changes nothing. Rebuilding only when nvidia.conf exists would be narrower. I've left it as it is.

This waits on the maintainer, and on a green CI run. Once this lands, #14541 can be closed.

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

Labels

bug Something isn't working compatibility Make Omarchy work better on everything!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix-surface-keyboard.sh resets MODULES instead of appending, stripping NVIDIA early KMS on Surface devices

3 participants