![部分升级破坏了我的系统](https://linux22.com/image/930846/%E9%83%A8%E5%88%86%E5%8D%87%E7%BA%A7%E7%A0%B4%E5%9D%8F%E4%BA%86%E6%88%91%E7%9A%84%E7%B3%BB%E7%BB%9F.png)
我现在使用的是 18.04,即将升级到 20.04。我的包管理器为我提供了部分升级和分布式升级两个选项。我认为最好先运行部分升级,然后在升级到 20.04 之前尝试解决所有未解决的问题。这似乎已经破坏了我的系统。重启后,它就挂起了,再也无法启动(我把它放了 24 多个小时,它一直处于黑白 TTY 状态,上面只有一条消息,说 /dev/sda1 是干净的)。
我可以重新启动并选择以前的内核版本 (5.4.0-51-generic),我的系统启动了,但使用的是 nouveau 驱动程序,分辨率太差了。不幸的是,显示选项没有提供任何更改选项,所以我尝试安装 nvidia 专有驱动程序(再次安装 - 它们之前已安装)。我仍然可以使用旧内核启动,但我似乎无法修复损坏的软件包。例如:
$ sudo apt install nvidia-driver-455
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libnvidia-gl-450-server : Depends: libnvidia-common-450-server but it is not going to be installed
libnvidia-gl-450-server:i386 : Depends: libnvidia-common-450-server:i386
nvidia-driver-455 : Depends: libnvidia-gl-455 (= 455.32.00-0ubuntu1) but it is not going to be installed
Depends: nvidia-dkms-455 (= 455.32.00-0ubuntu1) but it is not going to be installed
Depends: nvidia-kernel-source-455 (= 455.32.00-0ubuntu1) but it is not going to be installed
Depends: libnvidia-compute-455 (= 455.32.00-0ubuntu1) but it is not going to be installed
Depends: libnvidia-extra-455 (= 455.32.00-0ubuntu1) but it is not going to be installed
Depends: nvidia-compute-utils-455 (= 455.32.00-0ubuntu1) but it is not going to be installed
Depends: libnvidia-decode-455 (= 455.32.00-0ubuntu1) but it is not going to be installed
Depends: libnvidia-encode-455 (= 455.32.00-0ubuntu1) but it is not going to be installed
Depends: nvidia-utils-455 (= 455.32.00-0ubuntu1) but it is not going to be installed
Depends: xserver-xorg-video-nvidia-455 (= 455.32.00-0ubuntu1) but it is not going to be installed
Depends: libnvidia-cfg1-455 (= 455.32.00-0ubuntu1) but it is not going to be installed
Depends: libnvidia-ifr1-455 (= 455.32.00-0ubuntu1) but it is not going to be installed
Depends: libnvidia-fbc1-455 (= 455.32.00-0ubuntu1) but it is not going to be installed
Recommends: libnvidia-compute-455:i386 (= 455.32.00-0ubuntu1)
Recommends: libnvidia-decode-455:i386 (= 455.32.00-0ubuntu1)
Recommends: libnvidia-encode-455:i386 (= 455.32.00-0ubuntu1)
Recommends: libnvidia-ifr1-455:i386 (= 455.32.00-0ubuntu1)
Recommends: libnvidia-fbc1-455:i386 (= 455.32.00-0ubuntu1)
Recommends: libnvidia-gl-455:i386 (= 455.32.00-0ubuntu1)
$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
libnvidia-common-450
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
libnvidia-common-450-server
The following NEW packages will be installed:
libnvidia-common-450-server
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
5 not fully installed or removed.
Need to get 9,928 B of archives.
After this operation, 35.8 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 libnvidia-common-450-server all 450.80.02-0ubuntu0.18.04.3 [9,928 B]
Fetched 9,928 B in 0s (88.0 kB/s)
(Reading database ... 282148 files and directories currently installed.)
Preparing to unpack .../libnvidia-common-450-server_450.80.02-0ubuntu0.18.04.3_all.deb ...
Unpacking libnvidia-common-450-server (450.80.02-0ubuntu0.18.04.3) ...
dpkg: error processing archive /var/cache/apt/archives/libnvidia-common-450-server_450.80.02-0ubuntu0.18.04.3_all.deb (--unpack):
trying to overwrite '/usr/share/nvidia/nvidia-application-profiles-450.80.02-key-documentation', which is also in package libnvidia-common-450 450.80.02-0ubuntu1
Errors were encountered while processing:
/var/cache/apt/archives/libnvidia-common-450-server_450.80.02-0ubuntu0.18.04.3_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我该如何恢复运行?我可以在 18.04 上修复问题吗?还是我只需使用 20.04 USB 密钥启动并告诉它升级我现有的安装?我试过运行,apt autoclean
但apt clean
这些都无济于事。
答案1
我通过简单地尝试删除libnvidia-gl-450-server
软件包解决了这个问题,然后它会抱怨这个libnvidia-gl-450-server:i386
软件包,然后它会抱怨另一个软件包,等等。我不断地重新运行命令,添加它抱怨的每个新软件包,直到我最终得到需要删除的软件包的完整列表。最终,这恰好是我的列表,但它可能会因您的系统和/或哪些软件包损坏而有所不同:
sudo apt-get remove libnvidia-gl-450-server libnvidia-gl-450-server:i386 nvidia-driver-450-server libnvidia-ifr1-450-server libnvidia-ifr1-450-server:i386
然后我运行sudo apt update
它,它成功完成了。我安装了所有等待的更新,重新启动了我的计算机(因为有一个内核更新),现在它可以在最新内核上使用功能齐全的 nvidia 驱动程序正常启动,并且我的软件包系统已修复。我现在将继续进行 LTS 更新。
答案2
首先,读取刚刚运行的命令的输出:
您可能需要运行“apt --fix-broken install”来纠正这些问题。
...现在就这么做,据我所知,这是一个值得尝试的明智选择。
如果这没有帮助,则删除有问题的包;即
sudo apt purge nvidia-driver-455
接下来是清理剩余内容的选项。例如
sudo apt 自动删除
sudo apt 自动清洁
第一行上的软件包名称,例如libnvidia-gl-450-server:i386
,可能表明您使用的是 32 位系统 - 例如通过显示:386
。
我很确定,读到过的消息称,对基础 Ubuntu 的 32 位系统支持已经被放弃:如果您确实想升级 32 位系统;您可能需要查找另一个仍然支持旧架构的发行版。
如果不是这种情况,请尝试其他 nvidia 驱动程序包,甚至 nvidia 提供的运行时(从恢复控制台运行它!),假设有一个适合硬件的版本。