“但它不会被安装”噩梦

Has*_*ral 5 package-management apt

我在 Ubuntu 16.04.01 上有一个非常标准的“但它不会被安装”错误。例如:

sudo apt-get install libpq-dev
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:
 libpq-dev : Depends: krb5-multidev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)

所以让我们继续自己安装它:

sudo apt-get install libpq-dev krb5-multidev
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:
 krb5-multidev : Depends: libkrb5-3 (= 1.13.2+dfsg-5) but 1.13.2+dfsg-5ubuntu2 is to be installed
                 Depends: libk5crypto3 (= 1.13.2+dfsg-5) but 1.13.2+dfsg-5ubuntu2 is to be installed
                 Depends: libgssapi-krb5-2 (= 1.13.2+dfsg-5) but 1.13.2+dfsg-5ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)

让我们继续:

sudo apt-get install libpq-dev krb5-multidev libkrb5-3 libk5crypto3 libgssapi-krb5-2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libk5crypto3 is already the newest version (1.13.2+dfsg-5ubuntu2).
libk5crypto3 set to manually installed.
libgssapi-krb5-2 is already the newest version (1.13.2+dfsg-5ubuntu2).
libgssapi-krb5-2 set to manually installed.
libkrb5-3 is already the newest version (1.13.2+dfsg-5ubuntu2).
libkrb5-3 set to manually installed.
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:
 krb5-multidev : Depends: libkrb5-3 (= 1.13.2+dfsg-5) but 1.13.2+dfsg-5ubuntu2 is to be installed
                 Depends: libk5crypto3 (= 1.13.2+dfsg-5) but 1.13.2+dfsg-5ubuntu2 is to be installed
                 Depends: libgssapi-krb5-2 (= 1.13.2+dfsg-5) but 1.13.2+dfsg-5ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)

你可以一次又一次地继续,直到你感到无聊并停下来。

/etc/apt/sources.list

deb http://archive.ubuntu.com/ubuntu xenial main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu trusty main restricted #Added by software-properties
Run Code Online (Sandbox Code Playgroud)

我已经尝试更新我的sources.listsoftware-properties并且真的尝试了这里的所有方法来解决它没有运气。

Has*_*ral 6

我通过安装aptitude解决了这个问题:sudo aptitude install libpq-dev它降级了 3 个软件包:

  • libk5crypto3
  • libgssapi-krb5-2
  • libkrb5-3

我无法理解我应该用apt-get.

  • ...是的,当我尝试安装 aptitude 时,我也收到“...但不会安装”错误。 (2认同)

小智 6

我遇到了一些其他问题,比如这样只是说“取决于但它不会被安装”和“你持有损坏的包”。我尝试了那里列出的apt方法,updateupgrade--fix-broken。但最终我发现的是使用sudo apt-get install [broken package],这当然不会成功,但会给你一个无法安装的软件包列表,我终于发现我的服务器上已经安装了软件包的一些依赖项,但具有更高的版本,但该包依赖于其依赖项的某些较低版本,因此只需sudo apt-get install [conflicted package]=[desired version]解决此问题。如果你解决了你的问题,只是一个提示,下次你可以尝试。