首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >陷入依赖循环-ubuntu22.04

陷入依赖循环-ubuntu22.04
EN

Ask Ubuntu用户
提问于 2022-11-03 14:41:17
回答 2查看 752关注 0票数 1

以某种方式,im最终出现在包依赖循环中。当我试图升级我的软件包时,会出现以下情况:

代码语言:javascript
复制
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libapt-pkg6.0 : Depends: libgcrypt20 (>= 1.10.0) but 1.9.4-3ubuntu3 is installed
                 Depends: libzstd1 (>= 1.5.2) but 1.4.8+dfsg-3build1 is installed
                 Recommends: apt (>= 2.5.3) but 2.4.8 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

所以我尝试了sudo apt --fix-broken install

代码语言:javascript
复制
sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
 libapt-pkg6.0 : Depends: libgcrypt20 (>= 1.10.0) but 1.9.4-3ubuntu3 is installed
                 Depends: libzstd1 (>= 1.5.2) but 1.4.8+dfsg-3build1 is installed
                 Recommends: apt (>= 2.5.3) but 2.4.8 is installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies

然后我尝试删除/清除包sudo apt purge libapt-pkg6.0:amd64

代码语言:javascript
复制
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 apt : Depends: libapt-pkg6.0 (>= 2.4.8) but it is not going to be installed
 apt-utils : Depends: libapt-pkg6.0 (>= 2.4.8) but it is not going to be installed
 packagekit : Depends: libapt-pkg6.0 (>= 1.9.2) but it is not going to be installed
 python3-apt : Depends: libapt-pkg6.0 (>= 1.9.11~) but it is not going to be installed
 ubuntu-advantage-tools : Depends: libapt-pkg6.0 (>= 0.8.0) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

apt policy libapt-pkg6.0输出

代码语言:javascript
复制
libapt-pkg6.0:
  Installed: 2.5.3
  Candidate: 2.5.3
  Version table:
 *** 2.5.3 100
        100 /var/lib/dpkg/status
     2.4.8 500
        500 http://ch.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
     2.4.5 500
        500 http://ch.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

我也尝试过其他的方法,但我似乎还是坚持了这个立场。任何建议都会有帮助。

EN

回答 2

Ask Ubuntu用户

回答已采纳

发布于 2022-11-03 20:10:31

好吧,我想我找到了一个解决办法:

我第一次用:

代码语言:javascript
复制
sudo dpkg -r --force-depends libapt-pkg6.0:amd64

若要除去依赖项,则删除包。

然后我下载了正确的版本:

代码语言:javascript
复制
wget http://archive.ubuntu.com/ubuntu/pool/main/a/apt/libapt-pkg6.0_2.4.5_amd64.deb

然后安装:

代码语言:javascript
复制
sudo dpkg -i libapt-pkg6.0_2.4.5_amd64.deb

重新启动系统,然后更新和升级再次工作。

票数 0
EN

Ask Ubuntu用户

发布于 2022-11-03 17:14:23

看起来您在某个时候将22.10 (动能)软件包安装到了22.04 (jammy)系统上。

22.10 = 2.5.3版本中的libapt-pkg6.0。

教训:除非你是专家,否则不要混合Ubuntu不同版本的包。

你有三个选择:

  1. 如果您不知道这是如何发生的,并且/或不想花几个小时学习如何修复它,那么就需要重新安装22.04 (或22.10)。
  2. 另外,另一种解决方案是恢复使用22.10。这更复杂,因为您不能再使用do-release-upgrade,因为您的包有未满足的依赖项。这是否可能取决于你造成了多大的损害,你是如何造成的,以及你是否有能力修复它。它需要手动修复源,然后使用dist-upgrade。这不是一个支持的升级路径,所以如果您遇到问题,我们的建议是重新安装。
  3. 最复杂和最熟练的解决方案是卸载所有22.10包并从20.04存储库重新安装。这个解决方案有一个学习曲线,需要一些技巧与apt。它几乎肯定是更快和更简单的重新安装。
票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1438909

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档