每次我在终端上安装程序时,Ubuntu 20.04 都会尝试卸载 nvidia 驱动程序

每次我在终端上安装程序时,Ubuntu 20.04 都会尝试卸载 nvidia 驱动程序

我遇到了一个奇怪的问题,我从来没有见过任何人遇到过这个问题,我是 Linux 的新手,我不知道这是一个容易解决的问题还是我只是个菜鸟,但每次我在终端上使用 apt-get 或 update 时,操作都会正常进行,但之后终端就会显示这个卸载开始

nvidia 驱动程序并没有真正被卸载,只是在最后出现错误(错误 1),然后我能够关闭终端,但需要一些时间才能完成,我该如何修复或防止这种情况发生?

编辑1:

这是终端的完整命令行,这次我尝试安装 smb 以便与另一台计算机共享文件,并且 Linux 再次显示一条消息,试图卸载我的 nvidia 驱动程序:

installArchives() failed: Pr-configurando pacotes ...
Pr-configurando pacotes ...
Selecting previously unselected package python3-dnspython.
(Reading database ... 
(Reading database ... 5%%
(Reading database ... 10%%
(Reading database ... 15%%
(Reading database ... 20%%
(Reading database ... 25%%
(Reading database ... 30%%
(Reading database ... 35%%
(Reading database ... 40%%
(Reading database ... 45%%
(Reading database ... 50%%
(Reading database ... 55%%
(Reading database ... 60%%
(Reading database ... 65%%
(Reading database ... 70%%
(Reading database ... 75%%
(Reading database ... 80%%
(Reading database ... 85%%
(Reading database ... 90%%
(Reading database ... 95%%
(Reading database ... 100%%
(Reading database ... 312573 files and directories currently installed.)
Preparing to unpack .../0-python3-dnspython_1.16.0-1build1_all.deb ...
Unpacking python3-dnspython (1.16.0-1build1) ...
Selecting previously unselected package python3-crypto.
Preparing to unpack .../1-python3-crypto_2.6.1-13ubuntu2_amd64.deb ...
Unpacking python3-crypto (2.6.1-13ubuntu2) ...
Selecting previously unselected package python3-ldb.
Preparing to unpack .../2-python3-ldb_2%%3a2.0.10-0ubuntu0.20.04.2_amd64.deb ...
Unpacking python3-ldb (2:2.0.10-0ubuntu0.20.04.2) ...
Selecting previously unselected package python3-tdb.
Preparing to unpack .../3-python3-tdb_1.4.2-3build1_amd64.deb ...
Unpacking python3-tdb (1.4.2-3build1) ...
Selecting previously unselected package python3-samba.
Preparing to unpack .../4-python3-samba_2%%3a4.11.6+dfsg-0ubuntu1.6_amd64.deb ...
Unpacking python3-samba (2:4.11.6+dfsg-0ubuntu1.6) ...
Selecting previously unselected package samba-common.
Preparing to unpack .../5-samba-common_2%%3a4.11.6+dfsg-0ubuntu1.6_all.deb ...
Unpacking samba-common (2:4.11.6+dfsg-0ubuntu1.6) ...
Selecting previously unselected package samba-common-bin.
Preparing to unpack .../6-samba-common-bin_2%%3a4.11.6+dfsg-0ubuntu1.6_amd64.deb ...
Unpacking samba-common-bin (2:4.11.6+dfsg-0ubuntu1.6) ...
Selecting previously unselected package tdb-tools.
Preparing to unpack .../7-tdb-tools_1.4.2-3build1_amd64.deb ...
Unpacking tdb-tools (1.4.2-3build1) ...
Selecting previously unselected package samba.
Preparing to unpack .../8-samba_2%%3a4.11.6+dfsg-0ubuntu1.6_amd64.deb ...
Unpacking samba (2:4.11.6+dfsg-0ubuntu1.6) ...
Setting up nvidia-340 (340.108-0ubuntu2) ...
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia-340
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-340-340.108 DKMS files...

-------- Uninstall Beginning --------
Module:  nvidia-340
Version: 340.108
Kernel:  5.4.0-050400-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

nvidia.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.4.0-050400-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


nvidia_uvm.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.4.0-050400-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod.......

DKMS: uninstall completed.

------------------------------
Deleting module version: 340.108
completely from the DKMS tree.
------------------------------
Done.
Loading new nvidia-340-340.108 DKMS files...
Building for 5.4.0-050400-generic 5.10.9-051009-generic
Building for architecture x86_64
Building initial module for 5.4.0-050400-generic
Done.

nvidia.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.0-050400-generic/updates/dkms/

nvidia_uvm.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.0-050400-generic/updates/dkms/

depmod.......

DKMS: install completed.
Building initial module for 5.10.9-051009-generic
ERROR (dkms apport): kernel package linux-headers-5.10.9-051009-generic is not supported
Error! Bad return status for module build on kernel: 5.10.9-051009-generic (x86_64)
Consult /var/lib/dkms/nvidia-340/340.108/build/make.log for more information.
dpkg: error processing package nvidia-340 (--configure):
 installed nvidia-340 package post-installation script subprocess returned error exit status 10
Setting up samba-common (2:4.11.6+dfsg-0ubuntu1.6) ...

Creating config file /etc/samba/smb.conf with new version
Setting up python3-tdb (1.4.2-3build1) ...
Setting up tdb-tools (1.4.2-3build1) ...
update-alternatives: using /usr/bin/tdbbackup.tdbtools to provide /usr/bin/tdbbackup (tdbbackup) in auto mode
Setting up python3-ldb (2:2.0.10-0ubuntu0.20.04.2) ...
Setting up python3-dnspython (1.16.0-1build1) ...
Setting up python3-crypto (2.6.1-13ubuntu2) ...
Setting up python3-samba (2:4.11.6+dfsg-0ubuntu1.6) ...
Setting up samba-common-bin (2:4.11.6+dfsg-0ubuntu1.6) ...
Checking smb.conf with testparm
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Server role: ROLE_STANDALONE

Done
Setting up samba (2:4.11.6+dfsg-0ubuntu1.6) ...
Samba is not being run as an AD Domain Controller: Masking samba-ad-dc.service
Please ignore the following error about deb-systemd-helper not finding those services.
(samba-ad-dc.service masked)
Created symlink /etc/systemd/system/multi-user.target.wants/nmbd.service  /lib/systemd/system/nmbd.service.
Failed to preset unit: Unit file /etc/systemd/system/samba-ad-dc.service is masked.
/usr/bin/deb-systemd-helper: error: systemctl preset failed on samba-ad-dc.service: No such file or directory
Created symlink /etc/systemd/system/multi-user.target.wants/smbd.service  /lib/systemd/system/smbd.service.
samba-ad-dc.service is a disabled or a static unit, not starting it.
Processing triggers for ufw (0.36-6) ...
Processing triggers for systemd (245.4-4ubuntu3.4) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
Processing triggers for initramfs-tools (0.136ubuntu6.3) ...
update-initramfs: Generating /boot/initrd.img-5.10.9-051009-generic
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8125b-2.fw for module r8169
Errors were encountered while processing:
 nvidia-340
Setting up nvidia-340 (340.108-0ubuntu2) ...
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia-340
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-340-340.108 DKMS files...

-------- Uninstall Beginning --------
Module:  nvidia-340
Version: 340.108
Kernel:  5.4.0-050400-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

nvidia.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.4.0-050400-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


nvidia_uvm.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.4.0-050400-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod........

DKMS: uninstall completed.

------------------------------
Deleting module version: 340.108
completely from the DKMS tree.
------------------------------
Done.
Loading new nvidia-340-340.108 DKMS files...
Building for 5.4.0-050400-generic 5.10.9-051009-generic
Building for architecture x86_64
Building initial module for 5.4.0-050400-generic
^Cdpkg: error processing package nvidia-340 (--configure):
 installed nvidia-340 package post-installation script subprocess was interrupted
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
Processing triggers for initramfs-tools (0.136ubuntu6.3) ...
update-initramfs: Generating /boot/initrd.img-5.10.9-051009-generic
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8125b-2.fw for module r8169
^Cdpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script subprocess was interrupted

答案1

回答我自己的问题,我找到了解决问题的方法,因为我安装了 Ubuntu 20.04.1 LTS,该系统附带内核 5.8,我的 nvidia 驱动程序版本不支持(nvidia-340)所以我不得不降级到内核 5.4 才能使用专有驱动程序而不是 nouveau,降级后,我开始遇到这个问题,我的电脑里有两个内核,这是一个冲突,我不知道为什么,因为我们可以选择哪个内核来启动系统,但我能够通过删除内核 5.8 并只让我的 nvidia 驱动程序使用内核 5.4 来解决这个问题。

相关内容