How to repair a damaged Ubuntu system without reinstalling

Today, I am upgrading my Ubuntu 18.04 LTS system. Unfortunately, during the update of Ubuntu, the power was cut off and the system shut down. After the power was restored, I started the system again. After entering the password on the login page, it becomes blank and there is no response. The keyboard and mouse are also useless. I only see a blank screen! Fortunately, it is only a test machine and has no important data. I can simply erase the entire system and reinstall it. However, I do not want to do this. Since I have nothing to lose, I just want to repair my broken Ubuntu system without reinstalling, and I succeeded! If you find yourself in a situation like mine, don't panic. This short tutorial describes how to easily repair a damaged Ubuntu system without losing data, without reinstalling.

Repair broken Ubuntu system###

First, try to log in with live cd and back up data in an external drive. In case this method is useless, you can still get the data and reinstall the system!

On the login page, press CTRL+ALT+F1 to switch to tty1. You can learn more about switching between TTYs here.

Now, enter the following commands one by one to repair the damaged Ubuntu Linux.


  1. $ sudo rm /var/lib/apt/lists/lock
  2. $ sudo rm /var/lib/dpkg/lock
  3. $ sudo rm /var/lib/dpkg/lock-frontend
  4. $ sudo dpkg --configure -a
  5. $ sudo apt clean
  6. $ sudo apt update --fix-missing
  7. $ sudo apt install -f
  8. $ sudo dpkg --configure -a
  9. $ sudo apt upgrade
  10. $ sudo apt dist-upgrade

Finally, use the command to restart the system:


  1. $ sudo reboot

You can now log in to your Ubuntu system as usual.

After I finished these steps, all the data in my Ubuntu 18.04 test system is still there, everything is the same as before. This method may not be suitable for everyone. However, this little trick worked for me and saved some time compared to heavy loading. If you know other better methods, please let me know in the comment section. I will also add them in this guide.

This is it. Hope this article is useful.

( adsbygoogle = window.adsbygoogle || []).push({});

Recommended Posts

How to repair a damaged Ubuntu system without reinstalling
How to open the ubuntu system in win10
[Practice] How to install python3.6 on Ubuntu system
How to configure /var/log/messages in Ubuntu system log
How to upgrade to Ubuntu 20.04
How to upgrade to Ubuntu 20.04
How to set up a DNS server on Ubuntu 18.04
How to start a blog with Hexo on Ubuntu 14.04
How to configure a fixed IP based on Ubuntu 18.04
How to modify time zone and time in ubuntu system
How to install theano and keras on ubuntu system
How to create a Python virtual environment in Ubuntu 14.04
How to set a fixed IP based on Ubuntu 16.04
Teach you how to install Ubuntu system enhancement tools
How to upgrade to Ubuntu 16.04 LTS
How to control the ubuntu system in win10 through ssh
How to create LVM for XFS file system under Ubuntu
How to set up a Masterless Puppet environment on Ubuntu 14.04
Teach you how to build a Git server on Ubuntu
How to set up a firewall with UFW on Ubuntu 14.04
How to set up a production Elasticsearch cluster on Ubuntu 14.04
How to install JDK and Mysql on Ubuntu 18.04 linux system
How to install Dropbox Client as a service on Ubuntu 14.04
How to create a Sudo user on Ubuntu [Quick Start]
How to install Helm in Ubuntu
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to use hanlp in ubuntu
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to compile ijkplayer-android under ubuntu
How to install Anaconda3 on Ubuntu 18.04
How to install mysql in Ubuntu 14.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install PrestaShop on Ubuntu 16.04
How to upgrade to PHP 7 on Ubuntu 14.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 18.04
How to install KVM on Ubuntu 20.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to install Jenkins on Ubuntu 18.04
How to deploy Django on Ubuntu 14.04
How to install Apache on Ubuntu 20.04
How to install R on Ubuntu 20.04
How to install Moodle on Ubuntu 16.04
How to install Solr 5.2.1 on Ubuntu 14.04
How to install Teamviewer on Ubuntu 16.04
How to secure Nginx on Ubuntu 14.04