NVIDIA driver module: detect the GPU, install the right branch #16

Merged
yuri merged 1 commits from feat/nvidia-driver-module into main 2026-11-13 12:39:29 +01:00
Owner

Installs the NVIDIA driver branch that matches the card actually in the machine.

What it does

modules/user/nvidia.sh detects the GPU with lspci -nn and installs the branch that fits:

Chip family in the name Branch Packages
GB/AD/GA/TU current akmod-nvidia + xorg-x11-drv-nvidia-cuda
GV/GP/GM 580xx akmod-nvidia-580xx + xorg-x11-drv-nvidia-580xx{,-cuda}
GK 470xx akmod-nvidia-470xx + ...
GF 390xx akmod-nvidia-390xx + ...
pre-Fermi none refused: 340xx is EOL + needs a longterm kernel

The branch is derived from the chip family in the PCI name, not the numeric device-id ranges: those overlap between families, and a wrong guess installs a module the card cannot use. An unparseable name asks instead of guessing.

Safe ordering

  • Secure Boot enforcing -> generate + mokutil --import the akmods key, then stop before installing the driver and ask for a reboot. Installing an unsigned module while enforcement is on is the documented black-screen path, because the driver package blacklists nouveau as it lands. Re-run after MokManager enrolment.
  • Secure Boot off / Setup mode -> no signing at all. A MOK import request is never processed when enforcement is off (shim skips MokManager), so doing it would only leave a stuck request in the efivars.
  • No nvidia-drm.modeset=1 anywhere: RPM Fusion's kernel package enables KMS, and the flag now conflicts with Fedora's simpledrm early-boot patch.

Housekeeping

  • bounded (5 min) wait for the kmod build, so a reboot cannot land mid-build into a driverless boot
  • dnf mark user on the akmod, so dnf autoremove cannot take the driver and its compiler away
  • VA-API decode + vulkan offered as an opt-in extra (modules stay minimal)
  • idempotent: an installed branch is not reinstalled, but is still re-marked

Wiring

setup.sh gains --nvidia=auto|no (default auto, yes accepted as an alias), dispatched after the DE/TWM modules. Detected hardware decides the action: no prompt. --nvidia=no is the opt-out for nouveau or a hand-built driver. Summary section reports the module version.

Testing

Stub harness, 14 scenarios / 38 assertions, all green: every branch mapping, multi-GPU warning, Optimus (3D controller), pre-Fermi refusal, SB on-without-key / on-with-key / off / setup, unparseable-name fallback, idempotent re-run, build timeout (no false success).

Known limit (same as the rest of this repo): the harness proves control flow, not package names. akmod-nvidia*, xorg-x11-drv-nvidia*-cuda and libva-nvidia-driver are taken from the RPM Fusion howto for F44, but a real F44 run is the actual proof. Also unproven on real hardware: the MokManager interaction itself (only the pre-install gate is tested).

Installs the NVIDIA driver branch that matches the card actually in the machine. ## What it does `modules/user/nvidia.sh` detects the GPU with `lspci -nn` and installs the branch that fits: | Chip family in the name | Branch | Packages | |---|---|---| | `GB`/`AD`/`GA`/`TU` | current | `akmod-nvidia` + `xorg-x11-drv-nvidia-cuda` | | `GV`/`GP`/`GM` | 580xx | `akmod-nvidia-580xx` + `xorg-x11-drv-nvidia-580xx{,-cuda}` | | `GK` | 470xx | `akmod-nvidia-470xx` + ... | | `GF` | 390xx | `akmod-nvidia-390xx` + ... | | pre-Fermi | none | refused: 340xx is EOL + needs a longterm kernel | The branch is derived from the **chip family in the PCI name**, not the numeric device-id ranges: those overlap between families, and a wrong guess installs a module the card cannot use. An unparseable name asks instead of guessing. ## Safe ordering * **Secure Boot enforcing** -> generate + `mokutil --import` the akmods key, then **stop before installing the driver** and ask for a reboot. Installing an unsigned module while enforcement is on is the documented black-screen path, because the driver package blacklists nouveau as it lands. Re-run after MokManager enrolment. * **Secure Boot off / Setup mode** -> no signing at all. A MOK import request is never processed when enforcement is off (shim skips MokManager), so doing it would only leave a stuck request in the efivars. * No `nvidia-drm.modeset=1` anywhere: RPM Fusion's kernel package enables KMS, and the flag now conflicts with Fedora's simpledrm early-boot patch. ## Housekeeping * bounded (5 min) wait for the kmod build, so a reboot cannot land mid-build into a driverless boot * `dnf mark user` on the akmod, so `dnf autoremove` cannot take the driver and its compiler away * VA-API decode + vulkan offered as an opt-in extra (modules stay minimal) * idempotent: an installed branch is not reinstalled, but is still re-marked ## Wiring `setup.sh` gains `--nvidia=auto|no` (default `auto`, `yes` accepted as an alias), dispatched after the DE/TWM modules. Detected hardware decides the action: no prompt. `--nvidia=no` is the opt-out for nouveau or a hand-built driver. Summary section reports the module version. ## Testing Stub harness, 14 scenarios / 38 assertions, all green: every branch mapping, multi-GPU warning, Optimus (3D controller), pre-Fermi refusal, SB on-without-key / on-with-key / off / setup, unparseable-name fallback, idempotent re-run, build timeout (no false success). **Known limit (same as the rest of this repo):** the harness proves control flow, not package names. `akmod-nvidia*`, `xorg-x11-drv-nvidia*-cuda` and `libva-nvidia-driver` are taken from the RPM Fusion howto for F44, but a real F44 run is the actual proof. Also unproven on real hardware: the MokManager interaction itself (only the pre-install gate is tested).
yuri added 1 commit 2026-11-13 12:18:33 +01:00
modules/user/nvidia.sh detects the card via lspci and installs the branch
that matches it: current (Turing+), 580xx (Volta/Pascal/Maxwell), 470xx
(Kepler), 390xx (Fermi); pre-Fermi is refused with an explanation.

- no prompt for a detected GPU (--nvidia=no is the opt-out, wired in setup.sh)
- Secure Boot gate: with enforcement on, the akmods key is generated and
  imported and the module stops BEFORE installing the driver, so nobody gets
  the documented unsigned-module black screen; off/setup-mode skips signing
  entirely (a MOK import is never processed when enforcement is off)
- bounded wait for the kmod build, so a reboot cannot land mid-build
- dnf mark user on the akmod; VA-API/vulkan offered as an opt-in extra
- never sets nvidia-drm.modeset=1 (RPM Fusion enables KMS; the flag conflicts
  with Fedora's simpledrm patch)
- branch chosen from the chip family in the PCI name, not the device-id
  ranges, which overlap between families

Tested with a stub harness (38 assertions, 14 scenarios): all four branch
mappings, multi-GPU warning, Optimus, pre-Fermi refusal, SB on/off/setup,
unparseable name fallback, idempotent re-run, build timeout.
yuri merged commit fec520be9d into main 2026-11-13 12:39:29 +01:00
yuri deleted branch feat/nvidia-driver-module 2026-11-13 12:39:29 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: yuri/fedora#16