Fixing “Unable to correct problems, you have held broken packages”

Ubuntu broken package error

While there are several ways to install apps on Ubuntu, I prefer to use the apt command in the terminal to install software

.

If you do the same, you may encounter a dependency error like this:

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 moved out of Incoming. The following information may help resolve the situation: The following packages have unsatisfied dependencies: green-recorder : Depends: python-urllib3 but is not installable E: Problems cannot be corrected, broken packages have been retained.

Usually, at It’s FOSS, you’ll find simple, easy-to-follow solutions to complicated problems. Unfortunately, this one is not so straightforward.

In this troubleshooting article, I will tell you why this error occurs and give you some tips on how to resolve this issue.

Why do I see the error “you have retained broken packets”?

You were trying to install an application package, most likely from a PPA or third-party repository.

Applications often need specific versions of libraries and software components (called dependencies). These dependencies may not be part of the application package itself, but are expected to be already installed on the system or installed during application installation.

Your Linux system attempts to install these dependencies on its own. But if the dependency pack version is not available on your system, you get confused as you have no way to solve this dependency issue.

That’s why it informs you that the software you were trying to install depends on XYZ, but this XYZ cannot be installed.

Another use case is when your package can be maintained is when you try to install two versions of the same software. Let’s say you’re installing a specific version of Wine when you already have another one installed.

How to Fix “Can’t fix problems, you’ve retained broken packages” error

You can try a few things to get things working. You should have some ideas about installing/removing packages on the Linux command line to figure things out here.

Make sure that the

system

packet cache is up to date

First, make sure that the local packet cache is up to date. The system checks this cache for available packages. It is possible (but not certain) that the system will see the dependency package after the cache update.

sudo apt update Try installing the problematic package again and see if

it fixes the problem

.

Install

the dependency

If you try to install the problematic package again and still complain about the same dependency error, perhaps that dependency is not available for the distribution version.

You can use the apt search command to see if this library could be from some other package or name: sudo apt search

package_name If the package

is available, is it the same version requested by the package you were trying to install?

Try installing the dependency package and see what happens:

sudo apt install dependency_package

You can find a chain of dependencies. He tries to install dependency A but complains about B. Then he tries to install B and complains about C.

It can also happen that when you try to install the C package, it is already installed. Check the version of package C. Is it the same version that package B requires? If so, then removing C and installing it again might help.

Can you get the missing dependency pack from some other source?

If the missing dependency package

cannot be found on your system (there are no results in the apt search), you can try to get the dependency package from somewhere else. I know it’s not a very convenient thing to do, but you don’t have many options here.

For example, in the

case of installing shutter, you complained about libgoo-canvas-perl and this library is no longer available on Ubuntu system.

sudo apt install shutter Reading package lists… Done Creation of dependency tree Reading status 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 moved out of Incoming. The following information may help resolve the situation: The following packages have unsatisfied dependencies: shutter : Depends: libgoo-canvas-perl but will not install E: Unable to correct problems, has retained broken packages.

However, since it was available in older versions of Ubuntu, I looked for this package in the Ubuntu package archive and found it in the Ubuntu 14.04 list here. I downloaded the . DEB and installed it.

Now that this dependency package is installed, trying to install the

original app (shutter in this case) should no longer complain about at least this

package.

If you can’t find the dependency package anywhere, install the problematic package from another source

So, in the example above, I tried to install the Green Recorder app using its PPA. This application needs the python-urllib3 library, but unfortunately, this library is not available on my Ubuntu 20.04 system.

[email protected]:~$ apt search python-urllib3 Sorting… Full text search done…

Clearly done, this is a poorly packaged app. The developer made it available for Ubuntu 20.04 without realizing that Ubuntu 20.04 is no longer compatible with Python 2 and all Python libraries now start with the python3 prefix. So python-urllib3 should be python3-urllib3.

If you find yourself in such a situation, perhaps check the home page of the project or search the Internet for an alternative source to install it. Maybe there is a Snap/Flatpak version or some user created a PPA for it? If nothing else, you can also go with the source code option.

If you see the

broken package error held during the update, try

this

Most of the discussion so far assumed that you see this error when installing a new application. This may not always be the case.

If you see this error when you try to update your system with the sudo apt update command, then you will have to take a slightly different approach.

First, check which packet is being held with this command:

dpkg -get-selections | grep hold

If you see that some packages are held, delete them and then continue updating your system or installing the software

.

You can also use the Synaptic package manager to repair broken packages

.

Did you manage to fix the problem?

As I mentioned earlier, there is no simple solution to this problem. You will have to investigate on your own and see if it can be fixed or not.

Please share feedback if your problem is solved. If not, I can try to help you.