如何修复 ubuntu 20.04 上的 nvidia-dkms-440-x 配置失败

如何修复 ubuntu 20.04 上的 nvidia-dkms-440-x 配置失败

我最近将我的桌面升级到了 Ubuntu 20.04。但是在安装显卡驱动程序时,似乎出现了问题。

当我打开“软件和更新”应用程序时,它显示 Ubuntu 将我的卡发现为“NVIDIA Corperation: TU116[GeForce GTX 1660 SUPER]”,它为我提供了以下选项:

• Using NVIDIA driver metapackage from nvidia-driver-440 (proprietary, tested)
• Using X.Org.X server – Nouveau display driver from xserver-xorg-video-nouveau (open source) 

当我尝试选择 nvidia 选项时,似乎出现了一些问题,并出现了以下错误:

Error while applying changes
pk-client-error-quark: Error while installing package: installed nvidia-dmks-440 package post-installation script subprocess returned error status 10(313)

当我尝试通过命令行安装驱动程序时,我得到以下信息:

After this operation, 37,3 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Selecting previously unselected package nvidia-compute-utils-440.
(Reading database ... 402066 files and directories currently installed.)
Preparing to unpack .../0-nvidia-compute-utils-440_440.82+really.440.64-0ubuntu6_amd64.deb ...
Unpacking nvidia-compute-utils-440 (440.82+really.440.64-0ubuntu6) ...
Selecting previously unselected package nvidia-kernel-source-440.
Preparing to unpack .../1-nvidia-kernel-source-440_440.82+really.440.64-0ubuntu6_amd64.deb ...
Unpacking nvidia-kernel-source-440 (440.82+really.440.64-0ubuntu6) ...
Selecting previously unselected package nvidia-kernel-common-440.
Preparing to unpack .../2-nvidia-kernel-common-440_440.82+really.440.64-0ubuntu6_amd64.deb ...
Unpacking nvidia-kernel-common-440 (440.82+really.440.64-0ubuntu6) ...
Selecting previously unselected package nvidia-dkms-440.
Preparing to unpack .../3-nvidia-dkms-440_440.82+really.440.64-0ubuntu6_amd64.deb ...
Unpacking nvidia-dkms-440 (440.82+really.440.64-0ubuntu6) ...
Selecting previously unselected package nvidia-utils-440.
Preparing to unpack .../4-nvidia-utils-440_440.82+really.440.64-0ubuntu6_amd64.deb ...
Unpacking nvidia-utils-440 (440.82+really.440.64-0ubuntu6) ...
Selecting previously unselected package nvidia-driver-440.
Preparing to unpack .../5-nvidia-driver-440_440.82+really.440.64-0ubuntu6_amd64.deb ...
Unpacking nvidia-driver-440 (440.82+really.440.64-0ubuntu6) ...
Setting up nvidia-kernel-source-440 (440.82+really.440.64-0ubuntu6) ...
Setting up nvidia-utils-440 (440.82+really.440.64-0ubuntu6) ...
Setting up nvidia-compute-utils-440 (440.82+really.440.64-0ubuntu6) ...
Warning: The home dir /nonexistent you specified can't be accessed: No such file or directory
Adding system user `nvidia-persistenced' (UID 124) ...
Adding new group `nvidia-persistenced' (GID 130) ...
Adding new user `nvidia-persistenced' (UID 124) with group `nvidia-persistenced' ...
Not creating home directory `/nonexistent'.
Setting up nvidia-kernel-common-440 (440.82+really.440.64-0ubuntu6) ...
update-initramfs: deferring update (trigger activated)
Setting up nvidia-dkms-440 (440.82+really.440.64-0ubuntu6) ...
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.64 DKMS files...
Building for 5.4.0-31-generic
Building for architecture x86_64
Building initial module for 5.4.0-31-generic
Error! Bad return status for module build on kernel: 5.4.0-31-generic (x86_64)
Consult /var/lib/dkms/nvidia/440.64/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
dpkg: dependency problems prevent configuration of nvidia-driver-440:
 nvidia-driver-440 depends on nvidia-dkms-440 (= 440.82+really.440.64-0ubuntu6) | nvidia-dkms-440 (= 440.82+really.440.64-0ubuntu4); however:
  Package nvidia-dkms-440 is not configured yet.
  Version of nvidia-dkms-440 on system is 440.82+really.440.64-0ubuntu6.

dpkg: error processing package nvidia-driver-440 (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates it's a follow-up error from a previous failure.
                                                                                                            Processing triggers for man-db (2.9.1-1) ...
Processing triggers for initramfs-tools (0.136ubuntu6) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-31-generic
Errors were encountered while processing:
 nvidia-dkms-440
 nvidia-driver-440
E: Sub-process /usr/bin/dpkg returned an error code (1)

/var/crash/nvidia-dkms-440.0.crash 的内容

ProblemType: Package
DKMSBuildLog:
 DKMS make.log for nvidia-440.64 for kernel 5.4.0-31-generic (x86_64)
 Mi 20 Mai 2020 14:36:56 CEST
 make[1]: Entering directory '/usr/src/linux-headers-5.4.0-31-generic'
 arch/x86/Makefile:147: CONFIG_X86_X32 enabled but no binutils support
 make[1]: /usr/bin/gcc: Command not found
 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.64/build \
 single-build= \
 need-builtin=1 need-modorder=1
 /bin/sh: 1: cc: not found

 The C compiler '/usr/bin/gcc' does not appear to be able to
 create object files.  Please make sure you have 
 your Linux distribution's libc development package
 installed and that '/usr/bin/gcc' is a valid C compiler
 name.

 *** Failed CC sanity check. Bailing out! ***

 make[2]: *** [/var/lib/dkms/nvidia/440.64/build/Kbuild:194: cc_sanity_check] Error 1
 make[2]: *** Waiting for unfinished jobs....
 make[1]: *** [Makefile:1719: /var/lib/dkms/nvidia/440.64/build] Error 2
 make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-31-generic'
 make: *** [Makefile:81: modules] Error 2
DKMSKernelVersion: 5.4.0-31-generic
Date: Wed May 20 14:36:58 2020
Package: nvidia-dkms-440 440.82+really.440.64-0ubuntu6
PackageVersion: 440.82+really.440.64-0ubuntu6
SourcePackage: nvidia-graphics-drivers-440
Title: nvidia-dkms-440 440.82+really.440.64-0ubuntu6: nvidia kernel module failed to build

答案1

忽略了这一点感觉很傻,但显然由于 GCC 没有正确升级而出现了一些编译错误。

我已经重新安装了 GCC,然后它运行得很好。

gcc首先,使用以下命令识别版本gcc -v

$海湾合作委员会
gcc 版本 9.4.0(Ubuntu 9.4.0-1ubuntu1~20.04)   

然后重新安装gcc

sudo apt-get install --reinstall gcc-9.4.0  

9.4.0随着你的版本而改变。

答案2

我确认。我在安装 Ububntu 时遇到了某种无法恢复的错误。安装后启动 Ubuntu 时,我无法更改显卡驱动程序。在终端中输入命令后:

sudo apt reinstall build-essential

我可以更改显卡驱动程序。

相关内容