针对此错误,我尝试了以下操作:
sudo apt-get update --fix-missing
sudo dpkg --configure -a
sudo apt-get install -f
sudo apt upgrade
但我得到了同样的错误。我实际上已经清除了 mysql 和 mariadb,并一直在尝试重新安装它们。我需要安装 mariadb-server,但出现了这个错误(标题)。然后,我看到一篇帖子说要使用 aptitude。当我尝试安装 aptitude 或 mariadb-server 时,出现了这个错误。
这是我修改后的 /etc/apt/sources.list 文件:
deb http://archive.ubuntu.com/ubuntu focal universe
错误追踪
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: libboost-iostreams1.71.0 but it is not installable
Depends: libcwidget4 (>= 0.5.18-1) but it is not going to be installed
Depends: libsigc++-2.0-0v5 (>= 2.8.0) but it is not installable
Recommends: libparse-debianchangelog-perl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我正在使用 Ubuntu 20.04
这是apt policy aptitude
:
aptitude:
Installed: (none)
Candidate: 0.8.12-1ubuntu4
Version table:
0.8.12-1ubuntu4 500
500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
提前致谢!
答案1
我对您的源列表到底是什么样子感到很困惑。您的初始帖子列出了来自bionic
和的存储库trusty
。现在您说您的系统是focal
,并显示仅包含 universe 存储库的源列表focal
。
但是,实际上可能确实如此。例如,apt
抱怨无法安装libboost-iostreams1.71.0
主存储库中的存储库。因此,也许您的源列表中确实没有该存储库,这可以解释为什么您无法安装 aptitude。
如果这是你的来源列表的真实状态,你可以参考答案中的说明如何恢复默认存储库?或使用此默认focal
源列表。
deb http://us.archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted universe multiverse
然后更新您的系统。如果您的源列表确实如您之前所显示的那样,您可能会在此步骤遇到重大问题。如果您可以完成升级,那么您应该能够安装 aptitude。