mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-05-03 23:45:59 +00:00
fix(hwaccel): improve NVIDIA version matching and GPU selection UI (#10901)
This commit is contained in:
committed by
GitHub
parent
6ccc0aaaf6
commit
25a6a7ecc7
+69
-15
@@ -2683,7 +2683,7 @@ function setup_hwaccel() {
|
|||||||
else
|
else
|
||||||
# Multiple GPUs - show selection menu
|
# Multiple GPUs - show selection menu
|
||||||
echo ""
|
echo ""
|
||||||
msg_info "Multiple GPUs detected:"
|
msg_custom "⚠" "${YW}" "Multiple GPUs detected:"
|
||||||
echo ""
|
echo ""
|
||||||
for i in "${!GPU_LIST[@]}"; do
|
for i in "${!GPU_LIST[@]}"; do
|
||||||
local type_display="${GPU_TYPES[$i]}"
|
local type_display="${GPU_TYPES[$i]}"
|
||||||
@@ -3039,16 +3039,36 @@ _setup_nvidia_gpu() {
|
|||||||
if [[ "$os_codename" == "trixie" || "$os_codename" == "sid" ]]; then
|
if [[ "$os_codename" == "trixie" || "$os_codename" == "sid" ]]; then
|
||||||
msg_info "Debian ${os_codename}: Using Debian's NVIDIA packages"
|
msg_info "Debian ${os_codename}: Using Debian's NVIDIA packages"
|
||||||
|
|
||||||
# Try version-matched from Debian repos first
|
# Extract major version for flexible matching (580.126.09 -> 580)
|
||||||
local nvidia_pkgs="libcuda1=${nvidia_host_version}* libnvcuvid1=${nvidia_host_version}* libnvidia-encode1=${nvidia_host_version}* libnvidia-ml1=${nvidia_host_version}*"
|
local nvidia_major_version="${nvidia_host_version%%.*}"
|
||||||
|
|
||||||
|
# Check what versions are actually available
|
||||||
|
local available_version=""
|
||||||
|
available_version=$(apt-cache madison libcuda1 2>/dev/null | awk '{print $3}' | grep -E "^${nvidia_major_version}\." | head -1 || true)
|
||||||
|
|
||||||
|
if [[ -n "$available_version" ]]; then
|
||||||
|
msg_info "Found available NVIDIA version: ${available_version}"
|
||||||
|
local nvidia_pkgs="libcuda1=${available_version} libnvcuvid1=${available_version} libnvidia-encode1=${available_version} libnvidia-ml1=${available_version}"
|
||||||
if $STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends $nvidia_pkgs 2>/dev/null; then
|
if $STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends $nvidia_pkgs 2>/dev/null; then
|
||||||
msg_ok "Installed version-matched NVIDIA libraries from Debian"
|
msg_ok "Installed NVIDIA libraries (${available_version})"
|
||||||
else
|
else
|
||||||
# Fallback to unversioned (whatever Debian provides)
|
msg_warn "Failed to install NVIDIA ${available_version} - trying unversioned"
|
||||||
if $STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends libcuda1 libnvcuvid1 libnvidia-encode1 libnvidia-ml1 2>/dev/null; then
|
$STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends libcuda1 libnvcuvid1 libnvidia-encode1 libnvidia-ml1 2>/dev/null || true
|
||||||
msg_ok "Installed NVIDIA libraries from Debian (version may differ from host)"
|
fi
|
||||||
else
|
else
|
||||||
|
# No matching major version - try latest available or unversioned
|
||||||
|
msg_warn "No NVIDIA packages for version ${nvidia_major_version}.x found in repos"
|
||||||
|
available_version=$(apt-cache madison libcuda1 2>/dev/null | awk '{print $3}' | head -1 || true)
|
||||||
|
if [[ -n "$available_version" ]]; then
|
||||||
|
msg_info "Trying latest available: ${available_version} (may cause version mismatch)"
|
||||||
|
$STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends \
|
||||||
|
libcuda1="${available_version}" libnvcuvid1="${available_version}" \
|
||||||
|
libnvidia-encode1="${available_version}" libnvidia-ml1="${available_version}" 2>/dev/null ||
|
||||||
|
$STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends \
|
||||||
|
libcuda1 libnvcuvid1 libnvidia-encode1 libnvidia-ml1 2>/dev/null ||
|
||||||
msg_warn "NVIDIA library installation failed - GPU compute may not work"
|
msg_warn "NVIDIA library installation failed - GPU compute may not work"
|
||||||
|
else
|
||||||
|
msg_warn "No NVIDIA packages available in Debian repos - GPU support disabled"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
$STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends nvidia-smi 2>/dev/null || true
|
$STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends nvidia-smi 2>/dev/null || true
|
||||||
@@ -3083,19 +3103,40 @@ NVIDIA_PIN
|
|||||||
|
|
||||||
$STD apt-get -y update 2>/dev/null || msg_warn "apt update failed - continuing anyway"
|
$STD apt-get -y update 2>/dev/null || msg_warn "apt update failed - continuing anyway"
|
||||||
|
|
||||||
# Install version-matched NVIDIA libraries
|
# Extract major version for flexible matching (580.126.09 -> 580)
|
||||||
local nvidia_pkgs="libcuda1=${nvidia_host_version}* libnvcuvid1=${nvidia_host_version}* libnvidia-encode1=${nvidia_host_version}* libnvidia-ml1=${nvidia_host_version}*"
|
local nvidia_major_version="${nvidia_host_version%%.*}"
|
||||||
|
|
||||||
msg_info "Installing NVIDIA libraries (version ${nvidia_host_version})"
|
# Check what versions are actually available in CUDA repo
|
||||||
|
local available_version=""
|
||||||
|
available_version=$(apt-cache madison libcuda1 2>/dev/null | awk '{print $3}' | grep -E "^${nvidia_major_version}\." | head -1 || true)
|
||||||
|
|
||||||
|
if [[ -n "$available_version" ]]; then
|
||||||
|
msg_info "Installing NVIDIA libraries (version ${available_version})"
|
||||||
|
local nvidia_pkgs="libcuda1=${available_version} libnvcuvid1=${available_version} libnvidia-encode1=${available_version} libnvidia-ml1=${available_version}"
|
||||||
if $STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends $nvidia_pkgs 2>/dev/null; then
|
if $STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends $nvidia_pkgs 2>/dev/null; then
|
||||||
msg_ok "Installed version-matched NVIDIA libraries"
|
msg_ok "Installed version-matched NVIDIA libraries"
|
||||||
else
|
else
|
||||||
msg_warn "Version-pinned install failed - trying unpinned"
|
msg_warn "Version-pinned install failed - trying unpinned"
|
||||||
if $STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends libcuda1 libnvcuvid1 libnvidia-encode1 libnvidia-ml1 2>/dev/null; then
|
$STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends libcuda1 libnvcuvid1 libnvidia-encode1 libnvidia-ml1 2>/dev/null ||
|
||||||
msg_ok "Installed NVIDIA libraries (unpinned) - version mismatch may occur"
|
|
||||||
else
|
|
||||||
msg_warn "NVIDIA library installation failed"
|
msg_warn "NVIDIA library installation failed"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
msg_warn "No NVIDIA packages for version ${nvidia_major_version}.x in CUDA repo (host: ${nvidia_host_version})"
|
||||||
|
# Try latest available version
|
||||||
|
available_version=$(apt-cache madison libcuda1 2>/dev/null | awk '{print $3}' | head -1 || true)
|
||||||
|
if [[ -n "$available_version" ]]; then
|
||||||
|
msg_info "Trying latest available: ${available_version} (version mismatch warning)"
|
||||||
|
if $STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends \
|
||||||
|
libcuda1="${available_version}" libnvcuvid1="${available_version}" \
|
||||||
|
libnvidia-encode1="${available_version}" libnvidia-ml1="${available_version}" 2>/dev/null; then
|
||||||
|
msg_ok "Installed NVIDIA libraries (${available_version}) - version differs from host"
|
||||||
|
else
|
||||||
|
$STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends libcuda1 libnvcuvid1 libnvidia-encode1 libnvidia-ml1 2>/dev/null ||
|
||||||
|
msg_warn "NVIDIA library installation failed"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
msg_warn "No NVIDIA packages available in CUDA repo - GPU support disabled"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends nvidia-smi 2>/dev/null || true
|
$STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends nvidia-smi 2>/dev/null || true
|
||||||
@@ -3125,14 +3166,27 @@ NVIDIA_PIN
|
|||||||
|
|
||||||
$STD apt-get -y update 2>/dev/null || msg_warn "apt update failed - continuing anyway"
|
$STD apt-get -y update 2>/dev/null || msg_warn "apt update failed - continuing anyway"
|
||||||
|
|
||||||
# Try version-matched install
|
# Extract major version for flexible matching
|
||||||
local nvidia_pkgs="libcuda1=${nvidia_host_version}* libnvcuvid1=${nvidia_host_version}* libnvidia-encode1=${nvidia_host_version}* libnvidia-ml1=${nvidia_host_version}*"
|
local nvidia_major_version="${nvidia_host_version%%.*}"
|
||||||
|
|
||||||
|
# Check what versions are available
|
||||||
|
local available_version=""
|
||||||
|
available_version=$(apt-cache madison libcuda1 2>/dev/null | awk '{print $3}' | grep -E "^${nvidia_major_version}\." | head -1 || true)
|
||||||
|
|
||||||
|
if [[ -n "$available_version" ]]; then
|
||||||
|
msg_info "Installing NVIDIA libraries (version ${available_version})"
|
||||||
|
local nvidia_pkgs="libcuda1=${available_version} libnvcuvid1=${available_version} libnvidia-encode1=${available_version} libnvidia-ml1=${available_version}"
|
||||||
if $STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends $nvidia_pkgs 2>/dev/null; then
|
if $STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends $nvidia_pkgs 2>/dev/null; then
|
||||||
msg_ok "Installed version-matched NVIDIA libraries"
|
msg_ok "Installed version-matched NVIDIA libraries"
|
||||||
else
|
else
|
||||||
# Fallback to Ubuntu repo packages
|
# Fallback to Ubuntu repo packages
|
||||||
$STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends libnvidia-decode libnvidia-encode nvidia-utils 2>/dev/null || msg_warn "NVIDIA installation failed"
|
$STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends libnvidia-decode libnvidia-encode nvidia-utils 2>/dev/null || msg_warn "NVIDIA installation failed"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
msg_warn "No NVIDIA packages for version ${nvidia_major_version}.x in CUDA repo"
|
||||||
|
# Fallback to Ubuntu repo packages
|
||||||
|
$STD apt-get -y -o Dpkg::Options::="--force-confold" install --no-install-recommends libnvidia-decode libnvidia-encode nvidia-utils 2>/dev/null || msg_warn "NVIDIA installation failed"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# VA-API for hybrid setups (Intel + NVIDIA)
|
# VA-API for hybrid setups (Intel + NVIDIA)
|
||||||
|
|||||||
Reference in New Issue
Block a user