错误:无法更正依赖关系

错误:无法更正依赖关系

操作系统和版本:Debian 8

架构:64 位

我正在尝试更新软件包,但出现以下错误:

# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 libc-bin : Depends: libc6 (< 2.29) but 2.31-4 is installed
 libc-dev-bin : Depends: libc6 (< 2.29) but 2.31-4 is installed
 libc6 : Depends: libnss-nisplus but it is not installable
 libc6-dev : Depends: libc6 (= 2.28-8) but 2.31-4 is installed
 locales : Depends: libc-bin (> 2.31) but 2.28-8 is installed
           Depends: libc-l10n (> 2.31) but 2.28-8 is installed
 openssh-server : Depends: openssh-client (= 1:8.3p1-1) but 1:6.7p1-5+deb8u8 is installed
                  Depends: runit-helper (>= 2.8.14~) but it is not installable
                  Depends: libcom-err2 (>= 1.43.9) but it is not installable
                  Depends: libgssapi-krb5-2 (>= 1.17) but 1.12.1+dfsg-19+deb8u5 is installed
                  Depends: libkrb5-3 (>= 1.13~alpha1+dfsg) but 1.12.1+dfsg-19+deb8u5 is installed
E: Unmet dependencies. Try using -f.

当我尝试命令时apt-get -f install,出现以下错误:

# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
 libc-bin : Depends: libc6 (< 2.29) but 2.31-4 is installed
 libc-dev-bin : Depends: libc6 (< 2.29) but 2.31-4 is installed
 libc6 : Depends: libnss-nisplus but it is not installable
 libc6-dev : Depends: libc6 (= 2.28-8) but 2.31-4 is installed
 locales : Depends: libc-bin (> 2.31) but 2.28-8 is installed
           Depends: libc-l10n (> 2.31) but 2.28-8 is installed
 openssh-server : Depends: openssh-client (= 1:8.3p1-1) but 1:6.7p1-5+deb8u8 is installed
                  Depends: runit-helper (>= 2.8.14~) but it is not installable
                  Depends: libcom-err2 (>= 1.43.9) but it is not installable
                  Depends: libgssapi-krb5-2 (>= 1.17) but 1.12.1+dfsg-19+deb8u5 is installed
                  Depends: libkrb5-3 (>= 1.13~alpha1+dfsg) but 1.12.1+dfsg-19+deb8u5 is installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies

我的来源列表文件:

# cat /etc/apt/sources.list
deb http://mirrors.kernel.org/debian/ jessie main
deb-src http://mirrors.kernel.org/debian/ jessie main

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

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

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

apt-cache 策略的输出:

# apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://mirrors.kernel.org/debian/ jessie-updates/main Translation-en
 500 http://mirrors.kernel.org/debian/ jessie-updates/main amd64 Packages
     release v=label=Debian,o=Debian,a=oldoldstable-updates,n=jessie-updates,l=Debian,c=main
     origin mirrors.kernel.org
 500 http://security.debian.org/ jessie/updates/main Translation-en
 500 http://security.debian.org/ jessie/updates/main amd64 Packages
     release v=8,o=Debian,a=oldoldstable,n=jessie,l=Debian-Security,c=main
     origin security.debian.org
 500 http://mirrors.kernel.org/debian/ jessie/main Translation-en
 500 http://mirrors.kernel.org/debian/ jessie/main amd64 Packages
     release v=8.11,o=Debian,a=oldoldstable,n=jessie,l=Debian,c=main
     origin mirrors.kernel.org
Pinned packages:
     nginx -> (not found)

我被困在这里了。请帮助我。

谢谢。

答案1

您的系统有一组严重混合的软件包,这些软件包来自不同阶段的 Debian 开发版本。例如,它的libc6软件包是当前正在测试的版本(将成为 Debian 11),它的locales软件包是 Debian 10 开发过程中某个时刻的旧版本......

为了让事情恢复到某种表面上的秩序,你必须选择一个目标发布,然后切换到那个。鉴于系统应该在 Debian 8 上,并且您apt已进行相应配置(给定 的输出apt-cache policy),您最好从 Debian 8 或 Debian 9 开始。让我们假设 Debian 8:

  • 删除testing条目/etc/apt/sources.list

  • 告诉apt降级到 Debian 8:

    printf "Package: *\n Pin: release o=Debian n=jessie\n Pin-Priority: 1001\n" > /etc/apt/preferences.d/jessie
    
  • 通过“升级”降级:

    apt-get update
    apt-get dist-upgrade
    

在开始执行此操作之前您应该与您的队友核实,以确定首先添加测试存储库的原因;大概有一些包裹是故意从那里拉出来的。

一旦你回到 Debian 8,你应该添加 ELTS 存储库(如果你打算继续使用这个,考虑成为赞助商),或升级到 Debian 9也许甚至到 Debian 10

答案2

... 坦率地说,你的系统已经严重过时了。

“testing”是暂存存储库的静态名称——该存储库将成为下一个“稳定”版本。

此时,这将是 Bullseye - debian 11。“Jessie”是 debian 8,它已于 [2018 年][1] 停产,甚至在 7 月份就失去了长期支持。

怀疑当杰西(Jessie)仍然稳定并且有人想要几个比可用的更新的软件包时,这条线被添加回来。这种特殊的方法是严重禁忌的,您刚刚发现了原因。

幸运的是,希望,它还没有安装任何东西,所以只需从 中删除包含“testing”的行sources.list就可以让错误消失,但正如我之前所说,Debian 8 已经停产并且没有收到任何类型的更新近两年来,除了关键的安全修复之外,甚至在过去的三个月里也不再有这样的修复。

当然,这并不能解决你当前的问题;为此我怀疑你至少必须开始通过 dist 升级到当前的稳定版本 (10),因为我认为您无法获得对可能可以追溯到 2016 年左右的 nginx 版本的支持。

相关内容