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.
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.
$ sudo rm /var/lib/apt/lists/lock
$ sudo rm /var/lib/dpkg/lock
$ sudo rm /var/lib/dpkg/lock-frontend
$ sudo dpkg --configure -a
$ sudo apt clean
$ sudo apt update --fix-missing
$ sudo apt install -f
$ sudo dpkg --configure -a
$ sudo apt upgrade
$ sudo apt dist-upgrade
Finally, use the command to restart the system:
$ 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