From dbd2dfca37a25d7377c3f68c08b977887b37f72c Mon Sep 17 00:00:00 2001 From: stornic56 <71296607+stornic56@users.noreply.github.com> Date: Mon, 10 Aug 2026 17:58:03 -0500 Subject: [PATCH] nvidia ux & bookworm bpo cleanup - Removed redundant confirmation dialogs from `_install_nvidia_stack`. Users can now access driver management (including removal) without first confirming installation intent; initial plan display is followed by pause for review instead of blocking prompt. - Automated CUDA repository enabling on Debian 13/Bookworm paths (590/595). Manual confirmation prompts eliminated; script auto-enables repo via `_enable_cuda_repo` with error handling while maintaining safety checks. - Split CUDA driver installation into two distinct APT transactions in `nvidia.sh`. Step 1 installs mandatory version pinning (`nvidia-driver-pinning-${ver}`); failure aborts process. Step 2 installs `nvidia-open`, relying on transitive dependencies for firmware rather than explicit package listing. - Eliminated all Bookworm backports support due to EOL (2026-08-09). Removed `_install_nvidia_bookworm_bpo()`, dead code `install_nvidia_driver()`, and dispatcher logic for Debian 12. Turing now installs standard packages only; Trixie backports remain intact. - Updated documentation (`docs/gpu.md`) to reflect actual installation flow and removed references to deprecated functions. --- docs/gpu.md | 24 +++--- modules/gpu.sh | 19 ++--- modules/gpu/nvidia.sh | 167 ++++++++---------------------------------- modules/utils.sh | 3 + 4 files changed, 49 insertions(+), 164 deletions(-) diff --git a/docs/gpu.md b/docs/gpu.md index f8dffcf..857c764 100644 --- a/docs/gpu.md +++ b/docs/gpu.md @@ -178,20 +178,16 @@ The NVIDIA driver installation process is inherently complex due to proprietary - **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-` 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** -```bash -if [ "$HAS_NVIDIA" = true ]; then - if [ "$(is_backports_kernel)" == "true" ] && \ - { [ "$DEBIAN_CODENAME" != "trixie" ] || ! is_nvidia_blackwell; }; then - - # Warn about DKMS compatibility or use enterprise repo - offer_nvidia_enterprise_repo - fi - - if _confirm "NVIDIA Driver"; then - install_nvidia_driver # Installs latest stable (535/550) or v590 for Blackwell - fi -fi -``` +The NVIDIA flow is driven by `_install_nvidia_stack` (dispatcher in `modules/gpu.sh`): + +1. **Plan** — `_msg` with detected GPUs, then `_pause`. +2. **Manage menu** (`_nvidia_manage_menu`): "Install / Change NVIDIA Driver Version" or "Remove NVIDIA Driver and Restore Nouveau". +3. **Version menu** (`_show_nvidia_version_menu`): Debian 12 → v535 (Recommended) / v470 (Kepler); Debian 13 → v550 (Recommended) / v590 / v595 (NVIDIA CUDA Repo). +4. **Dispatch by hardware**: Kepler → `nvidia-tesla-470-driver`; Fermi → veto with message; Turing+ → `_install_nvidia_standard` (Debian stable); Blackwell on Trixie → CUDA repo v590. +5. **CUDA repo (590/595)**: two separate APT transactions — `nvidia-driver-pinning-` (version lock, mandatory) then `nvidia-open` (driver + open kernel modules, firmware via transitive dependency). +6. **Post-install**: `/etc/modprobe.d/nvidia-wayland.conf` + DKMS verification. + +> Note: Debian 12 (Bookworm) backports reached EOL (2026-08-09); the NVIDIA flow on Bookworm only uses the stable repository. --- ### 8.**NVIDIA Driver Management & Kernel Compatibility** diff --git a/modules/gpu.sh b/modules/gpu.sh index e0add2f..9776d63 100644 --- a/modules/gpu.sh +++ b/modules/gpu.sh @@ -187,10 +187,7 @@ _install_nvidia_stack() { plan+="\nPlanned:\n [+] NVIDIA proprietary driver" _msg "NVIDIA Stack — Plan" "$plan" 14 65 - if ! _confirm "NVIDIA Stack" "Install the NVIDIA proprietary driver?"; then - echo "Skipping NVIDIA driver installation." - return - fi + _pause "Press Enter to continue..." NVIDIA_DRIVER_MODE="" @@ -220,8 +217,6 @@ _install_nvidia_stack() { _msg "NVIDIA Fermi — Bookworm" \ "Fermi GPUs (GF1xx) are not supported\nin Debian 12 (Bookworm).\nThe nvidia-legacy-390xx driver is\nnot available in this version.\n\nNo NVIDIA driver will be installed." NVIDIA_DRIVER_MODE="" - elif [ "$(is_backports_kernel)" = "true" ]; then - _install_nvidia_bookworm_bpo else _install_nvidia_standard fi @@ -282,14 +277,10 @@ Only Turing, Ampere, Ada and Blackwell GPUs are supported.\n\n\ No NVIDIA driver will be installed." 14 65 NVIDIA_DRIVER_MODE="" else - if ! _is_cuda_repo_ready; then - if ! _confirm "CUDA Repository" \ - "The official NVIDIA CUDA repository is not enabled.\n\n\ -Enable it now? (Required for NVIDIA v${NVIDIA_SELECTED_VERSION}.)"; then - echo "Skipping NVIDIA driver installation." - NVIDIA_DRIVER_MODE="" - return - fi + if ! _enable_cuda_repo; then + NVIDIA_DRIVER_MODE="" + _msg "CUDA Repo — Error" "Failed to enable the official NVIDIA CUDA repository.\n\nNo NVIDIA driver was installed." 10 60 + return 1 fi if _install_nvidia_cuda_repo "$NVIDIA_SELECTED_VERSION"; then NVIDIA_DRIVER_MODE="cuda-repo" diff --git a/modules/gpu/nvidia.sh b/modules/gpu/nvidia.sh index 8ece0e5..394f8f2 100644 --- a/modules/gpu/nvidia.sh +++ b/modules/gpu/nvidia.sh @@ -1,64 +1,11 @@ #!/usr/bin/env bash -# NVIDIA GPU driver installation — 3-CASE dispatch +# NVIDIA GPU driver installation # # CASE A : Trixie + backports kernel → Official NVIDIA CUDA Repo (Pinned v590) -# CASE B : Bookworm + backports kernel → Debian backports (-t bookworm-backports) -# CASE C : Kernel stable (any distro) → Debian stable (optional backports) - -# --- DEPRECATED (Replaced by _install_nvidia_stack in gpu.sh) --- -install_nvidia_driver() { - echo -e "${YELLOW}NVIDIA GPU detected.${NC}" - NVIDIA_DRIVER_MODE="" - - local is_bpo_kernel; is_bpo_kernel=$(is_backports_kernel) - local nv_arch; nv_arch=$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID") - local is_kepler="false"; [[ "$nv_arch" == "legacy" ]] && _is_nvidia_kepler_id "$NVIDIA_GPU_DEVICE_ID" && is_kepler="true" - local is_maxwell; is_maxwell=$(is_nvidia_maxwell) - local is_pascal; is_pascal=$(is_nvidia_pascal) - local is_blackwell; is_blackwell=$(is_nvidia_blackwell) - - # ── Blackwell: v550 no soporta GB20x → CUDA repo v590 ── - if [ "$DEBIAN_CODENAME" = "trixie" ] && [ "$is_blackwell" = "true" ]; then - _msg "NVIDIA Blackwell" \ - "Your GPU is NVIDIA Blackwell architecture.\n\nDebian 13's nvidia-driver (v550) does not\nsupport Blackwell GPUs.\n\n\ -The script will enable the official NVIDIA CUDA\nrepository and install the v590 production branch,\nwhich fully supports Blackwell (GB20x)." 14 65 - _install_nvidia_cuda_repo - return - fi - - # ── Veto: Kepler en Trixie no tiene driver disponible ── - if [ "$is_kepler" = "true" ] && [ "$DEBIAN_CODENAME" = "trixie" ]; then - _msg "NVIDIA Kepler" \ - "Your GPU is NVIDIA Kepler architecture.\n\nThe nvidia-tesla-470 driver is not available\nin Debian 13 (Trixie).\n\nNo NVIDIA driver will be installed." 14 65 - return 1 - fi - - # ── Bloqueo: Maxwell/Pascal no son compatibles con v590 ── - if [ "$DEBIAN_CODENAME" = "trixie" ] && [ "$is_bpo_kernel" = "true" ]; then - if [ "$is_maxwell" = "true" ] || [ "$is_pascal" = "true" ]; then - local gpu_gen="Maxwell" - [ "$is_pascal" = "true" ] && gpu_gen="Pascal" - local block_msg="INCOMPATIBILITY DETECTED: Your NVIDIA ${gpu_gen} GPU\n" - block_msg+="is NOT supported by the modern v590 driver.\n\n" - block_msg+="To run NVIDIA safely on Debian 13 (Trixie), you MUST use\n" - block_msg+="the official Debian v550 driver, which requires the\n" - block_msg+="standard STABLE Kernel.\n\n" - block_msg+="The script will automatically downgrade your path to\n" - block_msg+="Stable Kernel mode for NVIDIA." - _msg "NVIDIA — Trixie + Backports" "$block_msg" 14 70 - is_bpo_kernel=false - fi - fi - - # ── Dispatch por casos ── - if [ "$DEBIAN_CODENAME" = "trixie" ] && [ "$is_bpo_kernel" = "true" ]; then - _install_nvidia_cuda_repo - elif [ "$DEBIAN_CODENAME" = "bookworm" ] && [ "$is_bpo_kernel" = "true" ]; then - _install_nvidia_bookworm_bpo - else - _install_nvidia_standard - fi -} +# CASE B : Kernel stable (any distro) → Debian stable +# +# Nota: Debian 12 (Bookworm) backports llegaron a EOL (2026-08-09); +# el flujo NVIDIA solo usa el repositorio estable para Debian 12. # ------------------------------------------------------------------- # Shared helper: enable NVIDIA CUDA repo @@ -272,10 +219,8 @@ _install_nvidia_cuda_repo() { warn+="the official NVIDIA CUDA repository.\n\n" warn+="Source: Official NVIDIA CUDA Repo\n" warn+="Driver: Production Branch v${ver} (unified metapackage)\n" - warn+="[+] nvidia-open (full 64-bit compute + graphics)\n" - warn+="[+] nvidia-kernel-dkms / nvidia-kernel-open-dkms (vía metapaquete)\n" - warn+="[+] firmware-nvidia-gsp\n" - warn+="[+] nvidia-driver-pinning-${ver} (if available)\n\n" + warn+="[+] nvidia-driver-pinning-${ver} (version lock)\n" + warn+="[+] nvidia-open (driver + open kernel modules)\n\n" warn+="Do you want to proceed at your own risk?" if ! _confirm_custom "NVIDIA Driver — v${ver}" "$warn" "Proceed" "Abort" 18 70; then @@ -298,18 +243,30 @@ _install_nvidia_cuda_repo() { return 1 fi - # Step 3: Pinning oficial de NVIDIA (instalar si existe; el repo no - # siempre lo publica). Su fallo no debe romper el flujo. - sudo apt install -y "nvidia-driver-pinning-${ver}" >/dev/null 2>&1 || true - - # Step 4: Instalar el metapaquete. Si falla, el error real de apt - # ya quedó visible arriba (output de _run_cmd) — no abortar antes - # de intentar la instalación. - if ! _run_cmd "NVIDIA CUDA" \ - "sudo apt install -y nvidia-open firmware-nvidia-gsp" \ - "Installing NVIDIA v${ver} production driver via unified metapackage..."; then + # Step 3: Pinning oficial — transacción APT INDEPENDIENTE y + # obligatoria. APT lee /etc/apt/preferences.d/ al inicio de su + # ejecución, no durante la transacción: el pinning debe estar + # instalado ANTES de instalar el driver. Si el repo no lo publica, + # es un problema del repo de NVIDIA: abortar limpiamente en vez de + # instalar una versión que el usuario no eligió. + if ! _run_cmd "NVIDIA Pinning" \ + "sudo apt install -y nvidia-driver-pinning-${ver}" \ + "Installing NVIDIA version pinning (${ver})..."; then NVIDIA_DRIVER_MODE="" - _msg "NVIDIA — Error" "NVIDIA v${ver} installation FAILED.\n\nCheck the apt error above.\n\nNo NVIDIA driver was installed." 10 60 + _msg "NVIDIA — Error" "Failed to install NVIDIA driver pinning ${ver}.\n\nNo NVIDIA driver was installed." 10 60 + return 1 + fi + + # Step 4: Instalar el metapaquete (pinning ya activo). Si falla, + # el pinning queda instalado (solo config, no es problema). + # firmware-nvidia-gsp llega como dependencia transitiva obligatoria + # (nvidia-open → nvidia-kernel-open-dkms → firmware-nvidia-gsp), + # alineado con la doc oficial: apt -V install nvidia-open. + if ! _run_cmd "NVIDIA CUDA" \ + "sudo apt install -y nvidia-open" \ + "Installing NVIDIA driver from CUDA repository..."; then + NVIDIA_DRIVER_MODE="" + _msg "NVIDIA — Error" "NVIDIA driver installation FAILED.\n\nNo NVIDIA driver was installed." 10 60 return 1 fi @@ -328,47 +285,6 @@ _install_nvidia_cuda_repo() { _verify_nvidia_dkms_build nvidia-kernel-open-dkms nvidia-kernel-dkms || true } -# ------------------------------------------------------------------- -# CASE B: Bookworm + Backports Kernel → Debian backports -# ------------------------------------------------------------------- -_install_nvidia_bookworm_bpo() { - local nv_pkg="" - local is_kepler - is_kepler=$(is_nvidia_kepler) - - if [ "$is_kepler" = "true" ]; then - nv_pkg="nvidia-tesla-470-driver" - else - # Backports de Bookworm solo tienen el módulo cerrado - nv_pkg="nvidia-driver" - fi - - local nv_ver - nv_ver=$(apt-cache policy "$nv_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}') || true - local msg="Source: Debian Bookworm-Backports\n" - msg+="NVIDIA Driver: ${nv_pkg} ${nv_ver:-unknown}\n" - msg+=" (Compatible with Kernel v6.12+)\n" - msg+="[+] firmware-misc-nonfree\n" - msg+="[+] nvidia-vaapi-driver" - - if ! _confirm "NVIDIA Driver — Backports" "$msg" 14 70; then - echo "Skipping NVIDIA driver installation." - return 0 - fi - - if ! _run_cmd "NVIDIA" "sudo apt install -y -t bookworm-backports $nv_pkg firmware-misc-nonfree nvidia-vaapi-driver" \ - "Installing NVIDIA driver from backports..."; then - NVIDIA_DRIVER_MODE="" - _msg "NVIDIA — Error" "NVIDIA backports installation FAILED.\n\nNo NVIDIA driver was installed." 10 60 - return 1 - fi - - NVIDIA_DRIVER_MODE="backports" - echo -e "${GREEN}NVIDIA driver installed from backports. Reboot required.${NC}" - - _verify_nvidia_dkms_build nvidia-kernel-dkms nvidia-tesla-470-kernel-dkms || true -} - # ------------------------------------------------------------------- # Bookworm Kepler intercepción — fuerza nvidia-legacy-470xx-driver # ------------------------------------------------------------------- @@ -404,27 +320,6 @@ _install_nvidia_bookworm_kepler() { return 1 fi - # Si backports está habilitado, ofrecer actualización - if [ "$(is_backports_enabled)" == "true" ]; then - local bpo_ver - bpo_ver=$(apt-cache madison "$nv_pkg" 2>/dev/null | \ - grep "bookworm-backports" | awk '{print $3}' | head -1) || true - if [ -n "$bpo_ver" ]; then - local msg="Hay una versión en backports: ${bpo_ver}\n" - msg+="Instalar desde bookworm-backports?" - if _confirm "Kepler Backports" "$msg"; then - if _run_cmd "NVIDIA Kepler" \ - "sudo apt install -y -t bookworm-backports $nv_pkg" \ - "Actualizando Kepler driver desde backports..."; then - NVIDIA_DRIVER_MODE="backports" - echo -e "${GREEN}Kepler driver actualizado desde backports.${NC}" - else - echo -e "${RED}Kepler backports upgrade failed — keeping the stable version.${NC}" - fi - fi - fi - fi - NVIDIA_DRIVER_MODE="${NVIDIA_DRIVER_MODE:-stable}" echo -e "${GREEN}Kepler driver (${nv_pkg}) installed. Reboot required.${NC}" @@ -432,7 +327,7 @@ _install_nvidia_bookworm_kepler() { } # ------------------------------------------------------------------- -# CASE C: Kernel stable (any distro) → Debian stable +# CASE B: Kernel stable (any distro) → Debian stable # ------------------------------------------------------------------- _install_nvidia_standard() { # --- 1. ARQUITECTURA → MÓDULO KERNEL --- diff --git a/modules/utils.sh b/modules/utils.sh index 8d6eca1..a52e9aa 100644 --- a/modules/utils.sh +++ b/modules/utils.sh @@ -492,6 +492,9 @@ get_intel_generation() { # ---------------------------------------------------------------------- # Check if backports repository is enabled (active line without #) +# Nota: el flujo NVIDIA Debian 12 (Bookworm) ya NO usa esta función +# (backports EOL 2026-08-09). Sigue activa para kernels, desktop/greetd, +# gaming, audio, comunicación y Mesa (AMD/Intel). # ---------------------------------------------------------------------- is_backports_enabled() { local codename="${DEBIAN_CODENAME:-}"