依赖问题:“vim:依赖:vim-common(= 2:7.4.1689-3ubuntu1.2)但需要安装 2:8.0.1453-1ubuntu1”

依赖问题:“vim:依赖:vim-common(= 2:7.4.1689-3ubuntu1.2)但需要安装 2:8.0.1453-1ubuntu1”

问题解决了..通过将 16.04 的源更改为 18.04 的源。


我在尝试使用 apt 安装应用程序时遇到了一些依赖性问题:

$ sudo apt install vim
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:
 vim : Depends: vim-common (= 2:7.4.1689-3ubuntu1.2) but 2:8.0.1453-1ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.

当我尝试安装 aptitude,然后通过 aptitude 安装 vim 来解决依赖性问题时,它告诉我 apt 将被删除:

$ sudo apt-get install aptitude
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  aptitude-common libboost-iostreams1.58.0 libcwidget3v5 libsigc++-2.0-0v5
  libxapian22v5
Suggested packages:
  apt-xapian-index aptitude-doc-en | aptitude-doc debtags tasksel
  libcwidget-dev xapian-tools
The following packages will be REMOVED:
  apt apt-utils ubuntu-desktop ubuntu-minimal ubuntu-release-upgrader-gtk
  update-manager update-notifier update-notifier-common
The following NEW packages will be installed:
  aptitude aptitude-common libboost-iostreams1.58.0 libcwidget3v5
  libsigc++-2.0-0v5 libxapian22v5
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  apt
0 upgraded, 6 newly installed, 8 to remove and 13 not upgraded.
Need to get 2,974 kB of archives.
After this operation, 4,842 kB of additional disk space will be used.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
 ?] ^C

然后,当我尝试通过 aptitude 安装 vim 时,它显示错误,即找不到 apt 的某个文件夹...

我问过我的室友,他说 apt 和 aptitude 不会互相冲突!那么我是否可以在不删除 apt 的情况下安装 aptitude?如何操作?

运行后更新apt -f install

cky@cky:~$ sudo apt update
Hit:1 https://mirrors.ustc.edu.cn/ubuntu xenial InRelease
Hit:2 https://mirrors.ustc.edu.cn/ubuntu xenial-security InRelease
Hit:3 https://mirrors.ustc.edu.cn/ubuntu xenial-updates InRelease
Hit:4 https://mirrors.ustc.edu.cn/ubuntu xenial-backports InRelease
Reading package lists... Done                     
Building dependency tree       
Reading state information... Done
13 packages can be upgraded. Run 'apt list --upgradable' to see them.

cky@cky:~$ sudo apt -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.

但这没什么帮助,问题仍然和以前一样。sources.list 已经改成了更快的,这与问题有关吗?

以下是 sources.list

cky@cky:~$ sudo cat /etc/apt/sources.list
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

## Not recommended
# deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
cky@cky:~$ sudo cat /etc/apt/sources.list.d/*
cat: '/etc/apt/sources.list.d/*': No such file or directory

使用默认源太慢了 xD 我正在尝试其他可能的源

19% [21 Packages 269 kB/1,019 kB 26%]                       15.3 kB/s 45min 35s

答案1

感谢您注意到这个警告!

你的室友是对的 -有非常不对劲的地方. aptitude install 看起来应该是这样的:

$ sudo apt install aptitude
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libssl-doc
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  aptitude-common libcwidget3v5
Suggested packages:
  aptitude-doc-en | aptitude-doc apt-xapian-index debtags tasksel
  libcwidget-dev
The following NEW packages will be installed:
  aptitude aptitude-common libcwidget3v5
0 to upgrade, 3 to newly install, 0 to remove and 0 not to upgrade.
Need to get 2,569 kB of archives.
After this operation, 10.9 MB of additional disk space will be used.
Do you want to continue? [Y/n]

我注意到的第一件事是您正在尝试安装libboost-iostreams1.58.0。我已经libboost-iostreams1.65.1安装了,所以我猜您还没有运行apt-get update。请先执行此操作,这样您就知道您获得了存储库的最新参考以及所有软件包的正确版本。

然后,从你之前的台词来看:

E: Unable to correct problems, you have held broken packages.

我认为您可能有一个软件包尚未完成安装。尝试运行:

apt -f install

更新

正如@user535733 猜测的那样,原作者的存储库不正确。他们的存储库与/etc/apt/sources.d/他们运行的 Ubuntu 版本不匹配。这种情况不太可能因错误而发生,但如果不是故意的,则可能是由于外部脚本而发生的。

相关内容