几个月前,我将笔记本电脑双启动到 Ubuntu 20.04 LTS。Ubuntu 安装默认为我安装了 NVIDIA 驱动程序,因此我可以无缝使用 NVIDIA 驱动程序和使用 GPU 训练的模型。
一切都很好,直到几天前我在执行时突然出现以下错误nvidia-smi
:
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
从那时起,我就无法正确打开我的 NVIDIA X Server GUI,如附件:
它还伴随着其他恼人的显示问题,例如:
- 即使屏幕变黑,屏幕背光仍然亮着
- 屏幕从挂起模式唤醒后无法恢复
- 屏幕亮度无法调整
当我安装 Ubuntu 20.04 时,所有这些显示问题都没有发生。
当检查软件和更新时,我发现驱动程序奇怪地回到了 Nouveau 显示驱动程序(如附件):
我无法切换回上面列出的 NVIDIA 驱动程序。每当我尝试切换时,都会收到以下错误:
我对所发生的事情感到非常沮丧。我没有进行任何软件更新,以尽量减少弄乱 NVIDIA 驱动程序的风险,但最后还是发生了这种情况......
最后的办法是,我将重新安装 Ubuntu,但在此之前,我想寻找其他替代方案。如果您有可行的解决方案,我将不胜感激!
安装 nvidia-driver-450-server 时出错
sudo apt-get install nvidia-driver-450-server
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-450-server : Depends: libnvidia-gl-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
Depends: libnvidia-compute-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
Depends: libnvidia-extra-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
Depends: nvidia-compute-utils-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
Depends: libnvidia-decode-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
Depends: libnvidia-encode-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
Depends: nvidia-utils-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
Depends: xserver-xorg-video-nvidia-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
Depends: libnvidia-cfg1-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
Depends: libnvidia-ifr1-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
Depends: libnvidia-fbc1-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
Recommends: libnvidia-compute-450-server:i386 (= 450.51.06-0ubuntu0.20.04.2)
Recommends: libnvidia-decode-450-server:i386 (= 450.51.06-0ubuntu0.20.04.2)
Recommends: libnvidia-encode-450-server:i386 (= 450.51.06-0ubuntu0.20.04.2)
Recommends: libnvidia-ifr1-450-server:i386 (= 450.51.06-0ubuntu0.20.04.2)
Recommends: libnvidia-fbc1-450-server:i386 (= 450.51.06-0ubuntu0.20.04.2)
Recommends: libnvidia-gl-450-server:i386 (= 450.51.06-0ubuntu0.20.04.2)
E: Unable to correct problems, you have held broken packages.
规格
笔记本电脑:联想 Legion Y740
操作系统:Ubuntu 20.04
内核:5.4.0-48-generic
GPU:RTX 2070 Max-Q
答案1
作为临时解决方案,如果之前一切正常,请尝试启动以前的内核版本。就我而言,工作内核是 5.4.0-47(*-48 已损坏)。希望这只是软件包依赖关系的一些临时问题,很快就会得到解决。
更新:我已经通过 修复了新内核版本 (5.4.0-48) 中的问题aptitude install nvidia-driver-450
。有很多关于某些冲突和删除 nvidia-*-440 软件包的警告,但最终安装了新版本,新内核使用 nvidia 驱动程序启动,到目前为止一切看起来都很好。
答案2
我终于找到了解决相同问题的方法。重新启动有故障的 5.4.0.48 内核。现在,打开终端并执行以下操作:
跑步:
sudo apt-get dist-upgrade
打开软件更新程序并安装新的更新。
重新启动后 NVIDIA 驱动程序应该可以再次工作。