Ubuntu

How to fix Ubuntu not updating issue due to the broken packages

How to fix Ubuntu not updating issue due to the broken packages

Ubuntu has proven to be one of the most powerful operating systems, but from time to time, things can go wrong while performing an update process.

Have you ever faced a broken package while updating Ubuntu? Do you know that Apt (which is Ubuntu's most famous and powerful package manager) has a built-in function that can help you solve this situation and get things back to its normal state?

During this tutorial, we are going to cover how to fix a broken package during your update process. Next, we will discuss some tips and tricks that should help you get out of the broken package situation.

Fix a Broken Package Using APT or APT-GET

As we have mentioned previously, Apt is Ubuntu's most powerful and useful package manager. Apt has some useful flags that can be used to fix broken packages or packages that are missing some dependencies.

First Method

Step 1. Perform an update using the fix-missing option, and this step will help you to make sure that the required packages are up-to-date.

sudo apt --fix-missing update

Step 2. After the update finishes, you can force Apt to search for any broken packages or missing package dependencies and then correct them. This step will fix and repair the existing packages and install any missing packages.

sudo apt install -f

Second Method Using APT And DPKG

If the previous solution did not work, you could try the next few steps:

Step 1. Try to update your package list using the following command.

sudo apt update

Step 2. Clean up any partially installed package.

sudo apt autoclean

Step 3. Then use the next command to clean the apt cache.

sudo apt clean

Step 4. Next, you can clean up not needed dependencies.

sudo apt autoremove

During running this command, you can quickly identify the broken package. Then you can move on to the next step.

Step 5. If you have identified the package name, then you can use the next command to remove this package forcefully.

sudo dpkg --remove -force --force-remove-reinstreq Package_Name

Fix a Broken Package Using DPKG

During the configuration process and after the installation, you may face some errors. The Apt here is not capable of doing anything. If a package fails during the configuration, the dpkg is the most appropriate tool that will take care of this situation and will fix it.

Step 1. First force the dpkg tool to reconfigure any currently broken configured package.

sudo dpkg --configure -a

If this step did not fix the problem, move on to the next step.

Step 2. List all the packages that have been marked as required to be installed by dpkg.

sudo dpkg -l | grep ^… r

After executing the previous command, you should see packages with problems.

Step 3. Now you can use the following command to remove the broken packages forcibly.

sudo dpkg --remove --force-remove--reinstreq

Step 4. After the previous command finishes successfully, then you need to clean everything using the Apt.

sudo apt clean

Step 5. Next, you can get back to your update process.

sudo apt update

Finally, in this tutorial, we have covered different methods to fix your broken or misconfigured package. Now you can move on and start using your system normally again.

Gry Vulkan for Linux Users
Vulkan for Linux Users
With each new generation of graphics cards, we see game developers push the limits of graphical fidelity and come one step closer to photorealism. But...
Gry OpenTTD vs Simutrans
OpenTTD vs Simutrans
Creating your own transport simulation can be fun, relaxing and extremely enticing. That's why you need to make sure that you try out as many games as...
Gry OpenTTD Tutorial
OpenTTD Tutorial
OpenTTD is one of the most popular business simulation games out there. In this game, you need to create a wonderful transportation business. However,...