![升级“包已被保留”如何解决?(具体案例)](https://linux22.com/image/945868/%E5%8D%87%E7%BA%A7%E2%80%9C%E5%8C%85%E5%B7%B2%E8%A2%AB%E4%BF%9D%E7%95%99%E2%80%9D%E5%A6%82%E4%BD%95%E8%A7%A3%E5%86%B3%EF%BC%9F%EF%BC%88%E5%85%B7%E4%BD%93%E6%A1%88%E4%BE%8B%EF%BC%89.png)
我在尝试升级时有一个包被保留下来:
$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
mesa-opencl-icd:i386
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
运行后apt list --upgradable
我看到:
“有另外 2 个版本。请使用‘-a’开关查看它们。”
于是我跑过去apt list --upgradable -a
,看到:
Listing... Done
mesa-opencl-icd/focal-updates,focal-security 21.2.6-0ubuntu0.1~20.04.2 i386 [upgradable from: 21.0.3-0ubuntu0.3~20.04.5]
mesa-opencl-icd/now 21.0.3-0ubuntu0.3~20.04.5 i386 [installed,upgradable to: 21.2.6-0ubuntu0.1~20.04.2]
mesa-opencl-icd/focal 20.0.4-2ubuntu1 i386
经过搜索,我发现了各种尝试修复此问题的方法,但它们涉及sudo apt-get dist-upgrade
并且我相信这可能会导致问题。此外sudo apt-get install <list of packages kept back>
,我不想强制安装系统阻止我安装的东西。
我希望找出发生这种情况的原因并解决依赖或冲突的问题。
我在 Xubuntu 20.04.4 LTS 上
有人可以就如何最好地解决这个特定问题提供建议吗?
编辑后没有运气sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
libclang-common-12-dev
Use 'sudo apt autoremove' to remove it.
The following packages have been kept back:
mesa-opencl-icd:i386
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
$ sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED
libclang-common-12-dev
0 to upgrade, 0 to newly install, 1 to remove and 1 not to upgrade.
After this operation, 65.6 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 301137 files and directories currently installed.)
Removing libclang-common-12-dev (1:12.0.0-3ubuntu1~20.04.5) ...
$ sudo apt update
Hit:1 http://archive.canonical.com/ubuntu focal InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
$ apt list --upgradable
Listing... Done
mesa-opencl-icd/focal-updates,focal-security 21.2.6-0ubuntu0.1~20.04.2 i386 [upgradable from: 21.0.3-0ubuntu0.3~20.04.5]
rsync/focal-updates,focal-security 3.1.3-8ubuntu0.3 amd64 [upgradable from: 3.1.3-8ubuntu0.2]
$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
mesa-opencl-icd:i386
The following packages will be upgraded:
rsync
1 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
1 standard security update
Need to get 318 kB of archives.
After this operation, 4,096 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://gb.archive.ubuntu.com/ubuntu focal-updates/main amd64 rsync amd64 3.1.3-8ubuntu0.3 [318 kB]
Fetched 318 kB in 0s (2,728 kB/s)
(Reading database ... 300703 files and directories currently installed.)
Preparing to unpack .../rsync_3.1.3-8ubuntu0.3_amd64.deb ...
Unpacking rsync (3.1.3-8ubuntu0.3) over (3.1.3-8ubuntu0.2) ...
Setting up rsync (3.1.3-8ubuntu0.3) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.15) ...
$ sudo apt update
Hit:1 http://ppa.launchpad.net/libretro/stable/ubuntu focal InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
mesa-opencl-icd:i386
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
$ sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
mesa-opencl-icd:i386
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
答案1
这为我解决了这个问题:
sudo apt-get install aptitude
sudo aptitude safe-upgrade
答案2
在我的系统上,我还有多个保留的软件包。在我的例子中,这些软件包没有更新 ( sudo apt-get dist-upgrade
),因为更新是分阶段更新。
分阶段更新是一种安全功能:它们不会同时向所有用户推出;只有部分用户在开始时会收到它们以报告潜在问题(请参阅此答案以获取更多信息)。
您可以通过运行来检查您的保留版本是否PackageA
包含分阶段更新apt-cache policy PackageA
。分阶段更新在“版本表”中以分阶段百分比表示。
答案3
您可以尝试使用已安装的现有工具。对我来说有效:
sudo apt full-upgrade