Skip to content

Commit 7a00894

Browse files
committed
extensions/nvidia: clear modprobe blacklist when GPU detected
If a previous boot ran on the same rootfs without NVIDIA hardware, the autodetect helper wrote /etc/modprobe.d/armbian-nvidia-disabled.conf to keep the kernel modules from auto-loading. When the same rootfs later boots with NVIDIA hardware (card added, SSD swapped into a GPU-equipped host), the early `exit 0` left that file in place, so the modules still wouldn't load even though they're present and the GPU is wired up. The detector was effectively one-way. When lspci finds [10de:], clear the blacklist file if it exists (rm -f is idempotent for the common case where it never existed). Log via systemd-cat so the action shows up in `journalctl -u armbian-nvidia-autodetect` for triage. Deliberately /not/ auto-reinstalling NVIDIA packages on the recovery path - proprietary driver auto-install without operator consent, and without guaranteed network/apt-sources, is out of scope for a boot-time detector. If packages were previously purged the operator runs apt install manually; the freshly-cleared blacklist file makes that work the next boot.
1 parent 9ce323c commit 7a00894

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

extensions/nvidia.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,20 @@ function install_armbian_nvidia_autodetect_helper() {
174174
# `lspci -nn` output so non-VGA NVIDIA devices (Tegra USB-C,
175175
# audio over HDMI, etc.) also count.
176176
if lspci -nn 2>/dev/null | grep -qiE '\[10de:'; then
177+
# Hardware is present. If a previous boot ran on a host
178+
# without NVIDIA, the modprobe blacklist file is still on
179+
# disk and would keep the driver from loading even now.
180+
# Remove it so the modules can bind on the next boot. rm -f
181+
# is idempotent on the common case where the file never
182+
# existed. Package reinstall is intentionally NOT attempted
183+
# here - apt-installing proprietary NVIDIA drivers without
184+
# user consent and without guaranteed network/apt-sources
185+
# is out of scope for a boot-time detector. If packages were
186+
# previously purged, the operator runs apt install manually.
187+
if [ -f /etc/modprobe.d/armbian-nvidia-disabled.conf ]; then
188+
rm -f /etc/modprobe.d/armbian-nvidia-disabled.conf
189+
echo "armbian-nvidia-autodetect: NVIDIA hardware detected; cleared modprobe blacklist" | systemd-cat -t armbian-nvidia-autodetect 2>/dev/null || true
190+
fi
177191
exit 0
178192
fi
179193

0 commit comments

Comments
 (0)