内核更新后无法在 Ubuntu 19.10 上安装 Nvidia 驱动程序

内核更新后无法在 Ubuntu 19.10 上安装 Nvidia 驱动程序

过程:

sudo ubuntu-drivers autoinstall

失败了

Setting up nvidia-dkms-440 (440.59-0ubuntu0~0.19.10.1) ...
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
Loading new nvidia-440.59 DKMS files...
Building for 5.3.0-40-generic
Building for architecture x86_64
Building initial module for 5.3.0-40-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-kernel-source-440.0.crash'
Error! Bad return status for module build on kernel: 5.3.0-40-generic (x86_64)
Consult /var/lib/dkms/nvidia/440.59/build/make.log for more information.
dpkg: error processing package nvidia-dkms-440 (--configure):
 installed nvidia-dkms-440 package post-installation script subprocess returned error exit status 10

好的,让我们检查一下/var/lib/dkms/nvidia/440.59/build/make.log

DKMS make.log for nvidia-440.59 for kernel 5.3.0-40-generic (x86_64)
Mon 17 Feb 2020 12:33:02 PM CST
make[1]: Entering directory '/usr/src/linux-headers-5.3.0-40-generic'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (        \
echo >&2;                           \
echo >&2 "  ERROR: Kernel configuration is invalid.";       \
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
echo >&2 ;                          \
/bin/false)
make -f ./scripts/Makefile.build obj=/var/lib/dkms/nvidia/440.59/build need-modorder=1
clang: error: unsupported option '-dumpspecs'
clang: error: no input files

make oldconfig && make prepare失败:

等一下... 这会抛出clang错误吗?见下文:

答案1

sudo update-alternatives --all

clang将选定的所有内容更改回gcc

终于成功了。

答案2

我最终回滚到默认内核(对我来说是 5.0.0-32-generic)。这样,安装 Nvidia 驱动程序就没问题了。请注意,您需要卸载较新的内核,而不仅仅是运行较旧的内核。Nvidia 安装程序将尝试使用您安装的最新内核,而不是您正在运行的内核,因此您必须卸载较新的内核。

它可能适用于我最初尝试过的 5.7.4 以下的其他较新内核。我尝试过 5.4.48(最新的 LTS 内核),但在启动时出现了异常的绿屏死机。

在此处输入图片描述

相关内容