mirror of
https://github.com/stornic56/debianito-post-install.git
synced 2026-09-14 06:02:35 +00:00
nvidia & zram fixes
- Fixed critical NVIDIA driver bug on Debian 13 (Trixie) where repo configuration installed v550 instead of selected v595. Implemented version-specific enabling: cuda-keyring for Trixie, extrepo for Bookworm. Added explicit apt update after repo enable and candidate verification before pinning checks to abort cleanly if expected driver unavailable. - Rewrote `_install_nvidia_standard()` with auto-detected architecture via `_get_nvidia_arch_family()`. Turing/Ampere/Ada/Blackwell → nvidia-open-kernel-dkms (open module); Maxwell/Pascal/Volta/unknown/empty → nvidia-kernel-dkms (closed, safe fallback). Removed all `nvidia-detect` references across modules and docs. - Fixed `_install_nvidia_cuda_repo()` to use correct CUDA repository package names: v590/v595 → nvidia-open metapackage (includes nvidia-kernel-open-dkms); v550 and below → nvidia-driver. Added dynamic warning message based on installed module type. - Fixed uninitialized variable bug in `modules/gaming/tools.sh` causing script abortion under `set -u`. Initialized all local variables (`deb_url`, `sha256`, `json`, `deb_suffix`) with default values and added defensive initialization for `$USER` environment variable. - Fixed ZRAM configuration persistence bug where old config persisted after changes. Added device reset sequence (swapoff + modprobe -r) before writing new config, post-config verification check, and changed default recommendation from 50% to 25% for systems with >16GB RAM. - Added `_warn_nvidia_gnome_wayland()` function in `gpu.sh` to warn about Debian bug #1109409 (GDM3 + NVIDIA + Wayland black screen issue). Warning displays only when gdm3 present, GNOME Shell 4.x detected, and NVIDIA driver installed. - Standardized menu headers across all modules using centralized SCROLL_HINT variable, replacing hardcoded strings with uniform Whiptail instructions. Updated documentation for cuda-keyring (Trixie) and ZRAM configuration flow diagrams.
This commit is contained in:
+2
-2
@@ -175,7 +175,7 @@ The NVIDIA driver installation process is inherently complex due to proprietary
|
||||
#### **Blackwell Architecture & CUDA v590**
|
||||
- **Detection**: `_helpers.sh` function `is_nvidia_blackwell()` identifies GPUs via PCI IDs `10de:24xx`, `0x2900–0x29BF`, and `0x2B80–0x31FF`.
|
||||
- **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).
|
||||
- **Extrepo Mechanism**: Enables `nvidia-cuda` repository via `extrepo`, creates APT pinning in `/etc/apt/preferences.d/block-nvidia` to lock to version `590.*`, and installs `nvidia-driver-pinning-590`, `nvidia-driver`, and `firmware-nvidia-gsp`.
|
||||
- **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.
|
||||
|
||||
#### **Installation Flow**
|
||||
```bash
|
||||
@@ -212,7 +212,7 @@ Depending on your GPU generation and your Debian ecosystem, you must select the
|
||||
* **Blackwell (RTX 5000)**: Not officially supported by standard Debian drivers yet. The script provides a path to the Enterprise Repo for users who need this hardware to function immediately.
|
||||
|
||||
#### **Kepler Interception in Bookworm:**
|
||||
When Kepler is detected on Bookworm, `nvidia.sh` bypasses `nvidia-detect` (which might recommend v535) and forces installation of `nvidia-tesla-470-driver`:
|
||||
When Kepler is detected on Bookworm, `nvidia.sh` forces installation of `nvidia-tesla-470-driver` (the modern v535/v550 branches do not support Kepler):
|
||||
```bash
|
||||
if [ "$is_kepler" = "true" ] && [ "$DEBIAN_CODENAME" = "bookworm" ]; then
|
||||
nv_pkg="nvidia-tesla-470-driver"
|
||||
|
||||
+33
-12
@@ -74,10 +74,11 @@ The script follows a deterministic flow to ensure safe, reproducible configurati
|
||||
│ │
|
||||
│ 3. Size Calculation Logic │
|
||||
│ ┌──────────────────────────────────────────────┐ │
|
||||
│ │ half_ram_mb = ((RAM_KB / 1024 / 1024 + 1) │ │
|
||||
│ │ / 2) * 1024 │ │
|
||||
│ │ ram_gb > 16 ? 25% : 50% of total RAM │ │
|
||||
│ │ recommended_mb = ((RAM_KB/1024/1024 + 1) │ │
|
||||
│ │ / (ram_gb > 16 ? 4 : 2)) │ │
|
||||
│ └──────────────────────────────────────────────┘ │
|
||||
│ └─ Result: ~50% of total physical RAM in MB │
|
||||
│ └─ Result: ~25% RAM if > 16 GB, else ~50% in MB │
|
||||
│ │
|
||||
│ 4. Configuration Confirmation │
|
||||
│ ├─ Display summary with algorithm, size, priority=100 │
|
||||
@@ -86,14 +87,21 @@ The script follows a deterministic flow to ensure safe, reproducible configurati
|
||||
│ 5. Package Installation │
|
||||
│ sudo apt install -y zram-tools │
|
||||
│ │
|
||||
│ 6. Configuration File Write │
|
||||
│ 6. Reset Existing ZRAM Device │
|
||||
│ sudo swapoff /dev/zram0 (ignore errors) │
|
||||
│ sudo modprobe -r zram (ignore errors) │
|
||||
│ └─ Guarantees the old device is released before │
|
||||
│ applying the new configuration │
|
||||
│ │
|
||||
│ 7. Configuration File Write │
|
||||
│ /etc/default/zramswap │
|
||||
│ ALGO=$algo │
|
||||
│ SIZE=$zram_size │
|
||||
│ PRIORITY=100 │
|
||||
│ │
|
||||
│ 7. Service Restart │
|
||||
│ 8. Service Restart │
|
||||
│ sudo systemctl restart zramswap │
|
||||
│ └─ Verify: comp_algorithm shows [algo]; sudo zramctl │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
@@ -102,24 +110,37 @@ The script follows a deterministic flow to ensure safe, reproducible configurati
|
||||
The script uses this formula to determine ZRAM size:
|
||||
|
||||
```bash
|
||||
half_ram_mb=$(( ((RAM_KB / 1024 / 1024 + 1) / 2) * 1024 ))
|
||||
ram_gb=$(( RAM_KB / 1024 / 1024 ))
|
||||
if [ "$ram_gb" -gt 16 ]; then
|
||||
recommended_mb=$(( ((RAM_KB / 1024 / 1024 + 1) / 4) * 1024 ))
|
||||
else
|
||||
recommended_mb=$(( ((RAM_KB / 1024 / 1024 + 1) / 2) * 1024 ))
|
||||
fi
|
||||
```
|
||||
|
||||
**Breakdown:**
|
||||
- `RAM_KB`: Total RAM in kilobytes from `/proc/meminfo`
|
||||
- `/ 1024 / 1024`: Convert KB to MB
|
||||
- `+ 1`: Add rounding buffer for odd values
|
||||
- `/ 2`: Target approximately 50% of total RAM
|
||||
- `/ 4`: Target 25% of total RAM on systems with more than 16 GB (avoids excessive RAM reservation on high-memory machines)
|
||||
- `/ 2`: Target 50% of total RAM on systems with 16 GB or less
|
||||
- `* 1024`: Round back to nearest MB
|
||||
|
||||
**Example:**
|
||||
**Examples:**
|
||||
```
|
||||
System with 8 GB (8388608 KB) RAM:
|
||||
half_ram_mb = ((8388608 / 1024 / 1024 + 1) / 2) * 1024
|
||||
System with 32 GB (33554432 KB) RAM (>16 GB):
|
||||
recommended_mb = ((33554432 / 1024 / 1024 + 1) / 4) * 1024
|
||||
= ((32 + 1) / 4) * 1024
|
||||
= (33 / 4) * 1024
|
||||
= 8 * 1024
|
||||
= 8192 MB (8 GB)
|
||||
|
||||
System with 8 GB (8388608 KB) RAM (<=16 GB):
|
||||
recommended_mb = ((8388608 / 1024 / 1024 + 1) / 2) * 1024
|
||||
= ((8 + 1) / 2) * 1024
|
||||
= (9 / 2) * 1024
|
||||
= 4.5 * 1024
|
||||
= 4608 MB (~4.5 GB)
|
||||
= 4 * 1024
|
||||
= 4096 MB (4 GB)
|
||||
```
|
||||
|
||||
### Priority Configuration (`PRIORITY=100`)
|
||||
|
||||
@@ -26,7 +26,7 @@ install_lutris() {
|
||||
}
|
||||
|
||||
install_openrgb() {
|
||||
local deb_suffix
|
||||
local deb_suffix=""
|
||||
case "$DEBIAN_CODENAME" in
|
||||
bookworm) deb_suffix="bookworm" ;;
|
||||
trixie) deb_suffix="trixie" ;;
|
||||
@@ -41,14 +41,14 @@ install_openrgb() {
|
||||
|
||||
_run_cmd "OpenRGB" "sudo apt install -y curl jq" "Installing dependencies..."
|
||||
|
||||
local json
|
||||
local json=""
|
||||
json=$(curl -s --connect-timeout 10 \
|
||||
"https://codeberg.org/api/v1/repos/OpenRGB/OpenRGB/releases?limit=1") || {
|
||||
echo -e "${RED}Could not fetch OpenRGB releases from Codeberg API.${NC}"
|
||||
return 1
|
||||
}
|
||||
|
||||
local deb_url sha256
|
||||
local deb_url="" sha256=""
|
||||
while IFS=' ' read -r url hash; do
|
||||
deb_url="$url"
|
||||
sha256="$hash"
|
||||
@@ -87,7 +87,7 @@ install_openrgb() {
|
||||
if ! grep -q "^i2c-dev" /etc/modules 2>/dev/null; then
|
||||
echo "i2c-dev" | sudo tee -a /etc/modules >/dev/null
|
||||
fi
|
||||
sudo usermod -aG i2c "$USER"
|
||||
sudo usermod -aG i2c "${USER:-}"
|
||||
sudo udevadm control --reload-rules && sudo udevadm trigger
|
||||
sudo setcap cap_sys_rawio=ep /usr/bin/openrgb 2>/dev/null || true
|
||||
|
||||
|
||||
+20
-4
@@ -11,6 +11,21 @@ NVIDIA_DRIVER_MODE=""
|
||||
# Set by _show_nvidia_version_menu(): "470" | "535" | "550" | "590" | "595" | "auto"
|
||||
NVIDIA_SELECTED_VERSION=""
|
||||
|
||||
# Aviso informativo post-instalación NVIDIA: Debian bug #1109409
|
||||
# (GDM3 + NVIDIA + Wayland → pantalla negra). Solo informa, nunca
|
||||
# cambia configuración de GDM3 ni aborta la instalación.
|
||||
_warn_nvidia_gnome_wayland() {
|
||||
command -v gdm3 &>/dev/null || return 0
|
||||
gnome-shell --version 2>/dev/null | grep -qi "shell 4[0-9]" || return 0
|
||||
case "$NVIDIA_DRIVER_MODE" in
|
||||
stable|backports|cuda-repo|extrepo) ;;
|
||||
*) return 0 ;;
|
||||
esac
|
||||
echo -e "${YELLOW}WARNING: Debian bug #1109409 may affect GDM3 + NVIDIA + Wayland.${NC}"
|
||||
echo -e "${YELLOW}If you see a black screen after reboot, select 'GNOME on Xorg' at login.${NC}"
|
||||
echo -e "${YELLOW}Or temporarily disable Wayland: sudo nano /etc/gdm3/daemon.conf${NC}"
|
||||
}
|
||||
|
||||
_install_amd_intel_stack() {
|
||||
if [ "$GPU_TYPE" = "unknown" ] || [ -z "$GPU_TYPE" ]; then
|
||||
local mesa_pkgs=(mesa-vulkan-drivers libgl1-mesa-dri libglx-mesa0 libegl-mesa0 mesa-va-drivers)
|
||||
@@ -238,8 +253,8 @@ Forcing the stable driver path." 14 70
|
||||
_install_nvidia_standard
|
||||
fi
|
||||
;;
|
||||
turing|ampere|ada)
|
||||
_install_nvidia_standard open
|
||||
turing|ampere|ada|blackwell)
|
||||
_install_nvidia_standard
|
||||
;;
|
||||
*)
|
||||
if [ "$(is_backports_kernel)" = "true" ]; then
|
||||
@@ -265,14 +280,14 @@ No NVIDIA driver will be installed." 14 65
|
||||
if ! _is_cuda_repo_ready; then
|
||||
if ! _confirm "CUDA Repository" \
|
||||
"The official NVIDIA CUDA repository is not enabled.\n\n\
|
||||
Enable it now via extrepo? (Required for NVIDIA v${NVIDIA_SELECTED_VERSION}.)"; then
|
||||
Enable it now? (Required for NVIDIA v${NVIDIA_SELECTED_VERSION}.)"; then
|
||||
echo "Skipping NVIDIA driver installation."
|
||||
NVIDIA_DRIVER_MODE=""
|
||||
return
|
||||
fi
|
||||
fi
|
||||
if _install_nvidia_cuda_repo "$NVIDIA_SELECTED_VERSION"; then
|
||||
NVIDIA_DRIVER_MODE="extrepo"
|
||||
NVIDIA_DRIVER_MODE="cuda-repo"
|
||||
else
|
||||
NVIDIA_DRIVER_MODE=""
|
||||
fi
|
||||
@@ -293,6 +308,7 @@ Enable it now via extrepo? (Required for NVIDIA v${NVIDIA_SELECTED_VERSION}.)";
|
||||
echo -e "If not found, ensure BIOS boots on iGPU and nvidia-drm is loaded."
|
||||
fi
|
||||
offer_generic_tools
|
||||
_warn_nvidia_gnome_wayland
|
||||
local summary="NVIDIA: ${NVIDIA_DRIVER_MODE}\n"
|
||||
summary+="Tools: nvtop + vainfo"
|
||||
_msg "NVIDIA Stack — Complete" "$summary" 10 55
|
||||
|
||||
+75
-89
@@ -61,17 +61,41 @@ The script will enable the official NVIDIA CUDA\nrepository and install the v590
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Shared helper: enable NVIDIA CUDA repo via extrepo
|
||||
# Shared helper: enable NVIDIA CUDA repo
|
||||
# Debian 13 (Trixie): cuda-keyring (método oficial — extrepo roto)
|
||||
# Debian 12 (Bookworm): extrepo nvidia-cuda (funciona)
|
||||
# -------------------------------------------------------------------
|
||||
_enable_cuda_repo() {
|
||||
if ! _is_cuda_repo_ready; then
|
||||
_is_cuda_repo_ready && return 0
|
||||
|
||||
if [ "$DEBIAN_VERSION" = "13" ]; then
|
||||
# Método oficial NVIDIA: cuda-keyring (extrepo no configura
|
||||
# correctamente el repo en Trixie)
|
||||
if dpkg -s cuda-keyring &>/dev/null; then
|
||||
return 0 # ya instalado → su .list ya existe
|
||||
fi
|
||||
if ! wget -q "https://developer.download.nvidia.com/compute/cuda/repos/debian13/x86_64/cuda-keyring_1.1-1_all.deb" \
|
||||
-O /tmp/cuda-keyring.deb; then
|
||||
rm -f /tmp/cuda-keyring.deb
|
||||
_msg "CUDA Repo — Error" "Failed to download cuda-keyring.\n\nNo NVIDIA driver was installed." 10 60
|
||||
return 1
|
||||
fi
|
||||
if ! sudo dpkg -i /tmp/cuda-keyring.deb; then
|
||||
rm -f /tmp/cuda-keyring.deb
|
||||
_msg "CUDA Repo — Error" "Failed to install cuda-keyring.\n\nNo NVIDIA driver was installed." 10 60
|
||||
return 1
|
||||
fi
|
||||
rm -f /tmp/cuda-keyring.deb
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Debian 12 (y otros): extrepo nvidia-cuda
|
||||
if ! command -v extrepo &>/dev/null; then
|
||||
_run_cmd "extrepo" "sudo apt install -y extrepo" "Installing extrepo..." || return 1
|
||||
fi
|
||||
_run_cmd "CUDA Repo" \
|
||||
"sudo extrepo enable nvidia-cuda" \
|
||||
"Enabling official NVIDIA CUDA repository..." || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
@@ -244,11 +268,15 @@ _configure_nvidia_wayland() {
|
||||
# -------------------------------------------------------------------
|
||||
_install_nvidia_cuda_repo() {
|
||||
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"
|
||||
warn+="the official NVIDIA CUDA repository.\n\n"
|
||||
warn+="Source: Official NVIDIA CUDA Repo (Pinned v${ver}.*)\n"
|
||||
warn+="Driver: Production Branch v${ver} (unified metapackage)\n"
|
||||
warn+="[+] nvidia-driver (full 64-bit compute + graphics)\n"
|
||||
warn+="[+] ${meta} (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"
|
||||
@@ -266,7 +294,27 @@ _install_nvidia_cuda_repo() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Step 2: Create APT pinning to lock to the selected branch
|
||||
# Step 2: apt update explícito — sin índice actualizado el repo no
|
||||
# se ve y apt resolvería el candidato Debian (v550) en vez de v${ver}.
|
||||
if ! _run_cmd "CUDA Repo" "sudo apt update" \
|
||||
"Updating package lists after enabling CUDA repository..."; then
|
||||
NVIDIA_DRIVER_MODE=""
|
||||
_msg "CUDA Repo — Error" "Failed to update APT after enabling CUDA repo.\n\nNo NVIDIA driver was installed." 10 60
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Step 3: Verificar que el candidato coincide con la rama pedida.
|
||||
# Defensa en profundidad: si el repo no tiene la versión esperada,
|
||||
# abortar limpiamente en vez de instalar una versión incorrecta.
|
||||
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
|
||||
if ! _run_cmd "APT Pinning" \
|
||||
"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" \
|
||||
"Creating APT pinning to lock NVIDIA to v${ver} branch..."; then
|
||||
@@ -274,9 +322,9 @@ _install_nvidia_cuda_repo() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Step 3: Install NVIDIA unified metapackages (driver pinning)
|
||||
# Step 5: Install NVIDIA unified metapackages (driver pinning)
|
||||
local pin_meta="nvidia-driver-pinning-${ver}"
|
||||
local install_cmd="nvidia-driver firmware-nvidia-gsp"
|
||||
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
|
||||
@@ -316,26 +364,8 @@ _install_nvidia_bookworm_bpo() {
|
||||
if [ "$is_kepler" = "true" ]; then
|
||||
nv_pkg="nvidia-tesla-470-driver"
|
||||
else
|
||||
local nd_ver
|
||||
nd_ver=$(apt-cache policy nvidia-detect 2>/dev/null | awk 'NR==3 {print $2; exit}') || true
|
||||
if _confirm "NVIDIA Detect" "Install nvidia-detect to determine the correct driver?\n\n nvidia-detect ${nd_ver:-unknown}" 12 70; then
|
||||
_run_cmd "NVIDIA" "sudo apt install -y nvidia-detect" "Installing nvidia-detect..."
|
||||
else
|
||||
echo "Skipping NVIDIA driver detection."
|
||||
NVIDIA_DRIVER_MODE=""
|
||||
return 0
|
||||
fi
|
||||
local recommended
|
||||
recommended=$(nvidia-detect 2>/dev/null | grep -oP 'nvidia[\w-]+(?= package)') || true
|
||||
if [ -z "$recommended" ]; then
|
||||
echo -e "${RED}nvidia-detect could not determine a suitable driver.${NC}"
|
||||
return 1
|
||||
fi
|
||||
if [[ "$recommended" =~ legacy-390|legacy-340 ]]; then
|
||||
echo -e "${RED}Your GPU requires $recommended, which is not available.${NC}"
|
||||
return 1
|
||||
fi
|
||||
nv_pkg="$recommended"
|
||||
# Backports de Bookworm solo tienen el módulo cerrado
|
||||
nv_pkg="nvidia-driver"
|
||||
fi
|
||||
|
||||
local nv_ver
|
||||
@@ -366,7 +396,6 @@ _install_nvidia_bookworm_bpo() {
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Bookworm Kepler intercepción — fuerza nvidia-legacy-470xx-driver
|
||||
# sin pasar por nvidia-detect (evita falsa recomendación rama 535)
|
||||
# -------------------------------------------------------------------
|
||||
_install_nvidia_bookworm_kepler() {
|
||||
local nv_pkg="nvidia-tesla-470-driver"
|
||||
@@ -380,7 +409,6 @@ _install_nvidia_bookworm_kepler() {
|
||||
msg+="en lugar del moderno. Se usará el paquete:\n"
|
||||
msg+=" ${nv_pkg} ${nv_ver:-unknown}\n"
|
||||
msg+="para evitar fallos de pantalla negra.\n\n"
|
||||
msg+=" [SKIP] nvidia-detect (omitido — evita rama 535)\n"
|
||||
msg+=" [USE] ${nv_pkg}\n"
|
||||
msg+=" [+] linux-headers-amd64\n"
|
||||
msg+=" [+] firmware-misc-nonfree\n"
|
||||
@@ -429,61 +457,33 @@ _install_nvidia_bookworm_kepler() {
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# CASE C: Kernel stable (any distro) → Debian stable, optional backports
|
||||
# CASE C: Kernel stable (any distro) → Debian stable
|
||||
# -------------------------------------------------------------------
|
||||
_install_nvidia_standard() {
|
||||
# --- 1. DETERMINAR PAQUETES BASADO EN LA SEÑAL ---
|
||||
# $1 = modo solicitado por el dispatcher ("open" para 550+Turing+);
|
||||
# si no se pasa, se usa NVIDIA_DRIVER_MODE o auto-detección.
|
||||
local requested_mode="${1:-${NVIDIA_DRIVER_MODE:-auto}}"
|
||||
local nv_pkg="nvidia-driver"
|
||||
local kernel_pkg=""
|
||||
local use_bpo=false
|
||||
|
||||
case "$requested_mode" in
|
||||
open)
|
||||
kernel_pkg="nvidia-open-kernel-dkms"
|
||||
;;
|
||||
classic|stable|backports)
|
||||
kernel_pkg="nvidia-kernel-dkms"
|
||||
;;
|
||||
auto)
|
||||
kernel_pkg="$(nvidia-detect 2>/dev/null | grep -oP 'nvidia-kernel-dkms' || echo "")"
|
||||
[ -z "$kernel_pkg" ] && kernel_pkg="nvidia-kernel-dkms"
|
||||
;;
|
||||
# --- 1. ARQUITECTURA → MÓDULO KERNEL ---
|
||||
# Solo Turing+ (conocido) usa el módulo abierto. Arquitectura
|
||||
# unknown/vacía o antigua (Kepler/Fermi/Maxwell/Pascal/Volta) →
|
||||
# módulo cerrado como fallback seguro.
|
||||
local fam
|
||||
fam=$(_get_nvidia_arch_family)
|
||||
local kernel_pkg="nvidia-kernel-dkms"
|
||||
case "$fam" in
|
||||
turing|ampere|ada|blackwell) kernel_pkg="nvidia-open-kernel-dkms" ;;
|
||||
esac
|
||||
|
||||
# --- 2. DIÁLOGO DE BACKPORTS ---
|
||||
if [ "$(is_backports_enabled)" == "true" ] && [ "${NVIDIA_DRIVER_MODE:-auto}" != "stable" ]; then
|
||||
local stable_nv_ver bpo_nv_ver msg
|
||||
stable_nv_ver=$(apt-cache policy "$nv_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}') || true
|
||||
bpo_nv_ver=$(apt-cache madison "$nv_pkg" 2>/dev/null | grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1) || true
|
||||
|
||||
if [ -n "$bpo_nv_ver" ]; then
|
||||
msg="Source: Debian ${DEBIAN_CODENAME^} (Backports available)\n"
|
||||
msg+="NVIDIA Driver: ${nv_pkg}\n\n"
|
||||
msg+=" Backports: ${bpo_nv_ver}\n"
|
||||
msg+=" Stable: ${stable_nv_ver:-unknown}\n\n"
|
||||
msg+="Choose version:"
|
||||
if _confirm_custom "NVIDIA Driver" "$msg" "Backports" "Stable" 14 70; then
|
||||
use_bpo=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# --- 2. PAQUETES — UN SOLO apt install ---
|
||||
local extra_pkgs="linux-headers-amd64 nvidia-driver firmware-nvidia-gsp nvidia-vaapi-driver"
|
||||
[ "$DEBIAN_VERSION" = "12" ] && extra_pkgs+=" mesa-vdpau-drivers"
|
||||
local install_pkgs="$kernel_pkg $extra_pkgs"
|
||||
|
||||
# --- 3. MENSAJE DE CONFIRMACIÓN ---
|
||||
local src_label="Debian ${DEBIAN_CODENAME^} Stable"
|
||||
$use_bpo && src_label="Debian ${DEBIAN_CODENAME^}-Backports"
|
||||
|
||||
local stable_nv_ver kernel_ver msg
|
||||
stable_nv_ver=$(apt-cache policy "$nv_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}') || true
|
||||
local kernel_ver msg
|
||||
kernel_ver=$(apt-cache policy "$kernel_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}') || true
|
||||
|
||||
msg="Source: ${src_label}\n"
|
||||
msg+="NVIDIA Driver: ${nv_pkg} ${stable_nv_ver:-unknown}\n"
|
||||
msg+="Kernel Module: ${kernel_pkg} ${kernel_ver:-unknown}\n"
|
||||
msg="Source: Debian ${DEBIAN_CODENAME^} Stable\n"
|
||||
msg+="Kernel Module: ${kernel_pkg} ${kernel_ver:-unknown} (arch: ${fam:-unknown})\n"
|
||||
msg+="[+] linux-headers-amd64\n"
|
||||
msg+="[+] firmware-misc-nonfree (o firmware-nvidia-gsp en Trixie)\n"
|
||||
msg+="[+] firmware-nvidia-gsp\n"
|
||||
msg+="[+] nvidia-vaapi-driver"
|
||||
[ "$DEBIAN_VERSION" = "12" ] && msg+="\n[+] mesa-vdpau-drivers"
|
||||
|
||||
@@ -493,19 +493,6 @@ _install_nvidia_standard() {
|
||||
fi
|
||||
|
||||
# --- 4. EJECUCIÓN ---
|
||||
local extra_pkgs="linux-headers-amd64 firmware-misc-nonfree nvidia-vaapi-driver"
|
||||
[ "$DEBIAN_VERSION" = "12" ] && extra_pkgs+=" mesa-vdpau-drivers"
|
||||
local install_pkgs="$kernel_pkg $nv_pkg $extra_pkgs"
|
||||
|
||||
if $use_bpo; then
|
||||
if ! _run_cmd "NVIDIA" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports $install_pkgs" \
|
||||
"Installing NVIDIA driver from backports..."; then
|
||||
NVIDIA_DRIVER_MODE=""
|
||||
_msg "NVIDIA — Error" "NVIDIA driver installation from backports FAILED.\n\nNo NVIDIA driver was installed." 10 60
|
||||
return 1
|
||||
fi
|
||||
NVIDIA_DRIVER_MODE="backports"
|
||||
else
|
||||
if ! _run_cmd "NVIDIA" "sudo apt install -y $install_pkgs" \
|
||||
"Installing NVIDIA driver from stable..."; then
|
||||
NVIDIA_DRIVER_MODE=""
|
||||
@@ -513,7 +500,6 @@ _install_nvidia_standard() {
|
||||
return 1
|
||||
fi
|
||||
NVIDIA_DRIVER_MODE="stable"
|
||||
fi
|
||||
|
||||
# Fix obligatorio para Debian 12 con módulo abierto
|
||||
if [ "$DEBIAN_VERSION" = "12" ] && [[ "$kernel_pkg" == *"open"* ]]; then
|
||||
|
||||
+22
-4
@@ -85,7 +85,13 @@ _zram_create() {
|
||||
fi
|
||||
fi
|
||||
|
||||
local half_ram_mb=$(( ((RAM_KB / 1024 / 1024 + 1) / 2) * 1024 ))
|
||||
local ram_gb=$(( RAM_KB / 1024 / 1024 ))
|
||||
local recommended_mb
|
||||
if [ "$ram_gb" -gt 16 ]; then
|
||||
recommended_mb=$(( ((RAM_KB / 1024 / 1024 + 1) / 4) * 1024 ))
|
||||
else
|
||||
recommended_mb=$(( ((RAM_KB / 1024 / 1024 + 1) / 2) * 1024 ))
|
||||
fi
|
||||
|
||||
local algo
|
||||
algo=$(_menu "ZRAM Configuration" \
|
||||
@@ -100,10 +106,10 @@ _zram_create() {
|
||||
fi
|
||||
|
||||
local zram_size
|
||||
if _confirm "ZRAM Size" "Use recommended size for ZRAM? (${half_ram_mb} MB out of ${RAM_SUMMARY})"; then
|
||||
zram_size=$half_ram_mb
|
||||
if _confirm "ZRAM Size" "Use recommended size for ZRAM? (${recommended_mb} MB out of ${RAM_SUMMARY})"; then
|
||||
zram_size=$recommended_mb
|
||||
else
|
||||
zram_size=$(_inputbox "ZRAM Size" "Enter ZRAM size in MB:" 8 60 "$half_ram_mb")
|
||||
zram_size=$(_inputbox "ZRAM Size" "Enter ZRAM size in MB:" 8 60 "$recommended_mb")
|
||||
if [ -z "$zram_size" ] || ! [[ "$zram_size" =~ ^[0-9]+$ ]] || [ "$zram_size" -eq 0 ]; then
|
||||
echo "ZRAM configuration cancelled."
|
||||
return
|
||||
@@ -117,6 +123,10 @@ _zram_create() {
|
||||
|
||||
_run_cmd "ZRAM" "sudo apt install -y zram-tools" "Installing zram-tools..."
|
||||
|
||||
echo "Resetting existing ZRAM device..."
|
||||
sudo swapoff /dev/zram0 2>/dev/null || true
|
||||
sudo modprobe -r zram 2>/dev/null || true
|
||||
|
||||
echo "Writing configuration..."
|
||||
sudo tee /etc/default/zramswap > /dev/null <<EOF
|
||||
ALGO=$algo
|
||||
@@ -127,6 +137,10 @@ EOF
|
||||
echo "Restarting zramswap service..."
|
||||
sudo systemctl restart zramswap
|
||||
|
||||
if ! grep -q "\[${algo}\]" /sys/block/zram0/comp_algorithm 2>/dev/null; then
|
||||
echo -e "${YELLOW}Warning: ZRAM algorithm not applied yet. Reboot to finalize.${NC}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}ZRAM configured successfully.${NC}"
|
||||
echo ""
|
||||
@@ -151,6 +165,10 @@ _zram_remove() {
|
||||
echo "Stopping zramswap service..."
|
||||
sudo systemctl stop zramswap || true
|
||||
|
||||
echo "Releasing ZRAM device..."
|
||||
sudo swapoff /dev/zram0 2>/dev/null || true
|
||||
sudo modprobe -r zram 2>/dev/null || true
|
||||
|
||||
_run_cmd "ZRAM" "sudo apt purge -y zram-tools" "Purging zram-tools..."
|
||||
|
||||
echo "Removing configuration..."
|
||||
|
||||
Reference in New Issue
Block a user