Debian

為 Debian Stretch 安裝 NVIDIA 驅動程序

  • May 1, 2021

我正在嘗試為 Debian 安裝 nvidia-driver。

我到處讀到正確的解決方案是執行sudo apt install nvidia-driver,並且驅動程序應該自行安裝而不會出現問題。

但是這個命令給我留下了輸出

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
nvidia-driver : Depends: nvidia-driver-libs (= 375.82-1~deb9u1) but it is not going to be installed
                Depends: nvidia-driver-bin (= 375.82-1~deb9u1) but it is not going to be installed
                Depends: xserver-xorg-video-nvidia (= 375.82-1~deb9u1) but it is not going to be installed
                Depends: nvidia-vdpau-driver (= 375.82-1~deb9u1) but it is not going to be installed
                Depends: nvidia-alternative (= 375.82-1~deb9u1)
                Depends: nvidia-kernel-dkms (= 375.82-1~deb9u1) or
                         nvidia-kernel-375.82
                Recommends: nvidia-settings (>= 375) but it is not going to be installed
                Recommends: nvidia-persistenced
E: Unable to correct problems, you have held broken packages.

我已經嘗試安裝缺少的依賴項(例如sudo apt install nvidia-driver-libs),但這只會導致

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
nvidia-driver-libs : Depends: libgl1-nvidia-glvnd-glx (= 375.82-1~deb9u1) but it is not going to be installed or
                              libgl1-nvidia-glx (= 375.82-1~deb9u1) but it is not going to be installed
                     Depends: nvidia-egl-icd (= 375.82-1~deb9u1) but it is not going to be installed or
                              libegl1-nvidia (= 375.82-1~deb9u1) but it is not going to be installed
                     Recommends: nvidia-driver-libs-i386
                     Recommends: libopengl0-glvnd-nvidia but it is not going to be installed
                     Recommends: libglx-nvidia0 (= 375.82-1~deb9u1) but it is not going to be installed
                     Recommends: libgles-nvidia1 (= 375.82-1~deb9u1) but it is not going to be installed
                     Recommends: libgles-nvidia2 (= 375.82-1~deb9u1) but it is not going to be installed
                     Recommends: libnvidia-cfg1 (= 375.82-1~deb9u1) but it is not going to be installed
                 Recommends: nvidia-vulkan-icd (= 375.82-1~deb9u1) but it is not going to be installed

如何nvidia-driver使用 apt 安裝?

您需要啟用非免費儲存庫:

sudo sed -i.bak 's/stretch[^ ]* main$/& contrib non-free/g' /etc/apt/sources.list

然後執行apt update並再次嘗試安裝。如果您還沒有安裝核心標頭檔,您可能還需要:

sudo apt install linux-headers-$(uname -r)

請參閱Debian wiki 上的完整說明

我有一個類似的問題。我通過從源中刪除反向埠來解決它

從這個問題https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906903

我們以前有過這種情況……同時啟用拉伸和拉伸反向埠並嘗試跟踪拉伸目前不適用於 nvidia 驅動程序…… libglvnd 等的更改太多。

引用自:https://unix.stackexchange.com/questions/449794