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:
stornic56
2026-08-05 21:13:32 -05:00
committed by GitHub
parent 0ec9639030
commit 59c93ba459
6 changed files with 168 additions and 127 deletions
+35 -14
View File
@@ -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
= ((8 + 1) / 2) * 1024
= (9 / 2) * 1024
= 4.5 * 1024
= 4608 MB (~4.5 GB)
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 * 1024
= 4096 MB (4 GB)
```
### Priority Configuration (`PRIORITY=100`)