我有 Ubuntu 20.04.2。我似乎无法安装需要依赖项的软件包。
我必须用 puppet 安装许多软件包,其中包括:
~# apt install aptitude
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:
aptitude : Depends: libapt-pkg5.0 (>= 1.1) but it is not going to be installed
Recommends: libparse-debianchangelog-perl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
这是我尝试过的:
apt update && apt upgrade
apt autoremove
apt-get -f install
dpkg --configure -a
apt dist-upgrade
rm /etc/apt/sources.list.d/*
apt-mark showhold #shows nothing
apt install aptitude --fix-missing
什么都不起作用。我在第一个代码片段中不断收到错误。我上面运行的所有命令似乎对网上的其他人都有效。
有人知道如何修复它吗?非常感谢!
编辑:我认为这与我的 sources.list 指向 ubuntu 18 repo 的本地克隆有关。所以我删除了所有内容并只添加了官方的,但仍然收到错误:
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/universe/binary-amd64/Packages Cannot initiate the connection to archive.ubuntu.com:80 (91.189.88.152). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (91.189.88.142). - connect (101: Network is unreachable)
E: Some index files failed to download. They have been ignored, or old ones used instead.
但我想那是另一个问题。
答案1
在 Ubuntu Focal 上,aptitude
可从存储库获得universe
,依赖项libapt-pkg6.0
可从获得focale-updates
。
sudo add-apt-repository universe
sudo apt update
sudo apt install aptitude