7

I have a pretty standard "but it is not going to be installed" error on Ubuntu 16.04.01. For example:

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.

So let's go ahead and install that ourselves:

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.

Let's continue:

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.

and you can continue time and again until you get bored and stop.

/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

And I have tried to update my sources.list with software-properties and literally tried everything here to resolve it to no luck.

8
  • can you post the entire output? is there a misconfiguration error on some package?
    – ravery
    Jul 8, 2017 at 13:37
  • @ravery Updated the question with full output. sudo apt-get -f install should have fixed the broken packages, which there already seem to be none. Jul 8, 2017 at 13:40
  • 3
    do you have aptitude installed? it is often better at resolving, and will show the dependency tree, broken packages, holds etc
    – ravery
    Jul 8, 2017 at 13:58
  • Yes! Finally! It downgraded some packages and resolved the issue, thanks! Jul 8, 2017 at 14:17
  • If you solved your problem yourself, please answer your own question and accept your answer. Don’t put the answer in your question or the comments! Send me a message in the comments if you want my up-vote. :-) Jul 9, 2017 at 11:42

3 Answers 3

7

I resolved the issue by installing aptitude: sudo aptitude install libpq-dev which downgraded 3 packages:

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

which I was unable to understand that I should have downgraded with apt-get.

2
  • 2
    ... yeah, and when I try to install aptitude, I get "... but it is not going to be installed" errors there too.
    – Steve3p0
    Dec 27, 2017 at 1:06
  • @SteveB, I get this aswell, in fact I landed here because of that in the first place Dec 25, 2018 at 2:38
6

I met some other problem like this just saying "depends but it is not going to be installed" and "you held broken package". And i tried the apt method listed there, update or upgrade or --fix-broken. But what finally happens me out is to use sudo apt-get install [broken package], which of course cannot succeed, but gives you a list of packages which cannot be installed, and i finally found out that some dependency of the packages is already installed on my server, but with a higher version, but the package depends on some lower version of its dependency, so just sudo apt-get install [conflicted package]=[desired version] will solve this. If you solve your problem, just a hint next time you can try.

0

I didn't understand the message given by my terminal initially, but running

sudo apt --fix-broken install

fixed my problem. I initially ran this command with the package name at the end, but it needs no extra arguments.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .