668

Occasionally, when I'm installing stuff, I get an error like the following:

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:
 package1 : Depends: package2 (>= 1.8) but 1.7.5-1ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.

How can I resolve this?

Seth
  • 58,122
jrg
  • 60,611
  • 37
    Forget the exact package name. It is irrelevant to this question. I'm attempting to create a canonical question. As such, the exact package isn't relevant in this specific instance. – jrg May 21 '12 at 14:35
  • 37
    Actually "the exact package name", while not relevant in your question, is extremely relevant to any individual's issue in this regard. Usually the best 1st step to resolving this is to identify the source of pkg1 & pkg2. This seems to have been overlooked in the answers, most of which are quite good otherwise. Additionally not noted is that in many, if not most cases, " is to be installed" really means " is installed". This is something that tends to confuse many users facing this & should also be included in an answer below – doug May 25 '12 at 06:52
  • 5
    @doug Add that as an answer and not a comment, it's pretty good! :) – jrg May 25 '12 at 11:17
  • Actually if you see every answer has more or less the same thing. Could they be merged into a community wiki? – Ashu May 27 '12 at 09:48
  • In my case, this type of problem was caused by the fact that Updates were disabled for all sources under Software & Updates. – Silveri Jul 04 '13 at 07:47
  • See http://unix.stackexchange.com/a/121185/4671 – Faheem Mitha Jul 16 '14 at 15:50
  • @whaa as you can see in the meta discussion, the change was deliberate and nobody raised issues with it. Despite what you may think, the change is necessary to prevent more misuse of this question, as I pointed in the meta discussion. – Braiam Oct 23 '14 at 13:15
  • 1
    @Braiam Whaaaat does have a point though, the question isn't specific to a PPA and quite a few answers aren't either. I know the top two answers overwhelm the others a bit, but I'm not sure changing the nature of the question is the right solution, especially since you nullify the other answers. I'm leaving it for now since I don't have a better answer but it is something to think about. – Seth Oct 23 '14 at 15:46
  • 2
    Oh, and where's my troubleshooting question? :D – Seth Oct 23 '14 at 15:51
  • If I had asked the above question, and got the top-ranked answer that starts with "APT is a package management system..." I would have downvoted the answer because the topic sentence doesn't indicate an understanding of the problem I was facing. It better suits a full tutorial and that is not what a good answer looks like. I would downvote but I'm only here because I was reading the meta discussion and I believe that under the circumstances a downvote would be unfair (like piling on). – cardiff space man Sep 03 '15 at 18:17
  • sudo apt install --fix-broken -y right after install cmd – STEEL Apr 11 '22 at 05:49

14 Answers14

676

APT is a package management system for Debian and other Linux distributions based on it, such as Ubuntu. For the most part, APT is easy to use for installing, removing, and updating packages. In rare instances, often when you are mixing in third-party dependencies, there is a chance that apt-get may end up giving you an error telling you that a package installation could not be completed.

Solutions:

It is always a good idea to back up configuration files like /etc/apt/sources.list, so you can revert the changes if needed.

  • If the error shows something like this:

    <some-package>: Depends: <other-package> (= version) but this-version is to be installed

    Then make sure that the restricted and universe repositories are enabled. Hit Alt+F2, type software-properties-gtk and hit Enter.

    Under Ubuntu Software tab, enable all the repositories.

  • One possible cause of unmet dependencies could be corrupted package database, and/or some packages weren’t installed properly. To fix this problem, hit Alt+Ctrl+T to open terminal and try to run one of the following commands:

    sudo apt-get clean

    or,

    sudo apt-get autoclean

    apt-get clean clears out the local repository of retrieved package files (the .deb files). It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. apt-get autoclean clears out the local repository of retrieved package files, but unlike apt-get clean, it only removes package files that can no longer be downloaded, and are largely useless.

  • One of the most basic fixes to resolve dependencies problems is to run:

    sudo apt-get -f install

    The -f here stands for “fix broken”. Apt will attempt to correct broken dependencies. If you manually installed a package that had unmet dependencies, apt-get will install those dependencies, if possible, otherwise it may simply remove the package that you installed in order to resolve the problem.

    Then run:

    sudo dpkg --configure -a

    Then run this again:

    sudo apt-get -f install

    If the output is:

    0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

    That means it failed.

  • Next solution is to run:

    sudo apt-get -u dist-upgrade

    If it shows any held packages, it is best to eliminate them. Packages are held because of dependency conflicts that apt cannot resolve. Try this command to find and repair the conflicts:

    sudo apt-get -o Debug::pkgProblemResolver=yes dist-upgrade

    If it cannot fix the conflicts, it will exit with:

    0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

    Delete the held packages one by one, running dist-upgrade each time, until there are no more held packages. Then reinstall any needed packages. Be sure to use the --dry-run option, so that you are fully informed of consequences:

    sudo apt-get remove --dry-run package-name

    Since removing the package you are trying to install may not be ideal, you might also try finding a repository that has the packages you need to satisfy the dependencies.

Finally, if all else fails, you can attempt to satisfy the dependencies yourself, either by finding and installing the necessary packages, or by installing them from source and then creating “deb” packages for them.

Disable/Remove/Purge PPAs:

PPAs (Personal Package Archive) are repositories hosted on Launchpad. You can use PPAs to install or upgrade packages that are not available in the official Ubuntu repositories.

One of the most common causes of unmet dependencies are PPAs, especially when used to upgrade the existing package in Ubuntu repositories. To solve the problem you have three options: disable, purge (revert back to original package in Ubuntu repositories) or remove PPA.

  • Disable:

    Disabling a PPA means no more updates for the packages installed from that PPA. To disable a PPA: Open Software Center > Edit > Software Sources Or,

    Hit Alt+F2 and run software-properties-gtk.

    Click on Other Software tab, you'll see that each PPA have two lines here, one for the compiled packages and one for the source, Uncheck both lines to disable a PPA. Here you can also add and remove PPAs.

  • Purge:

    Purging a PPA means, downgrading the packages in the selected PPA to the version in the official Ubuntu repositories and disabling that PPA. PPA Purge does exactly that. To install PPA Purge run the following command:

    sudo apt-get install ppa-purge

But, considering the question apt is broken, the above command will fail. So use this command

mkdir ppa-purge && cd ppa-purge && wget http://mirror.pnl.gov/ubuntu/pool/universe/p/ppa-purge/ppa-purge_0.2.8+bzr56_all.deb && wget http://mirror.pnl.gov/ubuntu//pool/main/a/aptitude/aptitude_0.6.6-1ubuntu1_i386.deb && sudo dpkg -i ./*.deb

To use PPA Purge:

sudo ppa-purge ppa:someppa/ppa

If 'ppa-purge' command fails for some reason, you can't run 'ppa-purge' again unless you re-enable the PPA (To enable the PPA follow the same steps as disabling a PPA and Check the both lines of a particular PPA to enable it).

Note: PPA Purge doesn't remove PPAs (may be in future), So you'll have to manually remove the PPA.

  • Remove:

    If the package installed from a PPA doesn't exist in official Ubuntu repositories then using PPA Purge is not recommended, because there's nothing to be downgraded and PPA Purge wouldn't delete it either. To remove a PPA and installed packages run the following commands: (Ignore the first command if you don't want to remove the installed packages)

    sudo apt-get autoremove --purge package-name
    sudo add-apt-repository --remove ppa:someppa/ppa
    sudo apt-get autoclean
    

Alternatively you can use Y PPA Manager to disable/remove/purge PPA's (Details at the end of answer).

Preventive Measures:

So how can we avoid this from happening in the first place?

  • Keep Ubuntu Up to date. Ubuntu automatically notifies when updates are available, you can also check for available updates by clicking on Session Indicator in Unity panel:

    Or, Hit Alt+Ctrl+T to open terminal and run following commands:

    sudo apt-get update
    sudo apt-get upgrade

    Update: Synchronizes your list of available packages with the servers in source repositories. Upgrade: Downloads & installs any newer versions of your installed packages.

  • If you decide to add other repositories to sources.list, make sure that the repository is meant to work (and known to work) with Ubuntu. Repositories that are not designed to work with your version of Ubuntu can introduce inconsistencies in your system and might force you to re-install. Also, make sure that you really need to add external repositories as the software package(s) you are looking for may already have been introduced into the official repositories! Source
  • Remove duplicate PPAs. Y PPA Manager (installation guide at the end of answer) can easily scan and remove duplicate PPAs.

    • Hit Alt+F2 and run y-ppa-manager to open Y PPA Manager.
    • Once open, double click or hit Enter on Advanced.
    • In resulting window select Scan and remove duplicate PPAs and click OK.

enter image description here

Getting Help:

When asking for help on Askubuntu or any other help forum, you should include the output of the following commands in your question:

  • Output of actual error:

    sudo apt-get install package-name
  • This will show your sources.list:

    cat /etc/apt/sources.list
  • This will show the list of PPAs (If any):

    cat /etc/apt/sources.list.d/*

Additional Sources:


Y PPA Manager: Y PPA Manager is an one stop shop for all of your PPA needs.

y ppa manager

Here are some of its features:

  • search packages in all Launchpad PPAs
  • list and download packages in a PPA
  • add / remove / purge a PPA
  • backup and restore PPA sources
  • remove duplicate PPA sources

To install Y PPA Manager, open terminal by hitting Alt+Ctrl+T and run following commands:

sudo add-apt-repository ppa:webupd8team/y-ppa-manager
sudo apt-get update
sudo apt-get install y-ppa-manager

Considering the question, apt is broken, so use these commands instead

sudo su

and

32 Bit:

mkdir y-ppa-manager && cd y-ppa-manager && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/launchpad-getkeys_0.3.2-1~webupd8~oneiric_all.deb && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/y-ppa-manager_0.0.8.6-1~webupd8~precise_all.deb && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/yad_0.17.1.1-1~webupd8~precise_i386.deb && dpkg -i ./*.deb

64 Bit:

mkdir y-ppa-manager && cd y-ppa-manager && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/launchpad-getkeys_0.3.2-1~webupd8~oneiric_all.deb && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/y-ppa-manager_0.0.8.6-1~webupd8~precise_all.deb && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/yad_0.17.1.1-1~webupd8~precise_amd64.deb && dpkg -i ./*.deb
Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83
Basharat Sialvi
  • 24,046
  • 8
  • 62
  • 82
  • 3
    How to install unmet depandancies if apt is broken? – Tachyons May 28 '12 at 01:17
  • 5
    This was a huge help for me... fresh install of Lubuntu 12.04 and couldn't install basic things such as gvim (vim-gtk) or openssh-server. I had tried all sorts of command line options, including literally doing a diff of /etc/apt/sources.list from this machine and another (that worked correctly, running Xubuntu). After following this guide, I found that somehow in software-properties-gtk, the box for the 'main' repos had been unchecked! Problem solved! – memilanuk Jun 01 '12 at 01:11
  • 2
    Sometime you have really held broken packages... So the best thing is unhold them and delete them. See http://askubuntu.com/a/363244/16395 – Rmano Feb 12 '14 at 05:25
  • 4
    Noone actually answered how to install those packages with unmet dependencies versions. God! I just want to force install older versions of packages. – marines Mar 04 '14 at 12:59
  • 4
    This didn't work for me :S – AlvaroAV Dec 23 '14 at 11:08
  • It appears that sudo apt-get -f install has worked. – Donato May 10 '15 at 01:21
  • 1
    It appears that sudo apt-get -f install and then sudo apt-get update and then sudo apt-get upgrade has worked. – Donato May 10 '15 at 01:45
  • it didn't resolve my issue but I gave you +1 just for the effort – Salvatore Di Fazio Jun 06 '17 at 15:53
  • my output on this solution was 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Still, when I try to install wine I ll get the same error: <some-package>: Depends: <other-package> (= version) but this-version is to be installed – PortWein Nov 05 '19 at 14:02
  • 1
    This is most of everything I hate about Linux. I don't care how you do it, install my stupid package. Use an extra 100MB if you have to. – Andrew Aug 29 '20 at 04:23
  • To add a case study - I met this issue by adding VLC's 3rd party PPA, installed vlc4.0, then uninstalled it. I then only "disabled" the PPA in the GUI, then tried to install vlc (with hope of ver3) in the CLI, then saw this issue. The section "Remove PPA" helped. Namely, apt autoremove, remove the PPA, apt autoclean. Then apt install vlc worked as expected. – KFL Jan 05 '23 at 17:58
  • As for ppa-purge please note that it has not been updated after 2016. I made a large merge request for it, but it was not accepted due to too big commits or something. Anyway, my branch is available in here. It includes the remove function you called for and much more improvements and bug fixes. I even made a PPA for it to enable easy access, but I forgot how to update it. Please note that ppa-purge does not cuerrently support new deb822 format. – jarno Feb 27 '23 at 14:30
95

Note: All commands asked to be run must be run in the terminal, which can be opened by either Ctrl+Alt+T or searching for terminal in the dash.

Is it really broken?

Try running the following command and try to reinstall the software you were trying to install

sudo apt-get update

Pre-Perfomance Steps

Backing up

Back up the following files:

  • /etc/apt/sources.list
  • /var/lib/dpkg/status

To do so, use these commands

sudo cp /etc/apt/sources.list /etc/apt/sources.list.original

and

sudo cp /var/lib/dpkg/status /var/lib/dpkg/status.original

Clearing your apt-cache

apt keeps a cache of recently downloaded packages to save bandwidth when it is required to be installed. This can be counter-productive in some cases

Now, to clean it, you have two options

sudo apt-get clean 

This will remove all cached packages belonging to the folder /var/cache/apt/archives/ and /var/cache/apt/archives/partial except the .lock files. This is recommended

sudo apt-get autoclean

This scans the folders /var/cache/apt/archives/ and /var/cache/apt/archives/partial and checks if the package is still in the repositories and removes the ones that aren't


Fixing dependencies

Using apt's fix-broken mode

sudo apt-get -f install

This will cause apt to scan for missing dependencies and fix them from the repositories

If the output states that nothing new was installed or upgraded, it has failed.


Checking if all required sources are enabled

Type gksu software-properties-gtk and you'll get this window

Make sure all sources are enabled.

next, go to the Other software tab and check if the required PPAs for the software to be installed are there and are enabled. Also, try disabling some PPAs which might be having broken packages

now, run sudo apt-get update

Try installing the software now

Selecting a better server to download from

Type gksu software-properties-gtk and you'll get this window

Click the Download from the Dropdown box and select other

Click Select Best Server

Run sudo apt-get update

Try installing the software

also, try using sudo apt-get install -f


PPA Purge

This is a tool used to purge broken/unwanted ppa's and their applications along with it

To install it, run

sudo apt-get install ppa-purge

But, Considering the question apt is broken so the above command will fail. So use this command

mkdir ppa-purge && cd ppa-purge && wget http://mirror.pnl.gov/ubuntu/pool/universe/p/ppa-purge/ppa-purge_0.2.8+bzr56_all.deb && wget http://mirror.pnl.gov/ubuntu//pool/main/a/aptitude/aptitude_0.6.6-1ubuntu1_i386.deb && sudo dpkg -i ./*.deb

Now use ppa purge

sudo ppa-purge ppa:someppa/ppa  

Y-PPA Manager

Y-PPA Manager is a gui app that helps you manage PPA's and various problems assosiated with it

To install it

sudo add-apt-repository ppa:webupd8team/y-ppa-manager

and

sudo apt-get update

and

sudo apt-get install y-ppa-manager

Considering the question, apt is broken so, use these command instead

sudo su

and

32 Bit:

mkdir y-ppa-manager && cd y-ppa-manager && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/launchpad-getkeys_0.3.2-1~webupd8~oneiric_all.deb && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/y-ppa-manager_0.0.8.6-1~webupd8~precise_all.deb && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/yad_0.17.1.1-1~webupd8~precise_i386.deb && dpkg -i ./*.deb

64 Bit:

mkdir y-ppa-manager && cd y-ppa-manager && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/launchpad-getkeys_0.3.2-1~webupd8~oneiric_all.deb && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/y-ppa-manager_0.0.8.6-1~webupd8~precise_all.deb && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/yad_0.17.1.1-1~webupd8~precise_amd64.deb && dpkg -i ./*.deb

Now type in y-ppa-manager

You'll be presented with this window

Double click on advanced, and you'll get this window

Do the following Tasks outlined in black


Prevention is better than cure

It is better to prevent than to search for this question on AskUbuntu :D

So, here are the guidelines to keep you safe

Keep your system up-to-date

always run the following command regularly

sudo apt-get update&&sudo apt-get upgrade

or, you can always use Update Manager with this command

gksu update-manager

Using only trusted PPA's

Only use PPA's meant to be used on Ubuntu also, only use PPA's with trusted sources. Infact, the package might already be in the ubuntu repositories

Backing up when things are good and restoring it later

For this you need Y-PPA-Manager. The steps to install it are given above.

Run this command to open Y-PPA-Manager

y-ppa-manager

You'll be presented with this window

Double click on advanced, and you'll get this window

Run this:

You'll be asked to save a tar.gz file with a dialog similar to the one below. Save it in another partition or a safe place

Later, when you need to restore it again, follow similar steps and when you get to the advanced dialog,Click on this:

You'll be asked to restore from the previous backup which you saved before with a dialog similar to the one below


Still not working?

Package dependency errors are not always generic and depends on the package to be installed.

If following all the steps given to fix the error does not work for you, you can always ask on Ask Ubuntu

Here are some commands which you need to post the output of

sudo apt-get install packagename

and

cat /etc/apt/sources.list

and

cat /etc/apt/sources.list.d/*

(Thanks to Basharat Sial)

There are also other files/commands that you need the output of that might be error specific, and users will probably prompt you in the comments to post the file/command.

Amith KK
  • 13,412
  • I would put apt-get update near the top of the list. Sometimes your system has done an update where one newer package has been updated remotely, but one it depends on hasn't finished building yet. Or the version you have in your local cache has been updated. In those cases a simple apt-get update will update your local cache and you can carry on. – Hamish Downer May 27 '12 at 09:45
  • 1
    Top notch answer! It just makes me wish apt and or dpkg had better protections to make sure they didn't get into these stuck broken states, or were better at resolving them. I've had this problem before and was quite frustrated when apt-get install -f didn't fix it. – Jeff Welling May 30 '12 at 03:11
  • You may also want to include this warning: "Never ever upgrade your system while PPA is enabled, disable them first and then upgrade" Because, if you upgrade to a PPA version and then that PPA becomes dead, it eventually means you're dead. You can't downgrade the whole system to the lower version numbers and can't install something from a standard repo cause the package from std repo has conflicts with the PPA package installed. – Anwar Sep 14 '12 at 03:39
  • 2
    Choose a better server fixed it for me. Thank you! – Hoang Huynh Feb 28 '15 at 19:19
  • I thought that the -f flag stands for force and always avoided to use it – d.k May 30 '16 at 02:08
  • apt-get update && apt-get upgrade is what BROKE my dependancies in the first place. Everything was dandy before I did that. – frumbert Aug 22 '17 at 03:52
47

These answers so far are focused on how to help the system automagically resolve such an issue, mostly hoping that it resolves itself, but not focused on understanding how to investigate dependencies. It's important to try making sure your package lists are up to date first; always make sure a simple update or clearing of the cache doesn't resolve the issue before digging deeper. If everything behind the scenes is working as it should, however, it's paramount to understand dependencies. Sometimes the layers of dependencies can seem overwhelming, but the concept is simple and key to understanding how software is installed/uninstalled in an Ubuntu system.

I highly recommend aptitude to anyone using a .deb based system, such as Debian, Kali, Ubuntu or any of its derivatives. It provides an interface to browse through layers of dependencies, including recommended and suggested packages. It is an invaluable tool for when apt-get doesn't offer a solution to a conflict and for visualizing dependencies in general. (Synaptic is also available in Ubuntu.)

Aptitude's conflict resolver will walk you through the possible combinations of installed/removed/upgraded/etc packages that satisfy your requested actions without conflict. This can often be successful even when apt is unable to find a solution. As an Ubuntu user, situations don't normally arise that require you to investigate why a particular package is being installed or causing a conflict, but it's almost inevitable as you use the system more.

aquafunk
  • 739
  • 4
  • 11
  • 4
    Voted up for mention of Aptitude conflict resolver. There are times when it is essential to use advanced tools like this to determine what the possibilities are and to pinpoint the core conflict. – John S Gruber Jun 01 '12 at 04:34
  • 3
    This might actually be the best answer in this thread. It can even be improved with a shot tutorial on aptitude's conflict resolver. – Luís de Sousa Jan 16 '14 at 09:02
  • 2
    this link, while it does not explain dependencies, or their general concept, does show a quick tutorial of the interactive resolver: http://aptitude.alioth.debian.org/doc/en/ch02s03s03.html – aquafunk Nov 07 '14 at 01:22
  • 1
    +1 aptitude just saved my bacon in the face of a GTK3 conflict. apt-get was no help at all. – Chris Laplante Dec 15 '14 at 17:30
  • Here is a showcase to support answer with screenshots https://askubuntu.com/questions/502207/ubuntu-14-04-problem-when-install-gstreamer1-0-libav-unmet-dependencies – user.dz Jan 03 '15 at 15:36
  • 1
    What I like is sudo aptitude --full-resolver my_package. That usually gives The following packages have unmet dependencies and a list among which 7) <my_package> [Not Installed] (7 is just an example). At each step aptitude offers new choices. What worked for me was to choose first 7, then r 7 (which corresponds to the description Rejecting the removal of my_package), and then n (for NO) as the choices before that were not what I wanted: but after that new choices offered downgrading some packages along with installing my_package; so, last, Y (for YES) –  Jul 13 '15 at 19:52
  • 1
    An example of aptitude's efficiency here and here –  Jul 13 '15 at 19:52
27

package1 : Depends: package2 (>= 1.8) but 1.7.5-1ubuntu1 is to be installed

Explanation of the message:

  1. In order for your installation to be completed, package1 needs package2.
  2. package2 has to be available in version >= 1.8
  3. The package manager checked all repositories and only found version 1.7.5-1ubuntu1 that could be installed, which it won't do because it is < 1.8

Fix

There is NO single right answer for this question and there is NO simple answer.

There are many scenarios why this can happen and one has to investigate all options and try to solve the preconditions that lead to this error.

Scenario A:

All the repositories that you have access to don't have package2 in version >= 1.8, so you will have to find a repository that does. If you are not able to find a repository with versions >=1.8 then you might have to build and install package2 from source. And then try to install package1.

If you want to know how to build a package from source, check other questions/answers or post a new one.

Scenario B:

The repositories do include package2 in a version >= 1.8 but the package manager still wants to install an older version (1.7.5).

The reason for this may be that the later versions of package2 where built by some newer technology that is not supported by other packages that you already have installed.

This might not be possible to fix at all. You can try to use apt or synaptic and look for all versions of the package2 that are available in the repositories, and try to install a specific version >= 1.8

If you have other incompatible packages and you do this, you will get a list of similar error messages for all the other packages that prevent the installation of package2>=1.8.

In this case, you have a bigger problem. You wanted to install package1, which needs package2 to be >= 1.8, but package2 in version >=1.8 requires package3 to be in version >= 6.7 and you have package3 version 6.3

The thing is that the package manager (APT) tries to solve all these dependencies automatically if it is possible. When it says that it is not possible (and issues a message like in the question), then you should trust it.

If you decide not to trust the package manager and if you are sure that you will not have problems, then you can try to force install the specific needed versions of all packages, one by one, and hope to be OK.

Beware, doing this for system packages can create serious problems. You can lock yourself out of the system, block critical services etc.

Scenario C:

No matter the reasons for the problem, you can always setup for manual compilation and build the needed package and all of it's dependencies in the exact needed versions from source. With this option you can keep what you built in a separate directory and out of the system path so that it will not create conflicts with the system. This is probably the cleanest solution, and sometimes can be faster to do.

Scenario D:

Package manager has access to out-dated information about packages and therefor cannot find a solution. Look in the other answers.

Scenario E:

Package manager has a bug in the dependency resolution code.

You have to investigate that this is really the case, and then issue a bug request.

...

Scenario Z:

There might be other scenarios.

For example package maintainers could have been wrong and did not check that package1 would work even with version of package2 < 1.8 and in the specification they set wrong dependencies.

20

For most cases,installing the package through aptitude will resolve unmet dependencies.By default aptitude package was not installed on your pc.So first install it by running,

sudo apt-get update
sudo apt-get install aptitude

then,

sudo aptitude install packagename

For Example,

    
avinash@avinash-Lenovo-IdeaPad-Z500:~$ sudo apt-get install ubuntu-sdk
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: ubuntu-sdk : Depends: qtcreator-plugin-ubuntu but it is not going to be installed E: Unable to correct problems, you have held broken packages.

Installing the package through aptitude

avinash@avinash-Lenovo-IdeaPad-Z500:~$ sudo aptitude install ubuntu-sdk
The following NEW packages will be installed:
  apparmor-easyprof{a} apparmor-easyprof-ubuntu{a} at{a} build-essential{a} 
  click{a} click-apparmor{a} click-dev{a} click-doc{a} cordova-ubuntu-2.8 
  cordova-ubuntu-2.8-examples{a} debhelper{a} devscripts{a} dh-apparmor{a} 
  dh-make{a} distro-info-data{a} dpkg-dev{a} dput{a} g++{a} g++-4.8{a} 
  geoclue-gypsy{a} libalgorithm-diff-perl{a} libalgorithm-diff-xs-perl{a} 
  libalgorithm-merge-perl{a} libboost-filesystem1.53.0{a} 
  libboost-program-options1.53.0{a} libboost-regex1.53.0{a} 
  libbotan-1.10-0{a} libdee-qt5-3{a} libdistro-info-perl{a} 
  libexporter-lite-perl{a} libglib2.0-dev{a} 
  libgstreamer-plugins-base1.0-dev{a} libgstreamer1.0-dev{a} libgypsy0{a} 
  libhud2{a} libio-stringy-perl{a} libjs-jquery{a} libjs-sphinxdoc{a} 
  libjs-underscore{a} liblockdev1{a} libmail-sendmail-perl{a} 
  libparse-debcontrol-perl{a} libpcre3-dev{a} libpcrecpp0{a} 
  libpoppler-qt5-1{a} libqdjango-db0{a} libqgsttools-p1{a} 
  libqt5clucene5{a} libqt5contacts5{a} libqt5declarative5{a} 
  libqt5designer5{a} libqt5designercomponents5{a} libqt5feedback5{a} 
  libqt5help5{a} libqt5location5-plugins{a} libqt5multimedia5{a} 
  libqt5multimedia5-plugins libqt5multimediaquick-p5{a} 
  libqt5multimediawidgets5{a} libqt5organizer5{a} 
  libqt5qml-graphicaleffects{a} libqt5script5 libqt5scripttools5{a} 
  libqt5svg5{a} libqt5svg5-dev libqt5systeminfo5{a} libqt5v8-5-dev 
  libqt5versit5{a} libqt5versitorganizer5{a} libqt5webkit5-dev 
  libqt5webkit5-qmlwebkitplugin{a} libqt5xmlpatterns5{a} 
  libqt5xmlpatterns5-dev libstdc++-4.8-dev{a} libsys-hostname-long-perl{a} 
  libthumbnailer0{a} libu1db-qt5-3{a} libunity-action-qt1{a} 
  libupstart-app-launch1{a} libusermetricsinput1{a} libxml2-dev{a} 
  libxslt1-dev{a} po-debconf{a} python3-apparmor-click{a} python3-click{a} 
  python3-magic{a} qmlscene qt3d5-dev qtbase5-doc{a} qtcreator{a} 
  qtcreator-doc{a} qtcreator-plugin-ubuntu{a} 
  qtcreator-plugin-ubuntu-common{a} qtdeclarative5-accounts-plugin 
  qtdeclarative5-cordova-2.8-plugin{a} qtdeclarative5-dev-tools 
  qtdeclarative5-doc-html{a} qtdeclarative5-folderlistmodel-plugin 
  qtdeclarative5-friends0.2 qtdeclarative5-localstorage-plugin 
  qtdeclarative5-particles-plugin qtdeclarative5-poppler1.0 
  qtdeclarative5-qtaudioengine-plugin qtdeclarative5-qtfeedback-plugin{a} 
  qtdeclarative5-qtlocation-plugin qtdeclarative5-qtmultimedia-plugin{a} 
  qtdeclarative5-qtorganizer-plugin qtdeclarative5-qtquick2-plugin{a} 
  qtdeclarative5-qtsensors-plugin qtdeclarative5-u1db1.0 
  qtdeclarative5-ubuntu-ui-extras-browser-plugin{a} 
  qtdeclarative5-ubuntu-ui-extras-browser-plugin-assets{a} 
  qtdeclarative5-ubuntu-ui-toolkit-plugin{a} 
  qtdeclarative5-unity-action-plugin{a} qtdeclarative5-usermetrics0.1 
  qtdeclarative5-window-plugin{a} qtdeclarative5-xmllistmodel-plugin 
  qtgraphicaleffects5-doc{a} qtlocation5-dev{a} qtmultimedia5-dev 
  qtmultimedia5-doc{a} qtmultimedia5-doc-html{a} qtscript5-dev 
  qtscript5-doc{a} qtscript5-doc-html{a} qtsensors5-dev{a} qtsvg5-doc{a} 
  qtsvg5-doc-html{a} qttools5-dev qttools5-dev-tools qttools5-doc{a} 
  qtwebkit5-doc-html{a} schroot{a} schroot-common{a} sqlite3{a} 
  ubuntu-html5-container ubuntu-html5-sdk{ab} ubuntu-html5-theme{a} 
  ubuntu-html5-theme-examples ubuntu-sdk ubuntu-sdk-libs 
  ubuntu-sdk-libs-dev{a} ubuntu-ui-toolkit-doc{a} 
  ubuntu-ui-toolkit-examples{a} ubuntu-ui-toolkit-theme{a} 
  unity-action-doc{a} upstart-app-launch{a} upstart-app-launch-tools{a} 
  usermetricsservice{a} wdiff{a} zlib1g-dev{a} 
The following packages will be upgraded:
  cpp-4.8 gcc-4.8 gcc-4.8-base hud libasan0 libatomic1 libgcc-4.8-dev 
  libgcc1 libglib2.0-0 libglib2.0-bin libgomp1 libitm1 libquadmath0 
  libstdc++6 libtsan0 
15 packages upgraded, 151 newly installed, 0 to remove and 293 not upgraded.
Need to get 108 MB/126 MB of archives. After unpacking 273 MB will be used.
The following packages have unmet dependencies:
 ubuntu-html5-sdk : Depends: qtdeclarative5-ubuntu-webapps-api which is a virtual package.
                    Depends: ubuntu-html5-ui-toolkit but it is not going to be installed.
The following actions will resolve these dependencies:
 Keep the following packages at their current version:              
  1. qtcreator-plugin-ubuntu [Not Installed]                          
    
  2. ubuntu-html5-sdk [Not Installed]                                 
    
  3. ubuntu-sdk [Not Installed]                                       
    
    

    Leave the following dependencies unresolved:

  4. libhud-client2 recommends hud (= 13.10.1+13.10.20131014-0ubuntu1)
    
  5. qtcreator-plugin-ubuntu-common recommends qtcreator-plugin-ubuntu
    
    
    

Accept this solution? [Y/n/q/?] y The following NEW packages will be installed: apparmor-easyprof{a} apparmor-easyprof-ubuntu{a} build-essential{a} click{a} click-apparmor{a} cordova-ubuntu-2.8 debhelper{a} dh-apparmor{a} dh-make{a} dpkg-dev{a} g++{a} g++-4.8{a} geoclue-gypsy{a} libalgorithm-diff-perl{a} libalgorithm-diff-xs-perl{a} libalgorithm-merge-perl{a} libdee-qt5-3{a} libglib2.0-dev{a} libgstreamer-plugins-base1.0-dev{a} libgstreamer1.0-dev{a} libgypsy0{a} libhud2{a} libjs-jquery{a} libmail-sendmail-perl{a} libpcre3-dev{a} libpcrecpp0{a} libpoppler-qt5-1{a} libqdjango-db0{a} libqgsttools-p1{a} libqt5clucene5{a} libqt5contacts5{a} libqt5designer5{a} libqt5designercomponents5{a} libqt5feedback5{a} libqt5help5{a} libqt5location5-plugins{a} libqt5multimedia5{a} libqt5multimedia5-plugins libqt5multimediaquick-p5{a} libqt5multimediawidgets5{a} libqt5organizer5{a} libqt5qml-graphicaleffects{a} libqt5script5 libqt5scripttools5{a} libqt5svg5{a} libqt5svg5-dev libqt5systeminfo5{a} libqt5v8-5-dev libqt5versit5{a} libqt5versitorganizer5{a} libqt5webkit5-dev libqt5webkit5-qmlwebkitplugin{a} libqt5xmlpatterns5{a} libqt5xmlpatterns5-dev libstdc++-4.8-dev{a} libsys-hostname-long-perl{a} libthumbnailer0{a} libu1db-qt5-3{a} libunity-action-qt1{a} libupstart-app-launch1{a} libusermetricsinput1{a} libxml2-dev{a} libxslt1-dev{a} po-debconf{a} python3-apparmor-click{a} python3-click{a} qmlscene qt3d5-dev qtdeclarative5-accounts-plugin qtdeclarative5-cordova-2.8-plugin{a} qtdeclarative5-dev-tools qtdeclarative5-folderlistmodel-plugin qtdeclarative5-friends0.2 qtdeclarative5-localstorage-plugin qtdeclarative5-particles-plugin qtdeclarative5-poppler1.0 qtdeclarative5-qtaudioengine-plugin qtdeclarative5-qtfeedback-plugin{a} qtdeclarative5-qtlocation-plugin qtdeclarative5-qtmultimedia-plugin{a} qtdeclarative5-qtorganizer-plugin qtdeclarative5-qtquick2-plugin{a} qtdeclarative5-qtsensors-plugin qtdeclarative5-u1db1.0 qtdeclarative5-ubuntu-ui-extras-browser-plugin{a} qtdeclarative5-ubuntu-ui-extras-browser-plugin-assets{a} qtdeclarative5-ubuntu-ui-toolkit-plugin{a} qtdeclarative5-unity-action-plugin{a} qtdeclarative5-usermetrics0.1 qtdeclarative5-window-plugin{a} qtdeclarative5-xmllistmodel-plugin qtlocation5-dev{a} qtmultimedia5-dev qtscript5-dev qtsensors5-dev{a} qttools5-dev qttools5-dev-tools sqlite3{a} ubuntu-html5-container ubuntu-html5-theme{a} ubuntu-html5-theme-examples ubuntu-sdk-libs ubuntu-ui-toolkit-theme{a} upstart-app-launch{a} upstart-app-launch-tools{a} usermetricsservice{a} wdiff{a} zlib1g-dev{a} The following packages will be upgraded: cpp-4.8 gcc-4.8 gcc-4.8-base hud libasan0 libatomic1 libgcc-4.8-dev libgcc1 libglib2.0-0 libglib2.0-bin libgomp1 libitm1 libquadmath0 libstdc++6 libtsan0 15 packages upgraded, 108 newly installed, 0 to remove and 293 not upgraded. Need to get 27.1 MB/45.8 MB of archives. After unpacking 104 MB will be used. Do you want to continue? [Y/n/?]

Avinash Raj
  • 78,556
  • 1
    Your example just has aptitude stopping installation. It doesn't actually install anything. – kiri Feb 05 '14 at 11:45
  • 2
    @AvinashRaj, ..but prior to installing aptitude shouldn't the dependencies issue be resolved? – rusty Feb 05 '14 at 17:12
  • yes,in most cases it resolves the dependencies. – Avinash Raj Feb 05 '14 at 17:14
  • 2
    I mean if the system has broken packages, it wouldn't allow new installations until that's fixed.. so how would you install aptitude without resolving the problem first! – rusty Feb 05 '14 at 17:19
  • in that case first we have to resolve the broken packages otherwise you can't able to install aptitude.If there was no error caused due to broken packages then you can install aptitude. – Avinash Raj Feb 05 '14 at 17:24
  • -1 for spamming the question with a link to you answer for the same! I can't cast one more for the rollback! – rusty Mar 31 '14 at 05:46
  • Can you justify the reason for linking your answer in the question? Why you think this should definitely solve most solution seekers' the problem (how are you sure that all of them have aptitude pre-installed)? – rusty Mar 31 '14 at 05:58
  • @rusty i saw many questions, that says i followed this main question and nothing helps.I provided the solution with aptitude.It works for him.He failed to read and execute all the answers.So that, i made a link on this question.See http://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies/397262?noredirect=1#comment544102_140246 – Avinash Raj Mar 31 '14 at 06:03
  • I still say that's not right, the site provides a mean for taking good answers to the top - upvotes (for OPs there's an additional accept vote.) (I've asked moderators if this is right) – rusty Mar 31 '14 at 06:13
  • But regarding aptitude, does that really work if it's not pre-installed? I'm really curious.. – rusty Mar 31 '14 at 06:17
  • Yes it does.It's better to ask to a mod. – Avinash Raj Mar 31 '14 at 06:32
  • This actually worked very well for me... aptitude did the whole thing. – ThunderBird May 04 '16 at 16:54
18

These methods need to be followed whenever you get eror regarding Unmet Dependencies

After following the instructions try installing the software. Atleast one of these methods should work for you

1. Before trying any new command or adding any new ppa try this

Cleaning up of the apt cache:

sudo apt-get clean

Cleaning up of any unused dependencies:

sudo apt-get autoremove

Updating apt-cache

sudo apt-get update

This will remove all the cache and will download a fresh cache. This should be done to get fresh cache packages and newer updates.

2. Try sudo apt-get install -f.

It will probably give some suggestions about removing and installing packages, do what seems reasonable.

3. Change the Download Server from Software Sources Because sometimes the files on a server are corrupted.

enter image description here
enter image description here
enter image description here

4. This also happens if you before added an external ppa for the broken dependency.Try removing that ppa by

  • either typing sudo add-apt-repository --remove ppa:someppa/ppa and then manually removing the ppa installed files/libraries

or

  • purging a ppa (this removes the installed files also)

    sudo apt-get install ppa-purge   #a one time install 
    sudo ppa-purge ppa:someppa/ppa  
    

5. If no 4 is not your case then atleast try to remove the package that is being shown as a broken dependency.Then try again installing.This is reported to have workeed for quite a few people.

6. Always add the stable version of a repository/PPA.

enter image description here

7 Also make sure you have all the official repositories enabled (In Software Sources)

enter image description here

Please do not enable the Proposed Updates as they are meant for testing/developers.

enter image description here


As told by doug:

Usually the best 1st step to resolving this is to identify the source of <pkg1> & <pkg2>.

Additionally not noted is that in many, if not most cases, "<whatever> is to be installed" really means "<whatever> is installed" and should be tried to be removed if nothing else works (as in point 5).


I'll keep adding more things ill find to fix unmet dependencies.

Radu Rădeanu
  • 169,590
Ashu
  • 9,482
  • 3
    @Ashu One thing you may want to fix--apt-get update does not update the apt cache (which consists of downloaded .deb files and a file that stores information about which .deb files you have stored). It updates the package index files (which consist of information about what packages are available to be downloaded and installed from each available software source). As I said before, apt-get clean does not clean out the same thing that apt-get update updates. See man apt-get for details. – Eliah Kagan May 30 '12 at 19:07
11

My answer is similar to rick's above.

Using apt-get clean, apt-get autoclean, apt-get autoremove, apt-get upgrade, apt-get update, apt-get -u dist-upgrade, etc. all didn't work for me.

I finally resolved this issue by descending into the dependency tree via apt-get install, illustrated with an example below. In my case, I wanted to install libmagickwand-dev:

apt-get install libmagickwand-dev

I got this error:

The following packages have unmet dependencies:
 libmagickwand-dev : Depends: libmagickcore4-extra (= 8:6.6.9.7-5ubuntu3.2) but it is not going to be installed
                     Depends: libmagickcore-dev (= 8:6.6.9.7-5ubuntu3.2) but it is not going to be installed

So, I ran apt-get install for one of the failing dependencies:

apt-get install libmagickcore-dev

The following packages have unmet dependencies:
 libmagickcore-dev : Depends: libmagickcore4-extra (= 8:6.6.9.7-5ubuntu3.2) but it is not going to be installed
                     Depends: libgraphviz-dev but it is not going to be installed

I descended further down the tree:

apt-get install libgraphviz-dev

with another error:

The following packages have unmet dependencies:
 libgraphviz-dev : Depends: libgvc5 (= 2.26.3-10ubuntu1) but it is not going to be installed

Once more deeper down the tree:

apt-get install libgvc5

Fore some strange reason, this succeeded, and I was able to install the original package I wanted with apt-get install libmagickwand-dev:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libcdt4 libgd2-xpm libgraph4 libpathplan4
Suggested packages:
  libgd-tools
The following NEW packages will be installed:
  libcdt4 libgd2-xpm libgraph4 libgvc5 libpathplan4
0 upgraded, 5 newly installed, 0 to remove and 2 not upgraded.
Need to get 808 kB of archives.
After this operation, 2,320 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Michael F
  • 652
  • 1
  • 6
  • 12
8

Excellent answers! But today my case seems different from yours. Here's my advice.

Problem:

I failed to install apache2 in ubuntu 10.10.

rick@wen-VirtualBox:~$ sudo apt-get install apache2

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:

 apache2 : Depends: apache2-mpm-worker (= 2.2.16-1ubuntu3) but it is not going to be installed or

                    apache2-mpm-prefork (= 2.2.16-1ubuntu3) but it is not going to be installed or

                    apache2-mpm-event (= 2.2.16-1ubuntu3) but it is not going to be installed or

                    apache2-mpm-itk (= 2.2.16-1ubuntu3) but it is not going to be installed

           Depends: apache2.2-common (= 2.2.16-1ubuntu3) but it is not going to be installed

E: Broken packages

Solution:

My way is add the depended package into install list.

If 'sudo apt-get install apache2' failed, try 'sudo apt-get install apache2 apache2.2-common'.

See? apache2.2-common comes from error log of previous step.

At last I found there's a dependency chain like this:

 apache2.2-common <-- apache2.2-bin <-- libaprutil1-ldap <-- libaprutil1

For the first 3 packages, apt-get log told me ' is not going to be installed',

but for the last package, it shows 'libaprutil1-ldap : Depends: libaprutil1 (= 1.3.9+dfsg-3build1) but 1.3.9+dfsg-3ubuntu0.10.10.1 is to be installed'

I have a different version existing in my lib, so:

sudo apt-get remove libaprutil1

sudo apt-get install apache2

Now it's ok.

rick
  • 89
  • 1
    A combined reading of this answer and the other one above here gives a better UNDERSTANDING of what a dependency issue is. When other answers here provide 'Highly Generalized' SOLUTIONS, this provides UNDERSTANDING. – Venkatesh Jul 18 '14 at 11:17
7

what is unmet dependencies Error

On Ubuntu packages are the primary way that software is built, deployed, and installed. Very simply, packages are an alternative to downloading, building, and installing software from scratch. They offer a host of advantages in terms of installation, removal, monitoring, and handling interactions between pieces of software over the standard "build from source" model. Ubuntu uses centralized packaging system ,Ie Every package is depends to some other packages .When we installs a package it's dependencies will be installed ,The unmet dependencies error occurs when the the dependencies of the package is not available for installation

Possible causes

1.Computer is not connected to the Internet
2.The repository containing the depandancy package is not enabled
3.Package catalog is not updated
4.The version of the depandancy in the current repository is old
5.Software index is broken
6.The depandancy is not available for ubuntu

Let's TRy to solve it

  1. Connect to the internet :D
  2. Make sure that all the default repositories are enabled

    ->You can easily add them in the Software Center->Edit->Software Sources->Other Sources->Add"

    -> Start the Software Center.

    ->. In the panel go to Edit and select Software Sources.

    edit-software-sources

    ->Make sure all the repositories are checked enter image description here

  3. Update the software catalog

    click on the top right icon and chose update-available Entry in the menu
    enter image description here

and press check button enter image description here

4.type ctrl+alt+t to open terminal and type sudo apt-get install -f

5.Purge the recently added ppa using ppa-purge ppa-purge Install ppa-purge

This program disables a PPA from your Software Sources and reverts your system back to the official Ubuntu packages. You can use this to return your system to normal after testing a new version from a PPA.

Syntax

sudo ppa-purge ppa:<repository-name>/<subdirectory>

Example

sudo ppa-purge ppa:ubuntu-mozilla-daily/ppa
  1. open software center ,and try to install any software , If the following dialog box appeared ,press on the repair button ,and wait

enter image description here

Else type ctrl+alt+t to open terminal and type sudo apt-get install -f and follow the onscreen instructions

If still error occurs, Feel free to to ask it in askbuntu

Tachyons
  • 17,281
  • @jrg I already have that in my answer... does every answer need to have the same thing? – Ashu May 24 '12 at 13:14
  • 2
    @Ashu I'm trying to help people to make a canonical answer - and I have to tell everyone, since there is a 500 rep bounty at stake and I don't want to play favorites with helping certain people with their answers but ignoring others. :s – jrg May 24 '12 at 13:18
5

...dont forget about `build-dep`

In addition to those answers above -- I have to admit I am surprised that nobody have mentioned this approach which, is what I have always used as a "silver bullet" at any time I encountered apt-get conflicts or unresolved packages (or even if the system is being stubborn....ha!).

EDITED: using sudo dpkg -r [package] is encouraged as it has pretty powerful removal function. Since apt-get works alongside with dpkg, which means apt-get will obey dpkg function.

  sudo dpkg -r [package]
  sudo apt-get build-dep [package]  
  ## pre-install all deps for the package

You call apt-get to purge the failed package you were trying to install in the system, and then you call build-dep command, which apt-get will grab and install dependencies individually belonging to this package, so that way they'll satisfy the package prior. Then finally, call the apt-get install:

sudo apt-get install [package]

....'Ugh! Let's twist your arm until you yell "Uncle!"'

This rarely happened during my long years of linux use, but I found myself using this approach seldomly and succeeded. This is an example for the recent struggle I had earlier a month ago with packages mysql-client/mysql-server. After a dozen failed attempts to reset my root password with mysql-server (even via --skip-grant-tables techqiue but yet failed), I finally succeed in 'twisting Linux's arm until it yelled "Uncle!"':

sudo dpkg -r mysql-server mysql-client
sudo apt-get autoclean  
## this dumps any copy of existing package to prevent apt-get from "re-using" it.
sudo apt-get build-dep mysql-client   
 ## one package at a time, starting with client first
sudo apt-get install mysql-client
sudo apt-get build-dep mysql-server
sudo apt-get install mysql-server

apt-get autoclean is the key in this solution

Faron
  • 1,398
  • 10
  • 14
3

During the installation of i386 packages in 64 bit Multiarch Ubuntu systems

If you're trying to install a package which depends on many i386 packages, the above stated dependency error also would be caused if you fail to add i386 architecture by running sudo dpkg --add-architecure i386 command.

Example:

avinash@avinash-Lenovo-IdeaPad-Z500:~$ sudo apt-get install skype
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: skype : Depends: skype-bin but it is not installable E: Unable to correct problems, you have held broken packages. avinash@avinash-Lenovo-IdeaPad-Z500:~$ sudo dpkg --add-architecture i386 avinash@avinash-Lenovo-IdeaPad-Z500:~$ sudo apt-get install skype Reading package lists... Done Building dependency tree
Reading state information... Done The following extra packages will be installed: gcc-4.8-base:i386 gcc-4.9-base:i386 libasound2:i386 libasound2-plugins:i386 libasyncns0:i386 libaudio2:i386 libavahi-client3:i386 libavahi-common-data:i386 libavahi-common3:i386 libc6:i386 libcgmanager0:i386 libcomerr2:i386 libcups2:i386 libdbus-1-3:i386 libdbusmenu-qt2:i386 libdrm-intel1:i386 libdrm-nouveau2:i386 libdrm-radeon1:i386 libdrm2:i386 libelf1:i386 libexpat1:i386 libffi6:i386 libflac8:i386 libfontconfig1:i386 libfreetype6:i386 libgcc1:i386 libgcrypt11:i386 libgl1-mesa-dri:i386 libgl1-mesa-glx:i386 libglapi-mesa:i386 libglib2.0-0:i386 libgnutls26:i386 libgpg-error0:i386 libgssapi-krb5-2:i386 libgstreamer-plugins-base1.0-0:i386 libgstreamer1.0-0:i386 libice6:i386 libjack-jackd2-0:i386 libjbig0:i386 libjpeg-turbo8:i386 libjpeg8:i386 libjson-c2:i386 libk5crypto3:i386 libkeyutils1:i386 libkrb5-3:i386 libkrb5support0:i386 libllvm3.4:i386 liblzma5:i386 libmysqlclient18:i386 libnih-dbus1:i386 libnih1:i386 libogg0:i386 liborc-0.4-0:i386 libp11-kit0:i386 libpciaccess0:i386 libpcre3:i386 libpng12-0:i386 libpulse0:i386 libqt4-dbus:i386 libqt4-declarative:i386 libqt4-network:i386 libqt4-opengl:i386 libqt4-script:i386 libqt4-sql:i386 libqt4-sql-mysql:i386 libqt4-xml:i386 libqt4-xmlpatterns:i386 libqtcore4:i386 libqtdbus4:i386 libqtgui4:i386 libqtwebkit4:i386 libsamplerate0:i386 libselinux1:i386 libsm6:i386 libsndfile1:i386 libspeexdsp1:i386 libsqlite3-0:i386 libssl1.0.0:i386 libstdc++6:i386 libtasn1-6:i386 libtiff5:i386 libtinfo5:i386 libtxc-dxtn-s2tc0:i386 libudev1:i386 libuuid1:i386 libvorbis0a:i386 libvorbisenc2:i386 libwrap0:i386 libx11-6:i386 libx11-xcb1:i386 libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386 libxcb-glx0:i386 libxcb-present0:i386 libxcb-sync1:i386 libxcb1:i386 libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxi6:i386 libxml2:i386 libxrender1:i386 libxshmfence1:i386 libxslt1.1:i386 libxss1:i386 libxt6:i386 libxv1:i386 libxxf86vm1:i386 mysql-common skype-bin:i386 sni-qt:i386 zlib1g:i386 Suggested packages: nas:i386 glibc-doc:i386 locales:i386 rng-tools:i386 libglide3:i386 gnutls-bin:i386 krb5-doc:i386 krb5-user:i386 libvisual-0.4-plugins:i386 gstreamer-codec-install:i386 gnome-codec-install:i386 gstreamer1.0-tools:i386 gstreamer1.0-plugins-base:i386 jackd2:i386 pulseaudio:i386 libqt4-declarative-folderlistmodel:i386 libqt4-declarative-gestures:i386 libqt4-declarative-particles:i386 libqt4-declarative-shaders:i386 qt4-qmlviewer:i386 libqt4-dev:i386 libicu48:i386 libthai0:i386 qt4-qtconfig:i386 Recommended packages: xml-core:i386 The following NEW packages will be installed: gcc-4.8-base:i386 gcc-4.9-base:i386 libasound2:i386 libasound2-plugins:i386 libasyncns0:i386 libaudio2:i386 libavahi-client3:i386 libavahi-common-data:i386 libavahi-common3:i386 libc6:i386 libcgmanager0:i386 libcomerr2:i386 libcups2:i386 libdbus-1-3:i386 libdbusmenu-qt2:i386 libdrm-intel1:i386 libdrm-nouveau2:i386 libdrm-radeon1:i386 libdrm2:i386 libelf1:i386 libexpat1:i386 libffi6:i386 libflac8:i386 libfontconfig1:i386 libfreetype6:i386 libgcc1:i386 libgcrypt11:i386 libgl1-mesa-dri:i386 libgl1-mesa-glx:i386 libglapi-mesa:i386 libglib2.0-0:i386 libgnutls26:i386 libgpg-error0:i386 libgssapi-krb5-2:i386 libgstreamer-plugins-base1.0-0:i386 libgstreamer1.0-0:i386 libice6:i386 libjack-jackd2-0:i386 libjbig0:i386 libjpeg-turbo8:i386 libjpeg8:i386 libjson-c2:i386 libk5crypto3:i386 libkeyutils1:i386 libkrb5-3:i386 libkrb5support0:i386 libllvm3.4:i386 liblzma5:i386 libmysqlclient18:i386 libnih-dbus1:i386 libnih1:i386 libogg0:i386 liborc-0.4-0:i386 libp11-kit0:i386 libpciaccess0:i386 libpcre3:i386 libpng12-0:i386 libpulse0:i386 libqt4-dbus:i386 libqt4-declarative:i386 libqt4-network:i386 libqt4-opengl:i386 libqt4-script:i386 libqt4-sql:i386 libqt4-sql-mysql:i386 libqt4-xml:i386 libqt4-xmlpatterns:i386 libqtcore4:i386 libqtdbus4:i386 libqtgui4:i386 libqtwebkit4:i386 libsamplerate0:i386 libselinux1:i386 libsm6:i386 libsndfile1:i386 libspeexdsp1:i386 libsqlite3-0:i386 libssl1.0.0:i386 libstdc++6:i386 libtasn1-6:i386 libtiff5:i386 libtinfo5:i386 libtxc-dxtn-s2tc0:i386 libudev1:i386 libuuid1:i386 libvorbis0a:i386 libvorbisenc2:i386 libwrap0:i386 libx11-6:i386 libx11-xcb1:i386 libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386 libxcb-glx0:i386 libxcb-present0:i386 libxcb-sync1:i386 libxcb1:i386 libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxi6:i386 libxml2:i386 libxrender1:i386 libxshmfence1:i386 libxslt1.1:i386 libxss1:i386 libxt6:i386 libxv1:i386 libxxf86vm1:i386 mysql-common skype skype-bin:i386 sni-qt:i386 zlib1g:i386 0 upgraded, 115 newly installed, 0 to remove and 7 not upgraded. Need to get 63.7 MB of archives. After this operation, 225 MB of additional disk space will be used. Do you want to continue? [Y/n]

Avinash Raj
  • 78,556
  • I agree that it may be one of the possible cause. when I tried to install some other package (for example vlc) after installing skype and I got the unmet dependency. I came out of similar situation by adding :amd64 at the end of the package name that causing the error. how did you recovered? what would be best the solution? – sourav c. Feb 24 '15 at 10:59
  • Not sure why this was downvoted. It's what I needed to install 32-bit Wine. BTW, you have a typo in --add-architecture, and you should add a reminder to run apt-get upgrade after --add-architecture. – Matt Chambers Aug 04 '15 at 18:56
1

After having tried close to every method mentioned in this thread (and others) I was close to giving up. I'd upgraded my Debian Lenny to Squeeze, and I couldn't for the life of me figure out why PHP5, Apache, MySQL etc. didn't want to install. In the end I tried to use

sudo apt-get purge apache2
sudo apt-get purge php5
sudo apt-get purge mysql-server
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get install apache2 php5 mysql-server

..and it worked flawlessly! (Beware, it might destroy your config files, so back them up!)

h2ooooooo
  • 119
1

What worked for me is to re-install the dependency. It is the case where the installed version is more recent than the latest (what synaptic shows). It is actually equivalent to allow synaptic to downgrade the dependency package.

Another thing that worked is using "aptitude":

root@arau:~# aptitude install libgfortran3
The following NEW packages will be installed:
  libgfortran3{b} 
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 250 kB of archives. After unpacking 1 230 kB will be used.
The following packages have unmet dependencies:
 libgfortran3 : Depends: gcc-4.8-base (= 4.8.2-19ubuntu1) but 4.8.4-2ubuntu1~14.04 is installed.
Internal error: found 2 (choice -> promotion) mappings for a single choice.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     libgfortran3 [Not Installed]                       



Accept this solution? [Y/n/q/?] n
Internal error: found 2 (choice -> promotion) mappings for a single choice.
Internal error: found 2 (choice -> promotion) mappings for a single choice.
The following actions will resolve these dependencies:

      Downgrade the following packages:                                        
1)      cpp-4.8 [4.8.4-2ubuntu1~14.04 (now) -> 4.8.2-19ubuntu1 (trusty)]       
2)      gcc-4.8 [4.8.4-2ubuntu1~14.04 (now) -> 4.8.2-19ubuntu1 (trusty)]       
3)      gcc-4.8-base [4.8.4-2ubuntu1~14.04 (now) -> 4.8.2-19ubuntu1 (trusty)]  
4)      libasan0 [4.8.4-2ubuntu1~14.04 (now) -> 4.8.2-19ubuntu1 (trusty)]      
5)      libatomic1 [4.8.4-2ubuntu1~14.04 (now) -> 4.8.2-19ubuntu1 (trusty)]    
6)      libgcc-4.8-dev [4.8.4-2ubuntu1~14.04 (now) -> 4.8.2-19ubuntu1 (trusty)]
7)      libgomp1 [4.8.4-2ubuntu1~14.04 (now) -> 4.8.2-19ubuntu1 (trusty)]      
8)      libitm1 [4.8.4-2ubuntu1~14.04 (now) -> 4.8.2-19ubuntu1 (trusty)]       
9)      libquadmath0 [4.8.4-2ubuntu1~14.04 (now) -> 4.8.2-19ubuntu1 (trusty)]  
10)     libstdc++6 [4.8.4-2ubuntu1~14.04 (now) -> 4.8.2-19ubuntu1 (trusty)]    
11)     libtsan0 [4.8.4-2ubuntu1~14.04 (now) -> 4.8.2-19ubuntu1 (trusty)]      

Accept this solution? [Y/n/q/?] y
Bob Yoplait
  • 1,884
0

If you are getting an error like this:
enter image description here

This is telling you that the packages are already installed, but it has not installed all of the other packages it needs to work. You should be able to solve this by running this:

sudo apt-get -f install

(This command should automatically install the unmet dependencies.)

or something like this (with the relevant packages):

sudo apt-get install click curl dpkg-dev python-lzma python-requests imagemagick ubuntu-dev-tools

But if you end up with this sort of error: cannot install package/package not available/no installation candidate etc

You can then search for ways to install them here or here.
With the above example, you should be able to find a page like this, and then use a PPA, or install a .deb for 32bit, or a .deb for 64bit.

Wilf
  • 30,194
  • 17
  • 108
  • 164