After upgrading from 10.04 to 12.04 I am trying to install different packages. For instance ia32-libs and skype (4.0).
When trying to install these, I am getting the 'Unable to correct problems, you have held broken packages' error message.
Output of commands:
sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
After running this:
sudo dpkg --configure -a
foo@foo:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
That particular error message may indicate that you have held packages, but it may also indicate a different problem.
You can get a list of actual held packages with:
If there are none, or none look related, then it's probably something else. Check carefully the output of the command you were trying when you got the error message, as there may be other clues in the full output from that command, aside from the error message.
Another method of troubleshooting may be to use aptitude rather than apt-get to try to install your package:
Aptitude will give up less easily and will attempt to find solutions that may involve modifying other packages. It may give you more explanation of the problem and options for fixing it.
Occasionally aptitude will be too eager to remove or downgrade large numbers of packages to satisfy your request, in which case retrying with
-f
changes its priorities and helps it come up with solutions that involve removing/downgrading fewer packages even if it means not all changes you requested can go ahead:Edit: this is an old answer, and since it was written a newer APT front end, simply titled
apt
, has become the preferred command line APT interface for end-users. It is still not the Swiss army knife thataptitude
is, but it's a bit more human-oriented thanapt-get
. I haven't taken the time to investigate how it would help in the above scenario, but it's worth using.That happened to me too. All I did was
sudo apt-get update
and that fixed my issue. Good luck.I had a similar scenario in a fresh install of 14.04, with no files listed in
dpkg --get-selections | grep hold
, and no joy aftersudo apt-get update
.What did fix it for me was a simple
When I tried to reinstall the failing package it worked fine. Yay!
A
Unable to correct problems, you have held broken packages
error message often occurs because you are trying to install or have installed a package that you're not supposed to install. These are some fast and easy ways to fix theyou have held broken packages
error.Open your sources.list file in
/etc/apt/sources.list
and check that there aren't any software sources for a different Ubuntu release than the Ubuntu release that you are currently using. If you find any incorrect release lines in sources.list, open the sources.list file withsudoedit /etc/apt/sources.list
, comment out the incorrect lines in sources.list by preceding them with a#
character, save the sources.list file, and runsudo apt update
to update the list of available software packages.If you have manually downloaded a .deb file simulate installing it by running
apt install --simulate ./downloaded-deb-file.deb
. If downloaded-deb-file.deb cannot be installed because of unmet dependencies the results ofapt install --simulate ./downloaded-deb-file.deb
will list these unmet dependencies. Since the command is a simulation you don't need and shouldn't usesudo
or run it as root. Note the version requirements of each unmet dependency and search the web for a .deb file(s) that meets these version requirements. If you have found a .deb file that meets its version requirements, download it and runapt install --simulate ./new-downloaded-deb-file.deb
to check if the newly downloaded .deb file has any unmet dependencies of its own.Select the Fix Broken Packages option in Synaptic package manager. Run the following commands to install Synaptic.
Open Synaptic and in Synaptic select Edit -> Fix Broken Packages and then repeat Edit -> Fix Broken Packages a second time.
In Synaptic in the left pane click the Custom Filters button which is marked by the mouse cursor in the below screenshot. From the list in the top left corner select Broken. In the center pane will be listed any broken packages that still need to be repaired.
Select the broken packages one at a time. Select a broken package, and then open the terminal and run
apt policy <package-name>
. The results of this command will tell you if that broken package was installed from the default Ubuntu repositories or from some other source. If the broken package was installed from some other source, maybe that package can be removed along with its software source and replaced by a different version of the same package from the default Ubuntu repositories. Usually this means fixing a broken package by downgrading that package to an older version.If you get this error message:
Run the following commands:
Manually remove a broken package.
Find your package in
/var/lib/dpkg/info
Move the package folder to another location.
Run the following command:
If all of these methods don't work it is possible that the broken packages are caused by something that is embedded so deeply in the operating system that none of these methods have any effect on it. The first obvious place to look for this deeply embedded "something" is in the software sources in
/etc/apt/sources.list
. Check the sources.list file to see if it contains any non-standard lines that may be causing a broken packages error. A standard Ubuntu sources.list file looks like the sources.list files in this answer.The correct way to remove a suspicious line from sources.list is to comment it out by preceding it with a
#
character. Then runsudo apt update
to refresh the list of available software.I ran into a similar scenario regarding missing dependencies. In my case I was trying to install curl on ubuntu saucy salamander 13.10...
The error stated that the dependency required an earlier version of the curl3 library.
I was able to degrade to the earlier version by trying to install curl using aptitude.
When it noted the missing dependency, and the reason (required an earlier version of the library file), it gave me several options in how to respond... y//n/q
Y would have aborted the install, N would look for another option, and Q would simply quit and do nothing more, leaving a broken package.
I selected N, and it gave me the option to downgrade the library file to an earlier version. So that's what I did, and curl finished installing with no more errors.
I have tried all the methods mentioned on this page. Somehow it did not work for me.
This is how I fixed it: Track the broken package and reinstall it.
Here is an example:
I am trying to install
aptitude
.It could not install
libcwidget3v5
Try installing
libncursesw5
Try installing
libtinfo5
Bingo, this guy is the culprit
libtinfo5
, it already there, remove and reinstall.Remove or purge
libtinfo5
.apt purge libtinof5
would be better as it removes the configuration files as well.Reinstall
libtinfo5
againNow try installing
aptitude
Had the same problem, I ran that package check command from the other answer (
dpkg --get-selections | grep hold
) and sawso I used "
apt-get remove tomcat7-common
"Then I could install Tomcat 6 (I was removing Tomcat 7 and installing Tomcat 6 as you do).
Let's understand this error with an example:
Assume this is the error message:
Let's break it down into variables:
Here
X
is the package you are trying to install.Y
is the package, which is causing dependency troubles (there may be multipleY
s) andZ
is the version that is required.So in a summary:
X
needs the packageY
with the versionZ
to work.However,
apt
is facing troubles while finding the versionZ
forY
.So, let's check if version
Z
is available for the packageY
. We can useapt-cache policy <package_name>
to find the available versions for the package. For example:Here, you can see two versions for the package
nginx
is available. The version required byX
isZ
. According to the version table, versionZ
for the packageY
is available. Butapt
always installs the latest version (I know it's a little dumb.) So there are two ways to fix this:apt
.To install the correct package version use:
Where is the package causing dependency troubles and is the version needed by X. Now, the installation should be successful.
To increase the aptitude of your package manager:
Where is the package you are trying to install. Some useful tips with aptitude:
-f
option will do advance troubleshooting. It's pretty useful!selecting
n
for a solution will make aptitude propose more solutions!Running
man aptitude
will show a detailed manual for using aptitude. Online manual.Is the package version not available?
First, try running
sudo apt update
to update the repository list. Then try installing the package again.Still not available?
You have two options:
Search for the package in https://packages.ubuntu.com/ and restore the default repositories.
Add custom PPAs to satisfy dependencies.
Searching package and restoring default repositories:-
Go to https://packages.ubuntu.com
Scroll down to the Search section.
In the Keyword column, enter the name of the package.
In the Distribution column, select the code name of your Ubuntu version (
lsb_release -c
).Click on search!
Select the Exact Hit.
Check the version and repository for the package.
Check if the version needed and version available matches. If yes then refer to How do I restore the default repositories?
Adding a custom PPA.
You have to take help from Google for that. Just google up the package and version and hopefully you'll find a PPA.
Some helpful commands:
sudo apt -f install <package>
to force install package.sudo aptitude -f install <package>
To force install package.sudo add-apt-repository whatever/ppa
to add a PPA.sudo apt purge <package>
to remove a package.I'm asking a new question, what information should I provide?
Information such as:
lsb_release -d
.sudo apt install <package>
apt policy <package>
andapt policy <package's dependency>
Other details should be provided when asked.
For me, none of the above worked because my system wasn't updated. I did
Home Key > Software Updater > Install
and updated my system; afterwards, I could install my package normally with
apt
.I had the same problem reinstalling
xsane
after a failedppa
installation. As happened to yochannah (now called 'StackExchange What The Heck'), "no files listed indpkg --get-selections | grep hold
, and no joy aftersudo apt-get update
".The hint that
apt-get
gave me isxsane : Depends: libsane (>= 1.0.24) but it is not going to be installed
Because of yochannah's answer, I had the feeling I must remove some previously installed packages. And it was so, I had to manually remove all related packages to
sane
, amongst othersxsane-common
andlibsane
, which was still installed as theppa
version.Therefore, watch out what you have previously installed and tidy up!