无法更新/安装curl(“以下软件包具有未满足的依赖关系”)

无法更新/安装curl(“以下软件包具有未满足的依赖关系”)

curl由于依赖项不匹配问题,我无法更新或安装。 (我尝试删除并重新安装,认为这可能有帮助,但没有。)

我的curl尝试:

pi@RECOVERY:~ $ sudo apt-get install curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 curl : Depends: libcurl3 (= 7.52.1-5+deb9u1) but 7.38.0-4+deb8u5 is to be installed
E: Unable to correct problems, you have held broken packages.

然后尝试其中一个依赖项:

pi@RECOVERY:~ $ sudo apt-get install libcurl3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libcurl3 : Depends: libgssapi-krb5-2 (>= 1.14+dfsg) but 1.12.1+dfsg-19+deb8u2 is to be installed
            Depends: libnghttp2-14 (>= 1.12.0) but it is not installable
            Depends: libpsl5 (>= 0.13.0) but it is not installable
            Depends: libssh2-1 (>= 1.7.0) but 1.4.3-4.1+deb8u1 is to be installed
            Depends: libssl1.0.2 (>= 1.0.2d) but it is not installable
E: Unable to correct problems, you have held broken packages.

我也尝试过sudo apt-get update && sudo apt-get upgrade && sudo apt-get -f install,但也没有成功。也没有sudo apt-get purge

我看到一些子依赖项(例如libnghttp2-14libpsl5等)显示为“不可安装”。难道这跟这有什么关系吗?

我怎样才能克服这个困难?

- 编辑 -

根据评论中的要求,这是我的/etc/apt/sources.list以及来自的输出apt-cache policy curl

来源.list

deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi
deb http://security.debian.org stable/updates main
deb-src http://security.debian.org/ stable/updates main

apt 缓存

pi@RECOVERY:~ $ apt-cache policy curl
curl:
  Installed: (none)
  Candidate: 7.52.1-5+deb9u1
  Version table:
     7.52.1-5+deb9u1 0
        500 http://security.debian.org/ stable/updates/main armhf Packages
     7.38.0-4+deb8u6 0
        500 http://mirrordirector.raspbian.org/raspbian/ jessie/main armhf Packages
        500 http://archive.raspbian.org/raspbian/ jessie/main armhf Packages

答案1

sources.list混合了 Raspbian Jessie 和“稳定”的 Debian,现在是 Stretch (Debian 9);这就是您遇到此问题的原因:安装curl尝试使用 Raspbian Jessie 的依赖项从 Debian 9 安装安全更新curl,但这不起作用。

要解决此问题,请替换stable为:jessiesources.list

deb http://security.debian.org jessie/updates main
deb-src http://security.debian.org jessie/updates main

完成后,运行apt update,然后您应该能够安装curl.

当遵循稳定的 Debian 版本时,您应该始终使用版本代号而不是“stable”,因为后者在发布新版本时会突然更改版本。

答案2

如果您的发行版没有这些依赖项的候选版本,您可以将 Debian 存储库添加到 /etc/apt/sources.list 并自行安装依赖项

按照建议这里

确保 /etc/apt/sources.list 中有此行​​:

deb-src http://ftp.debian.org/debian/ stable main non-free contrib

APT 提供了一个命令“apt-get source”来查找这些 deb-src 行(而不是普通的二进制 deb 行)并下载源包。在本教程中,您将使用“apt-src”,它是“apt-get source”的便捷包装器。第2步

apt-get update

步骤3

sudo aptitude install apt-src

apt-src 是一个帮助程序,可以轻松编译源代码包。这不是必需的,但它可以防止您键入太多命令。步骤4

 apt-src -bi install $package

如果您想安装 'libnghttp2-14' ,请运行以下命令:

apt-src -bi install libnghttp2-14 

“b”代表“build”,“i”代表“安装生成的包”,“install”一词意味着“从sources.list下载Debian源代码行中找到的alpine源代码”。 apt-src 会将源代码“安装”到当前目录中,确保您拥有构建该包所需的所有包(这个过程称为“满足构建依赖项”)、构建它并安装生成的 .debs。

相关内容