From e1f2814f81ac81ce7ddb5726403e0cf8d98c01ed Mon Sep 17 00:00:00 2001 From: MickLesk Date: Sun, 21 Dec 2025 22:40:52 +0100 Subject: [PATCH] Fix AMD GPU firmware installation by adding non-free-firmware repository - Add non-free-firmware repository for Debian before attempting to install firmware-amd-graphics - Support both Debian Bookworm (12) and Trixie (13)/Sid - Install firmware-amd-graphics for all AMD GPUs detected, not just APUs - Improve error handling with warning message if firmware installation fails Fixes #10177 --- misc/tools.func | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/misc/tools.func b/misc/tools.func index 42dd47a6c..6b41e900b 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -2644,9 +2644,42 @@ function setup_hwaccel() { return 1 } - # For AMD CPUs without discrete GPU (APUs) - if [[ "$cpu_vendor" == "AuthenticAMD" && -n "$gpu_vendor" ]]; then - $STD apt -y install libdrm-amdgpu1 firmware-amd-graphics || true + # For AMD GPUs, firmware-amd-graphics is needed but requires non-free-firmware repository + if [[ "$os_id" == "debian" ]]; then + # Add non-free-firmware repository if not already present + if [[ ! -f /etc/apt/sources.list.d/non-free-firmware.sources ]]; then + if [[ "$os_codename" == "bookworm" ]]; then + cat </etc/apt/sources.list.d/non-free-firmware.sources +Types: deb +URIs: http://deb.debian.org/debian +Suites: bookworm bookworm-updates +Components: non-free-firmware + +Types: deb +URIs: http://deb.debian.org/debian-security +Suites: bookworm-security +Components: non-free-firmware +EOF + elif [[ "$os_codename" == "trixie" || "$os_codename" == "sid" ]]; then + cat </etc/apt/sources.list.d/non-free-firmware.sources +Types: deb +URIs: http://deb.debian.org/debian +Suites: trixie trixie-updates +Components: non-free-firmware + +Types: deb +URIs: http://deb.debian.org/debian-security +Suites: trixie-security +Components: non-free-firmware +EOF + fi + $STD apt update + fi + + # Now install AMD firmware and libdrm + $STD apt -y install libdrm-amdgpu1 firmware-amd-graphics || { + msg_warn "Failed to install AMD firmware - may need manual installation" + } fi ;; NVIDIA)