One of the quite common errors while installing packages on Ubuntu is the “Held broken packages” error, 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.
Are you 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.
Why Did This Error Occur?
This error is commonly encountered when you try to install any application from a third party PPA, while installing a specific version of an application, or when you install any other application that relies on a specific 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 does 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 know, there are many reasons for the above error, so I cannot guarantee which solution will work on your system.
But I can give you five different methods to troubleshoot the issue, and hopefully one of them will solve the problem.
Update Your System Repository
When you get 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 get resolved. Otherwise, you need to move on to the next solution.
Install Missing Dependencies
From the above steps, you are sure that the dependency that is required for your application is not available due to its obsolescence in the latest release of your distribution.
To fix this issue, you can manually download the dependency from the Launchpad, or you can search the internet for information on how to install specific dependencies.
For example, if I’m trying to install a specific version of LibreOffice 1:7.3.2-ubuntu2, then I’m sure I’ll get the error of unmet dependencies, so to avoid this, I can specify all the dependencies one by one as 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
But sometimes you won’t be able to manually make it up because ABC packages depend on BCD packages, and BCD depends on EFG, which will become tiresome to fulfil 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 saviour 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
$ 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 behaviour 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 Pacakge 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 find out the five different ways to fix the “E: Unable to correct problems, you have held broken packages” error.
So whenever you get the error of an unment dependency, run any of the following commands to fix it up:
$ sudo apt update && sudo apt upgrade
$ sudo aptitude install "package-name"
$ sudo dpkg --force-depends --install "package-name"
$ sudo apt-mark unhold "package-name"
If you know any other method, then let us know in the comment section.
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.