![更新后无法访问 NVIDIA 驱动程序](https://linux22.com/image/1024050/%E6%9B%B4%E6%96%B0%E5%90%8E%E6%97%A0%E6%B3%95%E8%AE%BF%E9%97%AE%20NVIDIA%20%E9%A9%B1%E5%8A%A8%E7%A8%8B%E5%BA%8F.png)
将我的 Ubuntu 操作系统从 18.04 更新到 20.04 后,我无法再访问我机器上的 NVIDIA 驱动程序。如果我运行 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.
我尝试通过以下步骤重新安装它们:
sudo ubuntu-drivers install
但这样做失败了,并给了我一长串错误消息:
Setting up initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-image-5.4.0-81-generic (5.4.0-81.91) ...
Processing triggers for initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-81-generic
W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-81-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 1
Processing triggers for linux-image-5.4.0-81-generic (5.4.0-81.91) ...
/etc/kernel/postinst.d/dkms:
* dkms: running auto installation service for kernel 5.4.0-81-generic
...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.4.0-81-generic
W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-81-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-5.4.0-81-generic (--configure):
installed linux-image-5.4.0-81-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
initramfs-tools
linux-image-5.4.0-81-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
我不确定无法写入“压缩块”是什么意思,我的网络搜索也没有帮助我解决问题。这里有人知道为什么我无法安装 NVIDIA 驱动程序吗?
另外,我在运行时可以看到 NVIDIA 驱动程序,apt search nvidia-driver
但是运行时却无法访问它们nvidia-smi
:
nvidia-384/focal-security,focal-updates 390.144-0ubuntu0.20.04.1 amd64
Transitional package for nvidia-driver-390
nvidia-384-dev/focal-security,focal-updates 390.144-0ubuntu0.20.04.1 amd64
Transitional package for nvidia-driver-390
nvidia-driver-390/focal-security,focal-updates 390.144-0ubuntu0.20.04.1 amd64
NVIDIA driver metapackage
nvidia-driver-418/focal 430.50-0ubuntu3 amd64
Transitional package for nvidia-driver-430
nvidia-driver-418-server/focal-security,focal-updates 418.211.00-0ubuntu0.20.04.1 amd64
NVIDIA Server Driver metapackage
nvidia-driver-430/focal-security,focal-updates 440.100-0ubuntu0.20.04.1 amd64
Transitional package for nvidia-driver-440
nvidia-driver-435/focal-updates 455.45.01-0ubuntu0.20.04.1 amd64
Transitional package for nvidia-driver-455
nvidia-driver-440/focal-security,focal-updates 450.119.03-0ubuntu0.20.04.1 amd64
Transitional package for nvidia-driver-450
nvidia-driver-440-server/focal-security,focal-updates 450.142.00-0ubuntu0.20.04.1 amd64
Transitional package for nvidia-driver-450-server
nvidia-driver-450/focal-security,focal-updates 460.91.03-0ubuntu0.20.04.1 amd64
Transitional package for nvidia-driver-460
nvidia-driver-450-server/focal-security,focal-updates 450.142.00-0ubuntu0.20.04.1 amd64
NVIDIA Server Driver metapackage
nvidia-driver-455/focal-security,focal-updates 460.91.03-0ubuntu0.20.04.1 amd64
Transitional package for nvidia-driver-460
nvidia-driver-460/focal-security,focal-updates 460.91.03-0ubuntu0.20.04.1 amd64
NVIDIA driver metapackage
nvidia-driver-460-server/focal-security,focal-updates 460.91.03-0ubuntu0.20.04.1 amd64
NVIDIA Server Driver metapackage
nvidia-driver-465/focal-security,focal-updates 470.57.02-0ubuntu0.20.04.1 amd64
Transitional package for nvidia-driver-470
nvidia-driver-470/focal-security,focal-updates,now 470.57.02-0ubuntu0.20.04.1 amd64 [installed]
NVIDIA driver metapackage
nvidia-driver-470-server/focal-updates 470.57.02-0ubuntu0.20.04.2 amd64
NVIDIA Server Driver metapackage
nvidia-headless-390/focal-security,focal-updates 390.144-0ubuntu0.20.04.1 amd64
NVIDIA headless metapackage
nvidia-headless-418-server/focal-security,focal-updates 418.211.00-0ubuntu0.20.04.1 amd64
NVIDIA headless metapackage
nvidia-headless-450-server/focal-security,focal-updates 450.142.00-0ubuntu0.20.04.1 amd64
NVIDIA headless metapackage
nvidia-headless-460/focal-security,focal-updates 460.91.03-0ubuntu0.20.04.1 amd64
NVIDIA headless metapackage
nvidia-headless-460-server/focal-security,focal-updates 460.91.03-0ubuntu0.20.04.1 amd64
NVIDIA headless metapackage
nvidia-headless-470/focal-security,focal-updates 470.57.02-0ubuntu0.20.04.1 amd64
NVIDIA headless metapackage
nvidia-headless-470-server/focal-updates 470.57.02-0ubuntu0.20.04.2 amd64
NVIDIA headless metapackage
nvidia-headless-no-dkms-390/focal-security,focal-updates 390.144-0ubuntu0.20.04.1 amd64
NVIDIA headless metapackage - no DKMS
nvidia-headless-no-dkms-418-server/focal-security,focal-updates 418.211.00-0ubuntu0.20.04.1 amd64
NVIDIA headless metapackage - no DKMS
nvidia-headless-no-dkms-450-server/focal-security,focal-updates 450.142.00-0ubuntu0.20.04.1 amd64
NVIDIA headless metapackage - no DKMS
nvidia-headless-no-dkms-460/focal-security,focal-updates 460.91.03-0ubuntu0.20.04.1 amd64
NVIDIA headless metapackage - no DKMS
nvidia-headless-no-dkms-460-server/focal-security,focal-updates 460.91.03-0ubuntu0.20.04.1 amd64
NVIDIA headless metapackage - no DKMS
nvidia-headless-no-dkms-470/focal-security,focal-updates 470.57.02-0ubuntu0.20.04.1 amd64
NVIDIA headless metapackage - no DKMS
nvidia-headless-no-dkms-470-server/focal-updates 470.57.02-0ubuntu0.20.04.2 amd64
NVIDIA headless metapackage - no DKMS
xserver-xorg-video-nvidia-390/focal-security,focal-updates 390.144-0ubuntu0.20.04.1 amd64
NVIDIA binary Xorg driver
xserver-xorg-video-nvidia-418-server/focal-security,focal-updates 418.211.00-0ubuntu0.20.04.1 amd64
NVIDIA binary Xorg driver
xserver-xorg-video-nvidia-450-server/focal-security,focal-updates 450.142.00-0ubuntu0.20.04.1 amd64
NVIDIA binary Xorg driver
xserver-xorg-video-nvidia-460/focal-security,focal-updates 460.91.03-0ubuntu0.20.04.1 amd64
NVIDIA binary Xorg driver
xserver-xorg-video-nvidia-460-server/focal-security,focal-updates 460.91.03-0ubuntu0.20.04.1 amd64
NVIDIA binary Xorg driver
xserver-xorg-video-nvidia-470/focal-security,focal-updates,now 470.57.02-0ubuntu0.20.04.1 amd64 [installed,automatic]
NVIDIA binary Xorg driver
xserver-xorg-video-nvidia-470-server/focal-updates 470.57.02-0ubuntu0.20.04.2 amd64
NVIDIA binary Xorg driver
答案1
我在 20.04 上遇到了类似的问题,更新重新启动时锁定在低分辨率图形中。我导航到菜单\管理\软件和更新\附加驱动程序并选择 X.Org 驱动程序而不是 NVIDIA,然后恢复正常服务。
答案2
您需要删除所有旧驱动程序然后重新安装。
首先删除旧的驱动程序,如下所示:
sudo apt-get remove --purge '^nvidia-.*'
然后使用自动安装来确保您获得正确的版本。
sudo ubuntu-drivers autoinstall
最后您只需重新启动即可。
sudo reboot
答案3
虽然上述答案对很多人来说可能有用,但以下是对我有用的。请注意,我正在运行 Ubuntu 22.04 和 RTX-4090。
- 删除所有与 nvidia 相关的安装
sudo apt-get remove --purge '^nvidia-.*'
sudo apt-get remove --purge '^libnvidia-.*'
sudo apt-get remove --purge '^cuda-.*'
- 这将安全地删除所有安装
sudo apt autoremove
- 安装 nvidia 工具包
sudo apt install --upgrade nvidia-cuda-toolkit
- 安装最新的 nvidia 驱动程序
sudo ubuntu-drivers autoinstall
执行此操作后,系统会要求您设置一个密码,该密码将有助于在安全启动中验证 MOK。
重新启动系统并验证密码以在安全启动中设置 MOK
瞧,你的驱动程序将再次按预期开始工作!
答案4
确保已安装 nvidia-prime 包:
sudo apt install nvidia-prime
然后运行
sudo prime-select nvidia
请检查文件
/lib/modprobe.d/blacklist-nvidia.conf
存在,删除它,然后运行
sudo update-initramfs -u
然后重新启动。