Surely on some occasion you have had problems with broken packages. If so and you have a Debian / Ubuntu distro or based on them, you can solve these problems in a fairly simple way by following the steps in this tutorial. That way they will stop being a nuisance to you ...
But first of all you should know What are they the broken packages, if you don't already know. Well, sometimes it may be the case that a package cannot be installed correctly for some reason or that it is not compatible with the rest of the packages on which it depends. If that happens, you will not be able to update, install or uninstall any package from the distro. The package that causes all that trouble is the so-called broken package ...
The reasons why the broken packages are given can be:
- You tried to install a program external to the official repositories of the distribution.
- The installation of a program is accidentally interrupted. Whatever the reasons.
- Or that the update of the operating system is interrupted.
- There are also other causes, although the above are the most frequent ...
Table of Contents
Fix broken packages problem
Whatever the cause, you must fix it so that everything continues to work correctly. To put a solution to this common problem you should just follow these simple steps ...
You have probably seen that you were trying to install something on typical mistake type:
- Could not get lock / var / lib / dpkg / lock
- Unable to lock directory / var / lib / apt / lists /
To be able to solve you can run these commands:
sudo rm /var/lib/apt/lists/lock sudo rm /var/cache/apt/archives/lock
Fix problem with dpkg
It is likely that when using the low-level package management tool dpkg and you got the error:
- dpkg: error processing package [package_name] (–purge))
For, fix it You can do the following if you don't know the name of the package causing the problem:
sudo dpkg –configure -a sudo dpkg –remove –force-remove –reinstreq
Instead, if you know the name try this:
sudo mv /var/lib/dpkg/info/nombre_de_tu_paquete.* /tmp/ sudo dpkg –remove –force-remove-reinstreq nombre_de_tu_paquete
Remember to substitute your_package_name by the name of the package that is causing the problem in your case ...
Fix problem with APT
Another way to do it is by using APT, the high-level package manager. To do this, first make sure that there are no new versions of the packages:
sudo apt –fix-missing update
If not, try run the order:
sudo apt install -f sudo apt update