Debian

我無法安裝軟體包,因為它要求的依賴版本高於可用版本

  • October 18, 2022

很難比標題更清楚。

我昨天從 debian 9 升級到 11,不知何故我的 git 包在途中被丟棄了。所以很自然地我今天早上嘗試重新安裝它。一個問題,它要求我提供一個不存在的依賴項。

~ sudo apt install git                                                                  100 err | 10:50:02
Reading package lists... Done
Building dependency tree... Done
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:
git : Depends: libc6 (>= 2.34) but 2.31-13+deb11u4 is to be installed
E: Unable to correct problems, you have held broken packages.

~ sudo apt list libc6 -a                                                                100 err | 10:51:09
Listing... Done
libc6/stable,now 2.31-13+deb11u4 amd64 [installed]

git 要求的 libc6 依賴項毫無意義,因為我的版本在 debian 網站上列出的依賴項是 2.28(https://packages.debian.org/bullseye/git)。

我最好的猜測是我的問題來自我的源文件。你覺得它有什麼問題嗎?

deb http://[debian link]/debian bullseye main
deb http://deb[debian link]/debian bullseye-updates main
deb http://security[debian link] bullseye-security main

這是 apt policy 的結果(因為我不能發布太多連結,所以稍微修剪了一下):

100 /var/lib/dpkg/status
    release a=now
500 http://ppa.launchpad.net/git-core/ppa/ubuntu jammy/main amd64 Packages
    release v=22.04,o=LP-PPA-git-core,a=jammy,n=jammy,l=Git stable releases,c=main,b=amd64
    origin ppa.launchpad.net
500 http://security.[debian link] bullseye-security/main amd64 Packages
    release v=11,o=Debian,a=stable-security,n=bullseye-security,l=Debian-Security,c=main,b=amd64
    origin security.[debian link]
500 http://deb.[debian link]/debian bullseye-updates/main amd64 Packages
    release v=11-updates,o=Debian,a=stable-updates,n=bullseye-updates,l=Debian,c=main,b=amd64
    origin deb.[debian link]
500 http://deb.[debian link]/debian bullseye/main amd64 Packages
    release v=11.5,o=Debian,a=stable,n=bullseye,l=Debian,c=main,b=amd64
    origin deb.[debian link]
Pinned packages:```

您的系統引用了git-coreUbuntu PPA,這​​是它嘗試安裝git的位置。Ubuntu PPA 不應該與 Debian 一起使用;在這種特殊情況下,您使用的是 22.04 PPA,它依賴於 Ubuntu 22.04 軟體包,包括libc6比 Debian 11 中可用的更新版本。

git您可以使用 Debian 11強制安裝

sudo apt install -t bullseye git

但你真的應該刪除 Ubuntu PPA。

引用自:https://unix.stackexchange.com/questions/721423