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

Have you ever faced a broken package error while updating Ubuntu? Do you know that the Apt package manager has a built-in function that can help you solve this situation? Let's show you how.

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.

Hend Adel
Hi! I'm Hend Adel, a freelancer technical geek with successful experience in Database, Linux and many other IT fields. I help to build solutions to suit business needs and creating streamlined processes. I love Linux and I'm here to share my skills via FOSS Linux! Thanks for reading my article.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

24,536FansLike
172FollowersFollow

LATEST ARTICLES

Uninstall Programs in Ubuntu
Uninstallation of programs can be done by graphical way using the Ubuntu Software Center, and the Synaptic Package manager. Command-line way of doing it is also possible using apt-get and aptitude commands. We shall discuss each one of them in detail.
best linux distros programmers
Linux distros have long been a favorite among programmers since the rise in popularity of the OS in the nineties. Programmers are technical by nature, and Linux distros appeal to that technical nature. Let's discuss why Linux is a great desktop OS for programmers and developers, and find out best distros suitable for them.
best linux distros beginners
Making the shift to Linux is not as complicated as some people make it out to be. There is a variety of Linux distributions available that cater to the needs of people who are planning on making the jump to Linux from any other operating system.
Free up hard disk space ubuntu
Hard disk space can easily get filled up with cached package files, old kernels, and other obsolete files that occupy unwanted hard disk space. Here are top five best and safer ways to clean and free up hard disk space in Ubuntu. We show you Terminal and GUI way of cleaning up system.
best video players for linux
Most Linux-based systems come with a built-in video player, but let's be honest, it most definitely won't be able to satisfy all of your requirements, due to the fact that default software is mostly made for basic purposes. In this article, we will review the 5 Best Video Players for Linux and thoroughly discuss their features as well as their pros and cons.