自升级到 LTS 22.04.1 LTS 后无法安装新的窗口管理器

自升级到 LTS 22.04.1 LTS 后无法安装新的窗口管理器

几天前,我升级到 22.04.1 LTS 时,由于我不记得的 GPU 问题,升级到接近完成时停止了。现在我只能使用一个看起来很糟糕的窗口管理器。我正试图通过安装来解决这个问题选择wm但这也失败了,并出现了错误

Unpacking choosewm (0.1.6-3build1) ...
Setting up nvidia-dkms-390 (390.154-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/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
Removing old nvidia-390.154 DKMS files...
Deleting module nvidia-390.154 completely from the DKMS tree.
Loading new nvidia-390.154 DKMS files...
Building for 5.15.0-48-generic
Building for architecture x86_64
Building initial module for 5.15.0-48-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-kernel-s
ource-390.0.crash'
Error! Bad return status for module build on kernel: 5.15.0-48-generic (x86_64)
Consult /var/lib/dkms/nvidia/390.154/build/make.log for more information.
dpkg: error processing package nvidia-dkms-390 (--configure):
 installed nvidia-dkms-390 package post-installation script subprocess returned 
error exit status 10
Setting up choosewm (0.1.6-3build1) ...
update-alternatives: using /usr/bin/choosewm to provide /usr/bin/x-session-manag
er (x-session-manager) in auto mode
dpkg: dependency problems prevent configuration of nvidia-driver-390:
 nvidia-driver-390 depends on nvidia-dkms-390 (<= 390.154-1); however:
  Package nvidia-dkms-390 is not configured yet.
 nvidia-driver-390 depends on nvidia-dkms-390 (>= 390.154); however:
  Package nvidia-dkms-390 is not configured yet.

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

dpkg: error processing package nvidia-384 (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates it's a follow-up er
ror from a previous failure.
                            No apport report written because the error message i
ndicates it's a follow-up error from a previous failure.
                                                        Processing triggers for 
man-db (2.10.2-1) ...
Processing triggers for menu (2.1.47ubuntu4) ...
Processing triggers for initramfs-tools (0.140ubuntu13) ...
update-initramfs: Generating /boot/initrd.img-5.15.0-48-generic
Errors were encountered while processing:
 nvidia-dkms-390
 nvidia-driver-390################################.......................................] 
 nvidia-384
E: Sub-process /usr/bin/dpkg returned an error code (1)

该文件/var/crash/nvidia-kernel-source-390.0.crash包含

ProblemType: Package
DKMSBuildLog:
 DKMS make.log for nvidia-390.154 for kernel 5.15.0-48-generic (x86_64)
 Sun 25 Sep 06:04:23 BST 2022
 make[1]: Entering directory '/usr/src/linux-headers-5.15.0-48-generic'
 arch/x86/Makefile:142: CONFIG_X86_X32 enabled but no binutils support
 make[1]: /usr/bin/gcc: No such file or directory
 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)
 warning: the compiler differs from the one used to build the kernel
   The kernel was built by: gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
   You are using:           
 make -f ./scripts/Makefile.build obj=/var/lib/dkms/nvidia/390.154/build \
 single-build= \
 need-builtin=1 need-modorder=1
 
 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/390.154/build/Kbuild:187: cc_sanity_check] Error 1
 make[2]: *** Waiting for unfinished jobs....
 make[1]: *** [Makefile:1884: /var/lib/dkms/nvidia/390.154/build] Error 2
 make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-48-generic'
 make: *** [Makefile:81: modules] Error 2
DKMSKernelVersion: 5.15.0-48-generic
Date: Sun Sep 25 06:04:24 2022
Package: nvidia-kernel-source-390 390.154-0ubuntu0.22.04.1
PackageVersion: 390.154-0ubuntu0.22.04.1
SourcePackage: nvidia-graphics-drivers-390
Title: nvidia-kernel-source-390 390.154-0ubuntu0.22.04.1: nvidia kernel module failed to build

我该如何修复这个问题?

答案1

我最终通过清除并重新安装损坏的 wm 解决了这个问题

sudo apt purge lightdm 
sudo apt install lightdm 
sudo reboot
sudo dpkg-reconfigure lightdm 
sudo reboot

相关内容