我尝试从 18.04 升级到 20.04,但有一些被阻止的软件包似乎阻碍了我,我真的不知道如何正确修复它们。日志文件显示
2020-04-24 17:38:44,134 ERROR Dist-upgrade failed: 'Broken packages after upgrade: colord'
按照说明检查 apt.log,我发现有几个错误
Broken colord:amd64 Depends on libsane:amd64 < none | 1.0.29-0ubuntu5 @un umH > (>= 1.0.24)
Considering libsane:amd64 15 as a solution to colord:amd64 37
Added libsane:amd64 to the remove list
Fixing colord:amd64 via keep of libsane:amd64
Broken libsensors-config:amd64 Conflicts on libsensors4:amd64 < 1:3.4.0-4 @ii gK >
Considering libsensors4:amd64 34 as a solution to libsensors-config:amd64 1
MarkKeep libsensors-config:amd64 < none -> 1:3.6.0-2ubuntu1 @un umN Ib > FU=0
Holding Back libsensors-config:amd64 rather than change libsensors4:amd64
Investigating (3) libsensors5:amd64 < none -> 1:3.6.0-2ubuntu1 @un umN Ib >
Broken libsensors5:amd64 Depends on libsensors-config:amd64 < none | 1:3.6.0-2ubuntu1 @un umH >
Considering libsensors-config:amd64 1 as a solution to libsensors5:amd64 2
MarkKeep libsensors5:amd64 < none -> 1:3.6.0-2ubuntu1 @un umN Ib > FU=0
Holding Back libsensors5:amd64 rather than change libsensors-config:amd64
Investigating (3) lm-sensors:amd64 < 1:3.4.0-4 -> 1:3.6.0-2ubuntu1 @ii umU Ib >
Broken lm-sensors:amd64 Depends on libsensors5:amd64 < none | 1:3.6.0-2ubuntu1 @un umH > (>= 1:3.5.0)
Considering libsensors5:amd64 2 as a solution to lm-sensors:amd64 0
MarkKeep lm-sensors:amd64 < 1:3.4.0-4 -> 1:3.6.0-2ubuntu1 @ii umU Ib > FU=0
Holding Back lm-sensors:amd64 rather than change libsensors5:amd64
Investigating (4) libsnmp35:amd64 < none -> 5.8+dfsg-2ubuntu2 @un umN Ib >
Broken libsnmp35:amd64 Depends on libsensors5:amd64 < none | 1:3.6.0-2ubuntu1 @un umH > (>= 1:3.5.0)
Considering libsensors5:amd64 2 as a solution to libsnmp35:amd64 7
MarkKeep libsnmp35:amd64 < none -> 5.8+dfsg-2ubuntu2 @un umN Ib > FU=0
Holding Back libsnmp35:amd64 rather than change libsensors5:amd64
Try to Re-Instate (4) lm-sensors:amd64
MarkKeep lm-sensors:amd64 < 1:3.4.0-4 -> 1:3.6.0-2ubuntu1 @ii umU Ib > FU=0
Investigating (5) libsane:amd64 < none -> 1.0.29-0ubuntu5 @un umN Ib >
Broken libsane:amd64 Depends on libsnmp35:amd64 < none | 5.8+dfsg-2ubuntu2 @un umH > (>= 5.8+dfsg)
Considering libsnmp35:amd64 7 as a solution to libsane:amd64 15
MarkKeep libsane:amd64 < none -> 1.0.29-0ubuntu5 @un umN Ib > FU=0
Holding Back libsane:amd64 rather than change libsnmp35:amd64
还有一些错误,但它们似乎又回到了同样的错误。我尝试更新/升级,修复损坏的软件包,根据反馈,没有任何办法。
有人有什么想法吗?
答案1
在一次几乎完成的升级中止后,我遇到了非常类似的问题。我已经libsensors4
安装了,如果我尝试删除它或安装libsensors5
,大量其他软件包也会被删除。
问题是我的libgl1-mesa-dri
依赖于libsensors4
,如下所示:
$ apt-cache rdepends libsensors4
libsensors4
Reverse Depends:
lm-sensors
sysstat
libgl1-mesa-dri
libsensors-config
libsensors-config
这个软件包不是来自 Ubuntu 官方软件包存储库,而是来自 ppa kisak/kisak-mesa
。你可以在它的版本字符串中看到它20.0.7~kisak1~b
——问题还在于它比 Ubuntu 的版本更高:
$ sudo apt list libgl1-mesa-dri
Listing... Done
libgl1-mesa-dri/now 20.0.7~kisak1~b amd64 [installed,local]
libgl1-mesa-dri/focal 20.0.4-2ubuntu1 i386 [residual-config]
所以我的解决方案(如下)是从这个 PPA 中删除软件包。如果您在执行上述命令时得到类似的输出,请尝试以下操作来清除 PPA:
$ sudo ppa-purge -o kisak -p kisak-mesa
Updating packages lists
PPA to be removed: kisak kisak-mesa
Warning: Could not find package list for PPA: kisak kisak-mesa
如果您无法清除它,如上所示,请先添加 PPA,然后再次清除它。如果是另一个 PPA 阻止了您,请在以下命令中替换名称。
$ sudo add-apt-repository ppa:kisak/kisak-mesa
[...]
$ sudo ppa-purge -o kisak -p kisak-mesa
[...]
Suggested packages:
lm-sensors
The following packages will be REMOVED:
libsensors4
The following NEW packages will be installed:
libllvm9:i386 libsensors-config libsensors5
The following packages will be DOWNGRADED:
libegl-mesa0 libegl1-mesa libegl1-mesa-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libglapi-mesa:i386 libglx-mesa0
libosmesa6 libosmesa6:i386 mesa-opencl-icd mesa-va-drivers mesa-vdpau-drivers mesa-vulkan-drivers mesa-vulkan-drivers:i386
现在 PPA 已经消失,apt 可以更好地工作了。最后,确保已安装所有桌面软件包:
$ sudo apt install ubuntu-desktop
答案2
在 Ubuntu 20.04.1 LTS 上
从官方 Ubuntu 存储库手动下载软件包libsensors5
并强制安装:libsensors-config
$ wget http://archive.ubuntu.com/ubuntu/pool/main/l/lm-sensors/libsensors5_3.6.0-2ubuntu1_amd64.deb
$ wget http://archive.ubuntu.com/ubuntu/pool/main/l/lm-sensors/libsensors-config_3.6.0-2ubuntu1_all.deb
$ sudo dpkg -i --force-all libsensors5_3.6.0-2ubuntu1_amd64.deb libsensors-config_3.6.0-2ubuntu1_all.deb
最后一个命令产生以下输出:
Selecting previously unselected package libsensors5:amd64.
(Reading database ... 655733 files and directories currently installed.)
Preparing to unpack libsensors5_3.6.0-2ubuntu1_amd64.deb ...
Unpacking libsensors5:amd64 (1:3.6.0-2ubuntu1) ...
Selecting previously unselected package libsensors-config.
dpkg: considering removing libsensors4:amd64 in favour of libsensors-config ...
dpkg: warning: ignoring dependency problem with removal of libsensors4:amd64:
lm-sensors depends on libsensors4 (>= 1:3.1.1)
libsensors4:amd64 is to be removed.
dpkg: warning: ignoring dependency problem with removal of libsensors4:amd64:
libgl1-mesa-dri:amd64 depends on libsensors4 (>= 1:3.0.0)
libsensors4:amd64 is to be removed.
dpkg: yes, will remove libsensors4:amd64 in favour of libsensors-config
Preparing to unpack libsensors-config_3.6.0-2ubuntu1_all.deb ...
Unpacking libsensors-config (1:3.6.0-2ubuntu1) ...
Setting up libsensors-config (1:3.6.0-2ubuntu1) ...
Installing new version of config file /etc/sensors3.conf ...
Setting up libsensors5:amd64 (1:3.6.0-2ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
结束语:
$ sudo apt --fix-broken install
导致:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libegl-mesa0 libgbm1 libgl1-mesa-dri libglapi-mesa libglx-mesa0 libosmesa6 lm-sensors
Suggested packages:
fancontrol read-edid i2c-tools
The following packages will be upgraded:
libegl-mesa0 libgbm1 libgl1-mesa-dri libglapi-mesa libglx-mesa0 libosmesa6 lm-sensors
7 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
Need to get 12.5 MB of archives.
After this operation, 24.0 MB of additional disk space will be used.