How to Fix Broken Ubuntu 20.04 without Reinstalling It (2023)

We often came across some faulty errors and faced some serious system issues like a broken Operating system. We are only left with a black screen, and it seems like the ultimate fix will be to reinstall the Operating system. That is not the only solution; we can fix a broken Operating system without reinstalling it using some different techniques that we are going to perform in this article. Reinstalling a whole Operating system is not a good option because it may lead to data loss of all important files and folders.

Fixing process

If you came across the error something like, ‘Could not get lock /var/lib/apt/lists/lock’ or ‘Could not get lock /var/lib/dpkg/lock’, then you can fix this broken issue by following the step by step guide provided below:

Step 1: Login from Live CD or bootable USB

First of all, sign in using the live CD or bootable USB drive, and back up your data in some external hard drive so that you can save it somewhere else and reinstall the operating system if needed.

Step 2: Remove the lock files

Open tty1 using the keyboard shortcut keys CTRL + ALT + F1, and type the commands provided below to remove the lock files.

If your error is ‘Could not get lock /var/lib/apt/lists/lock’, then type the command:

$ sudo rm /var/lib/apt/lists/lock

How to Fix Broken Ubuntu 20.04 without Reinstalling It (1)

If your error is ‘Could not get lock /var/lib/dpkg/lock’, then type the command:

(Video) Fix Broken Ubuntu OS without Reinstall It / How to repair Ubuntu OS @TheDarkestNetwork

$ sudo rm /var/lib/dpkg/lock

How to Fix Broken Ubuntu 20.04 without Reinstalling It (2)

Along with the lock files, remove the lock-frontend file too using the command:

$ sudo rm /var/lib/dpkg/lock-front-end

How to Fix Broken Ubuntu 20.04 without Reinstalling It (3)

If you have broken apt-cache as well, then type the command:

$ sudo rm /var/cache/apt/archives/lock

(Video) How to Fix Broken Packages In Ubuntu 20.04 18.04,17.10,16.04 & Linux mint. How to repair ubuntu

How to Fix Broken Ubuntu 20.04 without Reinstalling It (4)

After removing the lock files, Reconfigure the dpkg.

Step 3: Reconfigure dpkg

To reconfigure all the packages installed, type the command provided below;

$ sudo dpkg --configure -a

How to Fix Broken Ubuntu 20.04 without Reinstalling It (5)

Step 4: Clean local repository

To clear out all the local repository, type the command given below:

$ sudo apt clean

How to Fix Broken Ubuntu 20.04 without Reinstalling It (6)

Step 5: update all the packages

After clearing the local repository, update the installed packages with the –fix-missing option.

$ sudo apt update --fix-missing

(Video) Fresh installation of Ubuntu 20.04 without losing files

How to Fix Broken Ubuntu 20.04 without Reinstalling It (7)

Step 6: install all broken packages and dependencies

Now, force the package manager to install all the broken packages or missing dependencies using the command provided below:

$ sudo apt install -f

How to Fix Broken Ubuntu 20.04 without Reinstalling It (8)

After installing the broken packages and missing dependencies, reconfigure dpkg once again using the command:

$ sudo dpkg --configure -a

How to Fix Broken Ubuntu 20.04 without Reinstalling It (9)

Upgrade the system’s packages:

(Video) Fix Broken Ubuntu OS Without Installing it (2022)

$ sudo apt upgrade

How to Fix Broken Ubuntu 20.04 without Reinstalling It (10)

Upgrade the dependencies as well using the dist-upgrade command:

$ sudo apt dist-upgrade

How to Fix Broken Ubuntu 20.04 without Reinstalling It (11)

Step 7: Reboot the system

After fixing everything up, restart eh system using the command provided below:

$ sudo reboot

How to Fix Broken Ubuntu 20.04 without Reinstalling It (12)

(Video) Fix Broken Package & Dependency Error In Ubuntu 20.04

Once you have followed all the steps given above, everything will be back in order and work smoothly.

Conclusion

This post gives a brief and in-detail solution on how to fix broken Ubuntu 20.04 without reinstalling it. After following all the steps provided in this post, you can save the reinstallation time and get back to the real work in a couple of minutes.

Videos

1. How to Repair Linux With Boot Failure
(Chris Titus Tech)
2. Ubuntu: How do I recover documents from a broken Ubuntu installation? (4 Solutions!!)
(Roel Van de Paar)
3. How to fix broken packages on Ubuntu? (2 Solutions!!)
(Roel Van de Paar)
4. Linux Tip | Fixing Broken Browsers
(Joe Collins)
5. How to Fix Broken Packages & Updates in Ubuntu // Ubuntu Tips & Tricks
(EposVox)
6. libdvd-pkg apt-get check failed you may have broken packages fix
(joezomby1)
Top Articles
Latest Posts
Article information

Author: Aracelis Kilback

Last Updated: 10/22/2022

Views: 5709

Rating: 4.3 / 5 (44 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Aracelis Kilback

Birthday: 1994-11-22

Address: Apt. 895 30151 Green Plain, Lake Mariela, RI 98141

Phone: +5992291857476

Job: Legal Officer

Hobby: LARPing, role-playing games, Slacklining, Reading, Inline skating, Brazilian jiu-jitsu, Dance

Introduction: My name is Aracelis Kilback, I am a nice, gentle, agreeable, joyous, attractive, combative, gifted person who loves writing and wants to share my knowledge and understanding with you.