Fix NVIDIA CUDA Repo Debian 13

- Fixed critical abort in `_install_nvidia_cuda_repo` for Debian 13 (Trixie) when installing v590/v595 due to `nvidia-open` availability checks.
- Removed pre-install `apt-cache policy` verification that caused premature script termination on version mismatches.
- Eliminated manual creation of `/etc/apt/preferences.d/block-nvidia`, relying exclusively on official NVIDIA pinning packages (`nvidia-driver-pinning-${ver}`).
- Updated error handling to display real `apt` output on failure instead of generic abort messages, improving troubleshooting visibility.
- Synchronized documentation in `docs/gpu.md` to reflect the simplified CUDA repo flow and removed references to manual pinning or candidate checks.
This commit is contained in:
stornic56
2026-08-10 00:55:47 -05:00
committed by GitHub
parent f0be860f98
commit 2bcdb511b2
2 changed files with 14 additions and 39 deletions
+1 -1
View File
@@ -175,7 +175,7 @@ The NVIDIA driver installation process is inherently complex due to proprietary
#### **Blackwell Architecture & CUDA v590** #### **Blackwell Architecture & CUDA v590**
- **Detection**: `_helpers.sh` function `is_nvidia_blackwell()` identifies GPUs via PCI IDs `10de:24xx`, `0x29000x29BF`, and `0x2B800x31FF`. - **Detection**: `_helpers.sh` function `is_nvidia_blackwell()` identifies GPUs via PCI IDs `10de:24xx`, `0x29000x29BF`, and `0x2B800x31FF`.
- **Reason for v590**: Debian 13 (Trixie) stable drivers only support up to v550, which lacks Blackwell (GB20x) architecture. The NVIDIA CUDA repository provides production branch v590 with unified driver packages. Specifically, the goal is to install the latest version of the nvidia-driver from the 590 branch, which would be [590.48.01](https://download.nvidia.com/XFree86/Linux-x86_64/590.48.01/README/supportedchips.html). - **Reason for v590**: Debian 13 (Trixie) stable drivers only support up to v550, which lacks Blackwell (GB20x) architecture. The NVIDIA CUDA repository provides production branch v590 with unified driver packages. Specifically, the goal is to install the latest version of the nvidia-driver from the 590 branch, which would be [590.48.01](https://download.nvidia.com/XFree86/Linux-x86_64/590.48.01/README/supportedchips.html).
- **CUDA Repository Enablement**: On Debian 12 (Bookworm) the `nvidia-cuda` repository is enabled via `extrepo`. On Debian 13 (Trixie) the official `cuda-keyring` package is used instead (`wget` + `dpkg -i`), since extrepo cannot configure the repo correctly on Trixie. After enabling, the script always runs an explicit `apt update` and verifies the APT candidate matches the requested branch (`595.*`) before writing APT pinning in `/etc/apt/preferences.d/block-nvidia` and installing `nvidia-driver-pinning-<ver>`, `nvidia-driver`, and `firmware-nvidia-gsp`. If the candidate does not match, the installation aborts cleanly. - **CUDA Repository Enablement**: On Debian 12 (Bookworm) the `nvidia-cuda` repository is enabled via `extrepo`. On Debian 13 (Trixie) the official `cuda-keyring` package is used instead (`wget` + `dpkg -i`), since extrepo cannot configure the repo correctly on Trixie. After enabling, the script always runs an explicit `apt update`, then installs `nvidia-driver-pinning-<ver>` if available (official NVIDIA pinning, optional), and finally installs the unified metapackage `nvidia-open` plus `firmware-nvidia-gsp`. No manual pinning file is written; if `apt install` fails, the real apt error is shown and the installation aborts.
#### **Installation Flow** #### **Installation Flow**
```bash ```bash
+13 -38
View File
@@ -268,19 +268,14 @@ _configure_nvidia_wayland() {
# ------------------------------------------------------------------- # -------------------------------------------------------------------
_install_nvidia_cuda_repo() { _install_nvidia_cuda_repo() {
local ver="${1:-590}" local ver="${1:-590}"
# 590/595 → metapaquete con módulo kernel ABIERTO (el dispatcher ya
# vetó Maxwell/Pascal, solo Turing+ llega aquí)
local meta="nvidia-driver"
[ "$ver" = "590" ] || [ "$ver" = "595" ] && meta="nvidia-open"
local warn="WARNING: You are about to install NVIDIA v${ver} from\n" local warn="WARNING: You are about to install NVIDIA v${ver} from\n"
warn+="the official NVIDIA CUDA repository.\n\n" warn+="the official NVIDIA CUDA repository.\n\n"
warn+="Source: Official NVIDIA CUDA Repo (Pinned v${ver}.*)\n" warn+="Source: Official NVIDIA CUDA Repo\n"
warn+="Driver: Production Branch v${ver} (unified metapackage)\n" warn+="Driver: Production Branch v${ver} (unified metapackage)\n"
warn+="[+] ${meta} (full 64-bit compute + graphics)\n" warn+="[+] nvidia-open (full 64-bit compute + graphics)\n"
warn+="[+] nvidia-kernel-dkms / nvidia-kernel-open-dkms (vía metapaquete)\n" warn+="[+] nvidia-kernel-dkms / nvidia-kernel-open-dkms (vía metapaquete)\n"
warn+="[+] firmware-nvidia-gsp\n" warn+="[+] firmware-nvidia-gsp\n"
warn+="[+] nvidia-driver-pinning-${ver} (if available)\n" warn+="[+] nvidia-driver-pinning-${ver} (if available)\n\n"
warn+="[+] APT Pinning (version ${ver}.*)\n\n"
warn+="Do you want to proceed at your own risk?" warn+="Do you want to proceed at your own risk?"
if ! _confirm_custom "NVIDIA Driver — v${ver}" "$warn" "Proceed" "Abort" 18 70; then if ! _confirm_custom "NVIDIA Driver — v${ver}" "$warn" "Proceed" "Abort" 18 70; then
@@ -288,7 +283,7 @@ _install_nvidia_cuda_repo() {
return 1 return 1
fi fi
# Step 1: Enable CUDA repo via extrepo # Step 1: Enable CUDA repo (cuda-keyring Trixie / extrepo Bookworm)
if ! _enable_cuda_repo; then if ! _enable_cuda_repo; then
_msg "CUDA Repo — Error" "Failed to enable the official NVIDIA CUDA repository.\n\nNo NVIDIA driver was installed." 10 60 _msg "CUDA Repo — Error" "Failed to enable the official NVIDIA CUDA repository.\n\nNo NVIDIA driver was installed." 10 60
return 1 return 1
@@ -303,38 +298,18 @@ _install_nvidia_cuda_repo() {
return 1 return 1
fi fi
# Step 3: Verificar que el candidato coincide con la rama pedida. # Step 3: Pinning oficial de NVIDIA (instalar si existe; el repo no
# Defensa en profundidad: si el repo no tiene la versión esperada, # siempre lo publica). Su fallo no debe romper el flujo.
# abortar limpiamente en vez de instalar una versión incorrecta. sudo apt install -y "nvidia-driver-pinning-${ver}" >/dev/null 2>&1 || true
local candidate
candidate=$(apt-cache policy "$meta" 2>/dev/null | grep "Candidate:" | awk '{print $2}')
if [ -z "$candidate" ] || ! echo "$candidate" | grep -q "^${ver}"; then
NVIDIA_DRIVER_MODE=""
_msg "CUDA Repo — Error" "Expected ${meta} ${ver}.* but APT candidate is ${candidate:-none}.\n\nThe CUDA repository may not have the requested version. Aborting." 10 60
return 1
fi
# Step 4: Create APT pinning to lock to the selected branch # Step 4: Instalar el metapaquete. Si falla, el error real de apt
if ! _run_cmd "APT Pinning" \ # ya quedó visible arriba (output de _run_cmd) — no abortar antes
"printf '%s\n' \"Package: *nvidia*\" \"Package: *cuda*\" \"Package: libcuda1\" \"Package: firmware-nvidia-gsp\" \"Pin: version ${ver}.*\" \"Pin-Priority: 1001\" | sudo tee /etc/apt/preferences.d/block-nvidia > /dev/null" \ # de intentar la instalación.
"Creating APT pinning to lock NVIDIA to v${ver} branch..."; then
_msg "APT Pinning — Error" "Failed to write APT pinning.\n\nNo NVIDIA driver was installed." 10 60
return 1
fi
# Step 5: Install NVIDIA unified metapackages (driver pinning)
local pin_meta="nvidia-driver-pinning-${ver}"
local install_cmd="$meta firmware-nvidia-gsp"
if apt-cache policy "$pin_meta" 2>/dev/null | grep -q "Candidate: [^ (none)]"; then
install_cmd="$pin_meta $install_cmd"
else
echo -e "${YELLOW}${pin_meta} not available in the NVIDIA repo — using APT pinning only.${NC}"
fi
if ! _run_cmd "NVIDIA CUDA" \ if ! _run_cmd "NVIDIA CUDA" \
"sudo apt install -y $install_cmd" \ "sudo apt install -y nvidia-open firmware-nvidia-gsp" \
"Installing NVIDIA v${ver} production driver via unified metapackages..."; then "Installing NVIDIA v${ver} production driver via unified metapackage..."; then
NVIDIA_DRIVER_MODE="" NVIDIA_DRIVER_MODE=""
_msg "NVIDIA — Error" "NVIDIA v${ver} installation FAILED.\n\nNo NVIDIA driver was installed." 10 60 _msg "NVIDIA — Error" "NVIDIA v${ver} installation FAILED.\n\nCheck the apt error above.\n\nNo NVIDIA driver was installed." 10 60
return 1 return 1
fi fi