Version initiale stable: driver Ubuntu 580-open + CUDA 12.8 + pinning APT
This commit is contained in:
commit
e1dace42bd
8 changed files with 479 additions and 0 deletions
9
Makefile
Normal file
9
Makefile
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
.PHONY: install check
|
||||
|
||||
install:
|
||||
sudo ./install.sh
|
||||
|
||||
check:
|
||||
apt-cache policy libnvidia-gl-580 libnvidia-egl-gbm1 nvidia-driver-580-open nvidia-utils-580 | sed -n '1,220p'
|
||||
bash -lc 'source /etc/profile.d/cuda-12-8.sh; which nvcc; nvcc --version'
|
||||
nvidia-smi
|
||||
98
README.md
Normal file
98
README.md
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
# Ubuntu 24.04.x + RTX 5070 Ti — Setup stable (Driver Ubuntu 580-open + CUDA 12.8)
|
||||
|
||||
## Objectif
|
||||
|
||||
Obtenir un environnement reproductible, maintenable par APT, et résistant aux régressions :
|
||||
|
||||
- Driver NVIDIA provenant d’Ubuntu (stack cohérent avec le kernel Ubuntu)
|
||||
- `nvidia-driver-580-open`
|
||||
- `linux-modules-nvidia-580-open-$(uname -r)`
|
||||
- `libnvidia-gl-580`
|
||||
- `nvidia-utils-580`
|
||||
- CUDA Toolkit provenant du dépôt NVIDIA
|
||||
- `cuda-toolkit-12-8` → `/usr/local/cuda-12.8`
|
||||
- Protection APT (pinning)
|
||||
- Empêche le dépôt CUDA NVIDIA de remplacer `nvidia-*` / `libnvidia-*` lors d’un `apt upgrade`
|
||||
- Évite notamment le conflit `libnvidia-gl-580` ↔ `libnvidia-egl-gbm1`
|
||||
|
||||
## Prérequis
|
||||
|
||||
- Ubuntu 24.04.x (testé avec 24.04.3 LTS)
|
||||
- Accès Internet
|
||||
- `sudo`
|
||||
- Recommandé : Secure Boot OFF
|
||||
|
||||
## Procédure from scratch
|
||||
|
||||
Stabiliser l’OS (kernel + paquets), puis redémarrer :
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt full-upgrade -y
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
Installer driver + CUDA + pinning APT (script), puis redémarrer :
|
||||
|
||||
```
|
||||
chmod +x setup-rtx5070ti-ubuntu2404.sh
|
||||
sudo ./setup-rtx5070ti-ubuntu2404.sh
|
||||
# accepter le reboot en fin de script
|
||||
```
|
||||
|
||||
Note : le script écrit un log dans `/tmp/rtx5070ti-ubuntu2404-setup.<timestamp>.log`.
|
||||
|
||||
## Validation
|
||||
|
||||
```
|
||||
nvidia-smi
|
||||
source /etc/profile.d/cuda-12-8.sh
|
||||
which nvcc
|
||||
nvcc --version
|
||||
sudo apt update
|
||||
sudo apt upgrade -y
|
||||
```
|
||||
|
||||
Pour valider que le pinning APT est bien effectif :
|
||||
|
||||
```
|
||||
apt-cache policy libnvidia-gl-580 libnvidia-egl-gbm1 nvidia-driver-580-open nvidia-utils-580 | sed -n '1,220p'
|
||||
```
|
||||
|
||||
## Installer seulement les artefacts /etc (pinning + env CUDA)
|
||||
|
||||
Déploie les fichiers du repo vers :
|
||||
|
||||
- `/etc/apt/preferences.d/99-nvidia-from-ubuntu-cuda-from-nvidia.pref`
|
||||
- `/etc/profile.d/cuda-12-8.sh`
|
||||
|
||||
```
|
||||
sudo ./install.sh
|
||||
```
|
||||
|
||||
## Makefile
|
||||
|
||||
- `make install` : exécute `sudo ./install.sh`
|
||||
- `make check` : checks rapides (APT policy, nvcc, nvidia-smi)
|
||||
|
||||
## Contenu du dépôt
|
||||
|
||||
- `setup-rtx5070ti-ubuntu2404.sh`
|
||||
Installe le driver Ubuntu 580-open + CUDA Toolkit 12.8 + pinning APT
|
||||
- `apt/99-nvidia-from-ubuntu-cuda-from-nvidia.pref`
|
||||
Pinning APT (driver/libs depuis Ubuntu; `cuda-*` depuis NVIDIA)
|
||||
- `env/cuda-12-8.sh`
|
||||
Variables d’environnement (PATH + LD_LIBRARY_PATH)
|
||||
- `install.sh`
|
||||
Déploie `apt/99-...pref` et `env/cuda-12-8.sh` dans `/etc/...`
|
||||
|
||||
## Notes
|
||||
|
||||
- La ligne “CUDA Version: …” affichée par `nvidia-smi` représente la capacité exposée par le driver, pas la version du toolkit installé.
|
||||
La version du toolkit installé se valide avec :
|
||||
|
||||
```
|
||||
source /etc/profile.d/cuda-12-8.sh
|
||||
which nvcc
|
||||
nvcc --version
|
||||
```
|
||||
21
apt/99-nvidia-from-ubuntu-cuda-from-nvidia.pref
Normal file
21
apt/99-nvidia-from-ubuntu-cuda-from-nvidia.pref
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Keep NVIDIA driver & libs from Ubuntu, not from the NVIDIA CUDA repo.
|
||||
Package: nvidia-*
|
||||
Pin: origin "developer.download.nvidia.com"
|
||||
Pin-Priority: 1
|
||||
|
||||
Package: libnvidia-*
|
||||
Pin: origin "developer.download.nvidia.com"
|
||||
Pin-Priority: 1
|
||||
|
||||
Package: linux-modules-nvidia-*
|
||||
Pin: origin "developer.download.nvidia.com"
|
||||
Pin-Priority: 1
|
||||
|
||||
Package: xserver-xorg-video-nvidia-*
|
||||
Pin: origin "developer.download.nvidia.com"
|
||||
Pin-Priority: 1
|
||||
|
||||
# Keep CUDA Toolkit from the NVIDIA repo.
|
||||
Package: cuda-*
|
||||
Pin: origin "developer.download.nvidia.com"
|
||||
Pin-Priority: 600
|
||||
36
docs/procedure-from-scratch.md
Normal file
36
docs/procedure-from-scratch.md
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# Procédure from scratch — Ubuntu 24.04.x “vanille” → RTX 5070 Ti OK
|
||||
|
||||
Cette procédure vise un résultat sans mélange de sources, ni de conflit APT.
|
||||
|
||||
## 1) BIOS/UEFI
|
||||
|
||||
- Secure Boot OFF (évite les surprises de chargement de modules).
|
||||
|
||||
## 2) Premier boot : stabiliser la base OS
|
||||
|
||||
Objectif : être sur le kernel et les paquets à jour avant d’installer le driver NVIDIA.
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt full-upgrade -y
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
## 3) Installer driver + CUDA + pinning APT
|
||||
|
||||
Après reboot :
|
||||
|
||||
```
|
||||
chmod +x setup-rtx5070ti-ubuntu2404.sh
|
||||
sudo ./setup-rtx5070ti-ubuntu2404.sh
|
||||
# accepter le reboot en fin de script
|
||||
```
|
||||
|
||||
## 4) Vérification post-reboot
|
||||
|
||||
```
|
||||
nvidia-smi
|
||||
nvcc --version
|
||||
sudo apt update
|
||||
sudo apt upgrade -y
|
||||
```
|
||||
51
docs/validation.md
Normal file
51
docs/validation.md
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# Validation — Checks rapides
|
||||
|
||||
## 1) Driver / GPU
|
||||
|
||||
```
|
||||
nvidia-smi
|
||||
```
|
||||
|
||||
Attendu :
|
||||
|
||||
- La RTX 5070 Ti est listée
|
||||
- “Driver Version” correspond au driver installé via Ubuntu
|
||||
|
||||
## 2) CUDA Toolkit (version installée)
|
||||
|
||||
```
|
||||
which nvcc
|
||||
nvcc --version
|
||||
```
|
||||
|
||||
Attendu :
|
||||
|
||||
- `which nvcc` → `/usr/local/cuda-12.8/bin/nvcc`
|
||||
- `nvcc --version` indique CUDA 12.8
|
||||
|
||||
Note :
|
||||
|
||||
- “CUDA Version: …” dans `nvidia-smi` n’est pas la version du toolkit installé ; c’est la capacité exposée par le driver.
|
||||
|
||||
## 3) APT anti-régression (pinning effectif)
|
||||
|
||||
```
|
||||
apt-cache policy libnvidia-gl-580 libnvidia-egl-gbm1 nvidia-driver-580-open nvidia-utils-580 | sed -n '1,220p'
|
||||
```
|
||||
|
||||
Attendu :
|
||||
|
||||
- Les candidats `nvidia-*` / `libnvidia-*` proviennent d’Ubuntu
|
||||
- Le dépôt CUDA NVIDIA apparaît, mais ne “gagne” pas pour `nvidia-*` / `libnvidia-*` (pinning actif)
|
||||
|
||||
## 4) Upgrade propre
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt upgrade -y
|
||||
```
|
||||
|
||||
Attendu :
|
||||
|
||||
- Aucun conflit `libnvidia-gl-580` ↔ `libnvidia-egl-gbm1`
|
||||
- Aucun paquet cassé / retenu pour cause de dépendances NVIDIA
|
||||
2
env/cuda-12-8.sh
vendored
Normal file
2
env/cuda-12-8.sh
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export PATH=/usr/local/cuda-12.8/bin:$PATH
|
||||
export LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib64:$LD_LIBRARY_PATH
|
||||
46
install.sh
Executable file
46
install.sh
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env bash
|
||||
# Installe les artefacts de configuration (APT pinning + env CUDA) depuis le dépôt
|
||||
# vers /etc/... de façon simple et reproductible.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
fatal(){ echo "ERROR: $*" >&2; exit 1; }
|
||||
info(){ echo "INFO: $*"; }
|
||||
|
||||
require_root() {
|
||||
if [[ "${EUID:-$(id -u)}" -ne 0 ]]; then
|
||||
fatal "Run as root: sudo $0"
|
||||
fi
|
||||
}
|
||||
|
||||
repo_root() {
|
||||
# Répertoire du script (supposé être à la racine du repo)
|
||||
cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd
|
||||
}
|
||||
|
||||
main() {
|
||||
require_root
|
||||
local root
|
||||
root="$(repo_root)"
|
||||
|
||||
[[ -f "$root/apt/99-nvidia-from-ubuntu-cuda-from-nvidia.pref" ]] || fatal "Missing: apt/99-nvidia-from-ubuntu-cuda-from-nvidia.pref"
|
||||
[[ -f "$root/env/cuda-12-8.sh" ]] || fatal "Missing: env/cuda-12-8.sh"
|
||||
|
||||
info "Installing APT pinning file..."
|
||||
install -D -m 0644 "$root/apt/99-nvidia-from-ubuntu-cuda-from-nvidia.pref" \
|
||||
/etc/apt/preferences.d/99-nvidia-from-ubuntu-cuda-from-nvidia.pref
|
||||
|
||||
info "Installing CUDA environment file..."
|
||||
install -D -m 0644 "$root/env/cuda-12-8.sh" \
|
||||
/etc/profile.d/cuda-12-8.sh
|
||||
|
||||
info "Refreshing APT metadata..."
|
||||
apt-get update -y
|
||||
|
||||
info "Done."
|
||||
info "Quick checks:"
|
||||
echo " apt-cache policy nvidia-driver-580-open libnvidia-gl-580 | sed -n '1,120p'"
|
||||
echo " source /etc/profile.d/cuda-12-8.sh ; which nvcc ; nvcc --version"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
216
setup-rtx5070ti-ubuntu2404.sh
Normal file
216
setup-rtx5070ti-ubuntu2404.sh
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
#!/usr/bin/env bash
|
||||
# Ubuntu 24.04.x (Noble) + RTX 5070 Ti
|
||||
# Target state (simple/reliable):
|
||||
# - NVIDIA driver: Ubuntu packages (nvidia-driver-580-open + libs)
|
||||
# - CUDA Toolkit: NVIDIA repo (cuda-toolkit-12-8) under /usr/local/cuda-12.8
|
||||
# - APT pinning: prevent NVIDIA CUDA repo from “winning” for nvidia-* / libnvidia-* packages
|
||||
#
|
||||
# Run:
|
||||
# chmod +x ~/setup-rtx5070ti-ubuntu2404.sh
|
||||
# sudo ~/setup-rtx5070ti-ubuntu2404.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
LOG="/tmp/rtx5070ti-ubuntu2404-setup.$(date +%Y%m%d_%H%M%S).log"
|
||||
exec > >(tee -a "$LOG") 2>&1
|
||||
|
||||
fatal() { echo "ERROR: $*" >&2; exit 1; }
|
||||
info() { echo "INFO: $*"; }
|
||||
warn() { echo "WARN: $*"; }
|
||||
|
||||
require_cmd() {
|
||||
command -v "$1" >/dev/null 2>&1 || fatal "Missing required command: $1"
|
||||
}
|
||||
|
||||
require_root() {
|
||||
if [[ "${EUID:-$(id -u)}" -ne 0 ]]; then
|
||||
fatal "Run as root (e.g. sudo $0)"
|
||||
fi
|
||||
}
|
||||
|
||||
check_os() {
|
||||
[[ -r /etc/os-release ]] || fatal "/etc/os-release not found"
|
||||
# shellcheck disable=SC1091
|
||||
. /etc/os-release
|
||||
[[ "${ID:-}" == "ubuntu" ]] || fatal "Ubuntu required (detected ID=${ID:-unknown})"
|
||||
[[ "${VERSION_ID:-}" == "24.04" ]] || fatal "Ubuntu 24.04.x required (detected VERSION_ID=${VERSION_ID:-unknown})"
|
||||
info "Detected Ubuntu ${VERSION_ID} (${VERSION_CODENAME:-unknown})."
|
||||
}
|
||||
|
||||
check_secure_boot() {
|
||||
if command -v mokutil >/dev/null 2>&1; then
|
||||
local sb
|
||||
sb="$(mokutil --sb-state 2>/dev/null || true)"
|
||||
if echo "$sb" | grep -qi "enabled"; then
|
||||
warn "Secure Boot appears ENABLED. If NVIDIA modules fail to load, Secure Boot is a common cause."
|
||||
warn "For a deterministic first-boot experience, Secure Boot OFF is recommended."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
write_apt_pinning() {
|
||||
local pref="/etc/apt/preferences.d/99-nvidia-from-ubuntu-cuda-from-nvidia.pref"
|
||||
info "Configuring APT pinning at: $pref"
|
||||
cat > "$pref" <<'PREF'
|
||||
# Keep NVIDIA driver & libs from Ubuntu, not from the NVIDIA CUDA repo.
|
||||
Package: nvidia-*
|
||||
Pin: origin "developer.download.nvidia.com"
|
||||
Pin-Priority: 1
|
||||
|
||||
Package: libnvidia-*
|
||||
Pin: origin "developer.download.nvidia.com"
|
||||
Pin-Priority: 1
|
||||
|
||||
Package: linux-modules-nvidia-*
|
||||
Pin: origin "developer.download.nvidia.com"
|
||||
Pin-Priority: 1
|
||||
|
||||
Package: xserver-xorg-video-nvidia-*
|
||||
Pin: origin "developer.download.nvidia.com"
|
||||
Pin-Priority: 1
|
||||
|
||||
# Keep CUDA Toolkit from the NVIDIA repo.
|
||||
Package: cuda-*
|
||||
Pin: origin "developer.download.nvidia.com"
|
||||
Pin-Priority: 600
|
||||
PREF
|
||||
}
|
||||
|
||||
apt_update_upgrade() {
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
info "APT update + base upgrade"
|
||||
apt-get update -y
|
||||
apt-get upgrade -y
|
||||
}
|
||||
|
||||
install_driver_ubuntu() {
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
local krel
|
||||
krel="$(uname -r)"
|
||||
info "Installing NVIDIA driver from Ubuntu (580-open) for kernel: $krel"
|
||||
|
||||
apt-get install -y \
|
||||
"linux-modules-nvidia-580-open-$krel" \
|
||||
nvidia-driver-580-open \
|
||||
nvidia-utils-580 \
|
||||
libnvidia-gl-580
|
||||
|
||||
update-initramfs -u
|
||||
}
|
||||
|
||||
remove_ubuntu_cuda_toolkit_if_present() {
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
if dpkg -l | awk '{print $2}' | grep -qx "nvidia-cuda-toolkit"; then
|
||||
info "Removing Ubuntu 'nvidia-cuda-toolkit' to avoid mixing toolkits"
|
||||
apt-get purge -y nvidia-cuda-toolkit
|
||||
apt-get autoremove -y
|
||||
else
|
||||
info "Ubuntu 'nvidia-cuda-toolkit' not installed (good)."
|
||||
fi
|
||||
}
|
||||
|
||||
add_nvidia_cuda_repo_if_missing() {
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
local keypkg="/tmp/cuda-keyring_1.1-1_all.deb"
|
||||
|
||||
# If already present, do nothing.
|
||||
if grep -Rqs "developer.download.nvidia.com/compute/cuda/repos/ubuntu2404" /etc/apt/sources.list /etc/apt/sources.list.d/* 2>/dev/null; then
|
||||
info "NVIDIA CUDA repo already configured."
|
||||
return
|
||||
fi
|
||||
|
||||
info "Adding NVIDIA CUDA repo (cuda-keyring)"
|
||||
apt-get update -y
|
||||
apt-get install -y wget gnupg ca-certificates
|
||||
|
||||
wget -q -O "$keypkg" "https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb"
|
||||
dpkg -i "$keypkg"
|
||||
}
|
||||
|
||||
install_cuda_12_8() {
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
info "Installing CUDA Toolkit 12.8 from NVIDIA repo"
|
||||
apt-get update -y
|
||||
apt-get install -y cuda-toolkit-12-8
|
||||
}
|
||||
|
||||
configure_cuda_env_systemwide() {
|
||||
local f="/etc/profile.d/cuda-12-8.sh"
|
||||
info "Writing system-wide CUDA environment file: $f"
|
||||
cat > "$f" <<'ENVF'
|
||||
export PATH=/usr/local/cuda-12.8/bin:$PATH
|
||||
export LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib64:$LD_LIBRARY_PATH
|
||||
ENVF
|
||||
|
||||
# Remove duplicates from the invoking user's ~/.bashrc if present.
|
||||
local u="${SUDO_USER:-}"
|
||||
if [[ -n "$u" && -d "/home/$u" && -f "/home/$u/.bashrc" ]]; then
|
||||
info "Cleaning CUDA 12.8 exports from /home/$u/.bashrc (single source of truth: /etc/profile.d)"
|
||||
sed -i '/\/usr\/local\/cuda-12\.8\/bin/d;/\/usr\/local\/cuda-12\.8\/lib64/d' "/home/$u/.bashrc" || true
|
||||
fi
|
||||
}
|
||||
|
||||
validate_now() {
|
||||
info "Validation (current boot):"
|
||||
|
||||
if command -v nvidia-smi >/dev/null 2>&1; then
|
||||
nvidia-smi || warn "nvidia-smi failed (often resolved after reboot if modules were just installed)."
|
||||
else
|
||||
warn "nvidia-smi not found (unexpected if nvidia-utils-580 installed)."
|
||||
fi
|
||||
|
||||
if [[ -x /usr/local/cuda-12.8/bin/nvcc ]]; then
|
||||
/usr/local/cuda-12.8/bin/nvcc --version || warn "nvcc failed to run."
|
||||
else
|
||||
warn "nvcc not found at /usr/local/cuda-12.8/bin/nvcc (CUDA install may have failed)."
|
||||
fi
|
||||
|
||||
info "APT policy sanity check (candidates should prefer Ubuntu for driver/libs):"
|
||||
apt-cache policy libnvidia-gl-580 libnvidia-egl-gbm1 nvidia-driver-580-open nvidia-utils-580 | sed -n '1,220p' || true
|
||||
}
|
||||
|
||||
prompt_reboot() {
|
||||
echo
|
||||
info "Recommended: reboot now to load NVIDIA kernel modules cleanly."
|
||||
read -r -p "Reboot now? [y/N] " ans
|
||||
if [[ "${ans,,}" == "y" || "${ans,,}" == "yes" ]]; then
|
||||
info "Rebooting..."
|
||||
reboot
|
||||
else
|
||||
warn "You chose not to reboot now. If anything looks off, reboot and re-check with: nvidia-smi ; nvcc --version"
|
||||
info "Log saved to: $LOG"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
require_root
|
||||
require_cmd apt-get
|
||||
require_cmd dpkg
|
||||
require_cmd uname
|
||||
require_cmd update-initramfs
|
||||
|
||||
check_os
|
||||
check_secure_boot
|
||||
|
||||
# Pinning first so the NVIDIA CUDA repo cannot override the driver/libs later.
|
||||
write_apt_pinning
|
||||
|
||||
apt_update_upgrade
|
||||
install_driver_ubuntu
|
||||
|
||||
# CUDA: keep NVIDIA 12.8 only (remove Ubuntu toolkit if present).
|
||||
remove_ubuntu_cuda_toolkit_if_present
|
||||
add_nvidia_cuda_repo_if_missing
|
||||
install_cuda_12_8
|
||||
configure_cuda_env_systemwide
|
||||
|
||||
# Repair any partial states and finish upgrades.
|
||||
info "Final APT fix-broken (if needed) + upgrade"
|
||||
apt-get -f install -y || true
|
||||
apt-get upgrade -y
|
||||
|
||||
validate_now
|
||||
prompt_reboot
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Loading…
Reference in a new issue