Tuesday, April 27, 2021

Debian: Use apt-get to fix missing and broken packages

Package managers in Linux are the most useful programs that are used to add additional capabilities in a system. They can be used for installing, removing, updating, and upgrading the packages, also featuring the dependency resolution capabilities. However, like any other program, things can also go wrong with these package managers. Sometimes, while updating or installing a third-party program, installation goes wrong and results in errors that require you to install the missing dependencies and broken packages. This error may also occur because of improper package management, incorrect installation of packages, and the installation of unnecessary packages. Whatever the reason may be, the problem is that you receive an error and left with a condition where you cannot add a new package nor update or delete the existing packages until you fix the problem. 
In this article, we will learn how to fix the missing dependencies and broken packages using the apt-get command. Note that, we have run the commands and procedure mentioned in this article on a Debian 10 system. The same procedure can be followed in Ubuntu and older Debian versions. 

We will use the command-line Terminal for trying the solutions and fixing the problem. To open the Terminal application in Debian, hit the super key on the keyboard and search for it using the search bar that appears. When the search result appears, click on the Terminal icon to open it. Using apt-get to fix missing and broken packages Apt-get is a Terminal based package management tool used for installing, upgrading, and removing packages. Along with these features, it also has flags that can be used for fixing missing dependencies and broken packages.

Use the “fix-missing” option with “apt-get update” to run the updates and ensure the packages are up to date and there is no new version available for the packages.

$ sudo apt-get update --fix-missing

Once you are done with the update, execute the below command in order to force the package manager to find any missing dependencies or broken packages and install them.


.

$ sudo apt-get install -f

Another approach to solving the broken package issue via apt-get is to edit the “/etc/apt/sources/list” file and adding sites with newer versions of packages available. Then running the “apt-get update” command to update the repository list.

If the above method does not fix the issue of broken dependencies and broken packages and still you are receiving the error, then try the following methods.



Linux Tutorial - 12. Process Management

  Process Management! The wheels are in motion Introduction Linux in general is a fairly stable system. Occasionally, things do go wrong how...