Home 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

by Hend Adel
fix ubuntu broken package error

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.

You may also like

2 comments

Shrey July 24, 2020 - 5:56 AM

None of the option works for me. Please Help

Reply
Wayne Osman February 3, 2021 - 10:43 AM

I am proposing you use Torrents to download Linux versions. For the past 10-year period, I have used download portals from their reputable sources, namely Ubuntu, Mint, Debian, Android Arch and many others. At the time I never realized until recently all my downloads form their distributors were riddled with errors. A suggestion by a few not all just a few Linux technicians and software reviewers, reminded many to use torrent portals instead to get better image ISO’s without errors. This may sound silly to a few, still I urge more to download and use Torrents for this purpose. To hopefully make anyone understand Torrents are used for many other reasons than you might have been told and to make it clear I’m not talking about Video’s or Music. Anyone needing to download from, example Ubuntu has guided paths to download their Linux distribution making Torrent use safe and an effective way getting better image ISO’s

Reply

Leave a Comment

fl_logo_v3_footer

ENHANCE YOUR LINUX EXPERIENCE.



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us

Subscribe

©2016-2023 FOSS LINUX

A PART OF VIBRANT LEAF MEDIA COMPANY.

ALL RIGHTS RESERVED.

“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.