更新 ubuntu 22.04 时,由于 nvidia 驱动程序导致更新中断

更新 ubuntu 22.04 时,由于 nvidia 驱动程序导致更新中断

大约一个月前,我将 Ubuntu 更新到了 22.04,从那时起,我意识到每当我尝试安装任何东西时,sudo apt update && sudo apt install signal-desktop都会出现类似的错误:

Setting up nvidia-dkms-470 (470.161.03-0ubuntu0.22.04.1) ...
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
Removing old nvidia-470.161.03 DKMS files...
Deleting module nvidia-470.161.03 completely from the DKMS tree.
Loading new nvidia-470.161.03 DKMS files...
Building for 5.15.0-60-generic
Building for architecture x86_64
Building initial module for 5.15.0-60-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-kernel-source-470.0.crash'
Error! Bad return status for module build on kernel: 5.15.0-60-generic (x86_64)
Consult /var/lib/dkms/nvidia/470.161.03/build/make.log for more information.
dpkg: error processing package nvidia-dkms-470 (--configure): 
installed nvidia-dkms-470 package post-installation script subprocess
returned error exit status 10 dpkg: dependency problems prevent
configuration of nvidia-driver-470:  nvidia-driver-470 depends on
nvidia-dkms-470 (<= 470.161.03-1); however:
Package nvidia-dkms-470 is not configured yet.
nvidia-driver-470 depends on nvidia-dkms-470 (>= 470.161.03); however:
Package nvidia-dkms-470 is not configured yet.

dpkg: error processing package nvidia-driver-470 (--configure): 
dependency problems - leaving unconfigured dpkg:
dependency problems prevent configuration of nvidia-driver-460:
nvidia-driver-460 depends on nvidia-driver-470; however:
Package nvidia-driver-470 is not configured yet.

dpkg: error processing package nvidia-driver-460 (--configure): 
dependency problems - leaving unconfigured No apport report written
because the error message indicates it's a follow-up error from a
previous failure.
                                                                                                            No apport report written because the error message indicates it's a
follow-up error from a prev ious failure.
             Processing triggers for initramfs-tools (0.140ubuntu13.1) ... update-initramfs: Generating /boot/initrd.img-5.15.0-60-generic

如果我查看 /var/lib/dkms/nvidia/470.161.03/build/make.log 我可以看到:

DKMS make.log for nvidia-470.161.03 for kernel 5.15.0-60-generic
(x86_64) Mon 27 Feb 14:04:55 GMT 2023 make[1]: Entering directory
'/usr/src/linux-headers-5.15.0-60-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)

ERROR: Kernel configuration is invalid.
include/generated/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
make[1]: *** [Makefile:750: include/config/auto.conf] Error 1 make[1]:
Leaving directory '/usr/src/linux-headers-5.15.0-60-generic' make: ***
[Makefile:80: modules] Error 2

我在网上查找过,也尝试过卸载/重新安装步骤,但都没有成功。我也找不到“配置”的方法。

如果我尝试运行,make oldconfig && make prepare我得到的是:

make: *** No rule to make target 'oldconfig'. Stop.

有谁遇到过类似的问题,或者有什么我可以尝试的想法吗?


uname -r

5.15.0-60-generic

sudo apt 安装 linux-headers-$(uname -r)

Reading package lists...
Done Building dependency tree...
Done Reading
state information...
Done linux-headers-5.15.0-60-generic is already the newest version (5.15.0-60.66). 0 to upgrade, 0 to newly install, 0 to remove and 42 not to upgrade. 3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used. Do
you want to continue? [Y/n] y
Setting up nvidia-dkms-470 (470.161.03-0ubuntu0.22.04.1) ...
update-initramfs: deferring update
(trigger activated)
INFO:Enable nvidia DEBUG:Parsing
/usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad 
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
Removing old nvidia-470.161.03 DKMS files...
Deleting module nvidia-470.161.03 completely from the DKMS tree.
Loading new nvidia-470.161.03 DKMS files...
Building for 5.15.0-60-generic
Building for architecture x86_64
Building initial module for 5.15.0-60-generic
ERROR: Cannot create report: [Errno 17] File exists:
'/var/crash/nvidia-kernel-source-470.0.crash' Error! Bad return status for module build on kernel: 5.15.0-60-generic (x86_64)
Consult /var/lib/dkms/nvidia/470.161.03/build/make.log for more information.
dpkg: error processing package nvidia-dkms-470 (--configure): 
installed nvidia-dkms-470 package post-installation script subprocess
returned error exit status 10
dpkg: dependency problems prevent configuration of nvidia-driver-470:  nvidia-driver-470 depends on nvidia-dkms-470 (<= 470.161.03-1); however:   Package nvidia-dkms-470
is not configured yet.  nvidia-driver-470 depends on nvidia-dkms-470
(>= 470.161.03); however:   Package nvidia-dkms-470 is not configured yet.

dpkg: error processing package nvidia-driver-470 (--configure): 
dependency problems - leaving unconfigured dpkg: dependency problems
prevent configuration of nvidia-driver-460:  nvidia-driver-460 depends
on nvidia-driver-470; however:   Package nvidia-driver-470 is not
configured yet.

dpkg: error processing package nvidia-driver-460 (--configure): 
dependency problems - leaving unconfigured
No apport report written because the error message indicates it's a follow-up error from a previous failure.

No apport report written because the error message indicates it's a follow-up error from a prev ious failure.

Processing triggers for initramfs-tools (0.140ubuntu13.1) ...
update-initramfs: Generating /boot/initrd.img-5.15.0-60-generic
Errors were encountered while processing:  nvidia-dkms-470 
nvidia-driver-470  nvidia-driver-460
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

根据日志来看,这些文件似乎不存在:

/usr/src/linux-headers-5.15.0-60-generic/include/generated/autoconf.h
/usr/src/linux-headers-5.15.0-60-generic/include/config/auto.conf

由于提供这些文件的 linux-headers 包已经安装,安装可能已损坏。要重新安装当前内核头文件,请执行以下操作:

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

相关内容