How to Fix the “Unable to correct problems, you have held broken packages” Error

The most well-known feature of the Ubuntu operating system is its apt repository which allows the user to install a large number of various packages using commands. Sometimes, while trying to use this tool, a problem may be encountered with the statement “Unable to correct problems, you have held broken packages”.

This article will equip you with all the knowledge that you need to understand this error and also fix this error if it occurs on your system.

How to Fix the “Unable to correct problems, you have held broken packages” Error?

Many causes can invoke this issue on your system. This section will elaborate on the various causes behind this error and also provide their respective solutions.

Reason 1: The Repository is Not Updated

The most common reason to invoke this error is that the apt repository on your system is not updated. When this is the case, and you attempt to install or upgrade a package, the error will pop up on your system since the dependencies are not up to date.

Solution: Update the Repository

The best solution for this issue is to update the apt repository on your system using the command:

$ sudo apt update

Performing this update will update any dependencies that need to be updated on your system.

Reason 2: Broken Packages

There are cases when your system has corrupted packages that are causing this error to pop up. After removing packages, some dependencies for that package may remain on the system, which can cause an interruption for the apt package manager.

Solution: Remove the Broken Packages

The best method to resolve this issue is to remove the remains of these packages from the apt package repository by executing the command:

$ sudo apt autoremove

Reason 3: System is Holding Packages

There exists another major reason why the error statement is directly referring to. The reason is that the system is holding certain packages.

When this happens, they can not be upgraded and neither be removed. The command below can be executed to check if any packages are being held by the system:

$ sudo apt-mark showhold

If the command does not show any packages, this means that no packages are being held.

Solution: Unhold the Packages

Otherwise, proceed to the step where you will un-hold these packages by executing the below command:

$ sudo apt-mark unhold package_name

Here, the “package_name” represents the package that was being held by the system and was displayed by the previous command.

That’s all from this guide!

Conclusion

The “Unable to correct problems, you have held broken packages” occurs due to 3 major reasons. The apt repository is not updated, there are broken dependencies on your system, or the system is holding some packages. They can be resolved by updating the apt repository, removing the broken dependencies, or performing the “unhold” command on the packages held by the system. This article has elaborated on all the possible reasons that can invoke this error and also demonstrated the solutions to these issues.