Skip to content

Drop the NVIDIA early KMS stack on hybrid laptops whose dGPU drives no display - #16848

Open
SergeiAug wants to merge 2 commits into
omacom:quattrofrom
SergeiAug:hybrid-nvidia-initramfs
Open

SergeiAug wants to merge 2 commits into
omacom:quattrofrom
SergeiAug:hybrid-nvidia-initramfs

Conversation

@SergeiAug

@SergeiAug SergeiAug commented Oct 28, 2026 •

Copy link
Copy Markdown

Follow-up to #6790 / #6791, which dropped kms on NVIDIA-only machines and deliberately left hybrids alone.

On a hybrid laptop where the panel and every port are wired to the iGPU, nvidia.conf still early-loads all four nvidia modules, and kms still lets autodetect add nouveau. Both bring their firmware, so the initramfs carries the nvidia module, nouveau and the GSP blobs for Turing and Ampere, none of which can run before the root filesystem is up on these machines. On my laptop (i5-1035G1 + MX350, nvidia-580xx-dkms, Limine + UKI + LUKS) that is 270 MB of a 301 MB initramfs. Limine reads and hashes the whole UKI on every boot, and the history copies kept for snapshots fill /boot fast.

Change

omarchy_hooks.conf gets a second case next to the NVIDIA-only one. When nvidia_drm is early-loaded and the machine is hybrid, it removes nvidia* from MODULES, adds the iGPU's driver module, and drops kms. NVIDIA then loads from the root filesystem like any other module; its modprobe.d options still apply.

It only fires when every signal agrees, and anything inconclusive keeps today's behaviour:

  • the NVIDIA GPU has a DRM card (so nvidia_drm has bound it) and that card has no connectors;
  • the NVIDIA GPU is not boot_vga;
  • every other display controller is bound to a driver with a loadable module (driver/module in sysfs), which is the module added to MODULES (i915, xe, amdgpu);
  • no drop-in sorting after omarchy_hooks.conf resets MODULES outright. surface_device_modules.conf does, and on a Surface Book it would strip the iGPU driver after kms was gone, leaving the LUKS prompt without early KMS. mkinitcpio sources all drop-ins as one concatenated file, so the conf walks /etc/mkinitcpio.conf.d (overridable with OMARCHY_MKINITCPIO_CONF_DIR) in mkinitcpio's order rather than looking beside itself.

A laptop with HDMI wired to the dGPU has a connector on the NVIDIA card and keeps everything, so an external monitor still shows the LUKS prompt.

A migration rebuilds the initramfs once where the conditional changes the result, following 1786605598.sh.

Testing

  • test/shell.d/nvidia-kms-hook-test.sh: 22/22 pass. The 13 new cases cover offload-only with Intel and AMD iGPUs, an output on NVIDIA, NVIDIA as boot_vga, NVIDIA without a DRM card, an iGPU with no bound driver, an unreadable device, MODULES without nvidia_drm, and a later drop-in that resets or appends to MODULES. Against the current omarchy_hooks.conf the new cases fail.
  • test/shell.d/mkinitcpio-hooks-test.sh: 45/45 pass, including two new composed cases: an offload-only hybrid gets i915 and loses kms, an offload-only Surface Book keeps kms and the Surface MODULES. The Surface case fails on the first commit of this PR.
  • test/shell.d/hardware-quirks-test.sh passes.
  • Real hardware, ASUS VivoBook S13 (i5-1035G1, GeForce MX350 with no connectors, Intel boot_vga), kernel 7.2.8-10-omarchy, nvidia-580xx-dkms 580.196.07:
    • mkinitcpio on the installed drop-ins concatenated the way mkinitcpio does it: 301 MB → 31 MB. nouveau and all nvidia modules gone; i915, dm-crypt and Plymouth still in the image. With a Surface-style MODULES=(…) drop-in added, kms runs and the image matches current behaviour.
    • With the equivalent change installed: Limine loader time in systemd-analyze 9.8 s → 2.3 s, /boot usage 1.3 GB → 1.0 GB. Plymouth LUKS prompt unchanged, nvidia and nvidia_drm load after switch-root, CUDA works.
  • Migration run against stubbed sudo: rebuilds with the new conf, no-ops with the old conf and without nvidia.conf. A config that fails to evaluate exits non-zero and stays pending.

🤖 Generated with Claude Code

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; both previous findings are addressed and no new blocking issue was found.

Summary

The PR removes early NVIDIA modules and kms on eligible hybrid laptops, while adding the other GPU’s driver.

  • Offload-only laptops use the iGPU for early display and load NVIDIA later.
  • Affected laptops rebuild the initramfs once after the NVIDIA modules drop out.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[nvidia_drm is early-loaded] --> B{NVIDIA is the only GPU?}
  B -- Yes --> C[Remove kms]
  B -- No --> D{Hybrid passes every safety check?}
  D -- No --> E[Keep current modules and kms]
  D -- Yes --> F{Later drop-in resets MODULES?}
  F -- Yes --> E
  F -- No --> G[Replace NVIDIA modules with other GPU driver]
  G --> C
Loading

Reviews (2) · Last reviewed commit: "Find later MODULES resets in the drop-in..." · Reviewed by Greptile

Comment thread migrations/1793139220.sh Resolved
…OURCE

mkinitcpio appends the drop-ins to mkinitcpio.conf and sources one temporary
file, so BASH_SOURCE never pointed at /etc/mkinitcpio.conf.d. Walk the
directory in mkinitcpio's order, cover the Surface case with the composed
test, and keep the migration pending when the config fails to evaluate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sergihrs

sergihrs commented Nov 5, 2026

Copy link
Copy Markdown

A data point for the negative case, a hybrid with HDMI wired to the dGPU: ASUS ROG Zephyrus G16 GU605CP, Arc 140T 8086:7d51 (i915, boot_vga=1) + RTX 5070 Laptop 10de:2d58 (nvidia-open 610.57.04, boot_vga=0), MUX in hybrid mode, Omarchy 4.5.0.

The NVIDIA card has connectors here, so by the PR's checks it keeps the nvidia modules and kms, as the description says:

$ ls -d /sys/bus/pci/devices/0000:01:00.0/drm/card*/card*-*
/sys/bus/pci/devices/0000:01:00.0/drm/card0/card0-DP-4
/sys/bus/pci/devices/0000:01:00.0/drm/card0/card0-eDP-2
/sys/bus/pci/devices/0000:01:00.0/drm/card0/card0-HDMI-A-2

Note eDP-2: on this MUX laptop nvidia-drm registers the panel's connector too, even in hybrid mode where i915 drives the panel (card1-eDP-1). So MUX laptops keep the stack even when every external port is on the iGPU, which also covers a later switch to dGPU-only MUX mode, where the panel and the LUKS prompt move to NVIDIA.

The reads the check does (class, vendor, boot_vga, driver/module, the connector listing) don't resume the dGPU: power/runtime_status stayed suspended.

For what it's worth, I've stripped the four nvidia modules from MODULES by hand on this laptop since early October (kms kept): the UKI went from 256 to 158 MB, the LUKS prompt comes about 3.8 s sooner, and HDMI still works after login, since Hyprland adds the NVIDIA card when it appears. I haven't tested whether the LUKS prompt shows on an external screen either way.

@avanishkasar

Copy link
Copy Markdown

Positive case on real hardware, checked without rebuilding anything: IdeaPad S540-15IML. Intel Comet Lake-U UHD (8086:9b41, i915, boot_vga=1, owns eDP-1 and HDMI-A-1) plus MX250 (nvidia, card0 with no connectors, no boot_vga). Omarchy 4.5.0-3, systemd 262.1.

I sourced nvidia.conf and this PR's omarchy_hooks.conf (e38fa2f) in a subshell:

  • With the stock drop-ins: MODULES=(i915), kms dropped.
  • With my live directory, where a later local drop-in resets MODULES=(): the nvidia modules and kms stay. So the reset guard works.

That local drop-in was a cruder manual version of this change. My normal UKI is 54.8 MB, compared with 330.8 MB for the untouched LTS one (different kernel, so it's only a rough comparison). The panel comes up on i915 and the LUKS prompt works. Boot time dropped too, but I changed the Limine timeout at the same time, so I can't attribute it to the size.

Filed by Claude Opus 5.5 via Claude Code.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants