From 72f9ca70dc0894ebc92d7a2fbfa72d6f2466d46a Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Sun, 21 Dec 2025 23:11:18 +0100 Subject: [PATCH] Fix AMD GPU firmware installation by adding non-free repositories (#10205) --- misc/tools.func | 52 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/misc/tools.func b/misc/tools.func index 44490fe17..7500e1e1c 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -2734,11 +2734,57 @@ EOF return 1 } - # AMD firmware for better GPU support + # For AMD GPUs, firmware-amd-graphics requires non-free repositories if [[ "$os_id" == "debian" ]]; then - $STD apt -y install firmware-amd-graphics 2>/dev/null || true + # 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 + + # Install AMD firmware and libdrm + $STD apt -y install libdrm-amdgpu1 firmware-amd-graphics 2>/dev/null || { + msg_warn "Failed to install AMD firmware - may need manual installation" + } + elif [[ "$os_id" == "ubuntu" ]]; then + # For Ubuntu, ensure multiverse is enabled (firmware-amd-graphics is in multiverse) + if ! grep -qE '^deb.*multiverse' /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null; then + $STD add-apt-repository -y multiverse + $STD apt update + fi + + # Install AMD firmware and libdrm + $STD apt -y install libdrm-amdgpu1 firmware-amd-graphics 2>/dev/null || { + msg_warn "Failed to install AMD firmware - may need manual installation" + } + else + # For other distributions, try without adding repositories + $STD apt -y install libdrm-amdgpu1 2>/dev/null || true fi - $STD apt -y install libdrm-amdgpu1 2>/dev/null || true ;; NVIDIA)