One of the quite common errors while installing packages on Ubuntu is the unable to correct problems you have held broken packages, which can be solved very easily with this guide.
When you try to update your system or install any application on your Ubuntu or Debian based distributions you will find the following message at the end of the screen:
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 resollve the situation:
The following packages have unmet dependencies:
tasksel : Depends: tasksel-data but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
If you are getting the same message on your end? Then you’ve been redirected to the right page, where I’ll show you how to fix the this error.
Before that, let me tell you some of the common reasons for the “E: Unable to correct problems, you have held broken packages”, then we will move to the solution part.
Table of Contents
Why Did This Error Occur?
This error is commonly encountered when you try to install any application from a third-party PPA or else while installing a specific version of an application.
Also, this error can appear when you try to install any other application that relies on a specific version of a dependency or when you mark the specific package to be held for installation, removal, or modification.
Now you might be wondering how a third party PPA can be the reason for the dependency error.
Yes, PPA can be the cause of the above error because sometimes the dependency that is required for the application is obsolete in the latest release of distributions.
So, when you use
apt commands to install an app, it makes sure that all dependencies are met before installing the app.
If a dependency is missing, it throws an error.
Not only just PPA cause this error, but a missing or already installed dependency can also cause it when you try to install a specific version of an application from the Ubuntu/Debian repositories.
As you now know, there are so many reasons for the above error, so I cannot vouch for which solution will work on your end.
But I can give you five different methods to troubleshoot the issue, and hopefully one of them will solve the problem.
📝 Quick Action
To resolve the unable-to-correct problems you have held, broken packages can be easily fixed with any of the following commands:
$ sudo apt update && sudo apt upgrade $ sudo aptitude install "package-name" $ sudo dpkg --force-depends --install "package-name" $ sudo apt-mark unhold "package-name"
Update Your System Repository
When you see the “unmet dependency error,” the first thing you should do is update the system repository information so the system can have the latest information about the packages.
Open your system terminal and execute the following command:
$ sudo apt update $ sudo apt upgrade
If the issue is related to the discrepancy in package information, then the problem will be resolved. Otherwise, you need to move on to the next solution.
Install Missing Dependencies
The next approach is to fulfill the required dependency that is missing on your system.
To install a dependency, you can either manually download the dependency from the Launchpad, or search the internet for information on how to install specific dependencies.
For example, I have been trying to install a specific version of LibreOffice 1:7.3.2-ubuntu2, but I get the error of unmet dependencies with the lists of dependencies it’s needed.
Now to resolve the error I can just list the dependencies name with the version like shown below
$ sudo apt install libreoffice=1:7.3.2-ubuntu2\ libreoffice-core=1:7.3.2-0ubuntu2\ libreoffice-base libreoffice-calc libreoffice-draw\ libreoffice-core libreoffice-impress libreoffice-math\ libreoffice-writer python3-uno=1:7.3.2-0ubuntu2
If the system is not throwing any further complications, then your work is done.
But there are some scenarios where you won’t be able to manually make it up because ABC packages depend on BCD packages, and BCD depends on EFG, which will make it tiresome to fulfill all the dependencies.
Install Missing Dependencies Using Aptitude
In that case, you can take advantage of the
aptitude command, which can turn out to be a savior tool to install an older version of an application without throwing an error.
aptitude command will not be available out of the box, so you need to manually install it on your platform by running the following command:
$ sudo apt install aptitude
Once you have installed the aptitude command, run the following command, replacing “libreoffice=1:7.3.2-0ubuntu2” with the name of the package you want to install.
$ sudo aptitude install libreoffice=1:7.3.2-0ubuntu2 or $ sudo aptitude install libreoffice
After executing the command, it will look for possibilities to install the application by resolving dependencies, and it will ask for your confirmation on whether you want to continue with the options.
The behavior of above command:
If you agree, then type ‘Y’ to start the installation.
Install Application Forcefully
Anyway, if you want to install an application without considering missing dependencies, then you can do that with the
dpkg command, which will ignore the dependency requirement.
For this, you need to have a .deb binary package and use the --force and --install flags as shown below:
$ sudo dpkg --force-depends --install tasksel_3.34ubuntu16_all.deb
The output of the above command:
After running the above command, your problem will be resolved for sure, but expect some issues due to the missing dependency.
Check Held Package and Unhold
This error can also happen if you have held certain libraries, utilities, or applications from being installed, removed, or updated to the latest version.
If you are unsure about this, then you can list the applications that you held in your system by typing the below command:
$ sudo apt-mark showhold
Write down the name of the package and replace it with the real name of the package in the command below to release the package from the held list.
$ sudo apt-mark unhold "package-name"
If you want to unhold all the held packages, then run the below command:
$ sudo apt-mark unhold `sudo apt-mark showhold`
That’s all for this article, where you learned the five different ways to fix the “E: Unable to correct problems, you have held broken packages” error.
I’m curious to know which method worked in your case, so don’t forget to put the method that you used to solve the problem.
See you soon…in the next article.
A man with a tech effusive who has explored some of the amazing technology stuff and is exploring more. While moving towards, I had a chance to work on Android development, Linux, AWS, and DevOps with several open-source tools.