Ubuntu and other Linux distributions often might get broken due to many reasons. Sometimes, you may just lose access to your operating system or forget the root password. In those circumstances, chances are that you would probably think of erasing your current OS and reinstalling the Ubuntu OS again. In addition, to back up the data you might also use the GParted tool. But, all the above solutions are really time-consuming and not so much techy-geeky to recover an unbootable Linux OS. Instead of reinstalling, you can boot into rescue mode or emergency mode in Ubuntu to fix the system. Please follow the methods mentioned below carefully if you’re a newbie to Ubuntu and had already got your system broken.
Boot into Rescue Mode or Emergency Mode in Ubuntu
Usually booting into Ubuntu does not occur any issues unless you’re not using a multiboot hard disk drive with a very complex bootloader EFI file. If you’ve installed Ubuntu first on your system then install other operating systems with the same bootloader directory, you might hurt one of those boot loader files.
However, sometimes in dual-boot or in the triple-boot systems, Ubuntu might appear in emergency mode due to filesystem mismatches. In this post, we will see how to boot into rescue mode or emergency mode in Ubuntu.
1. Enter Rescue Mode in Ubuntu for Booting
The rescue mode is an in-built feature in Ubuntu that helps users for saving the system while it’s unbootable due to a corrupted filesystem. Entering into the rescue mode is simple and straightforward. When you power up your system, please press the boot menu.
In most common motherboards and VirtualBox systems pressing the ESC key from the keyboard opens the boot menu. When the boot menu opens, please press the e
button on the keyboard to access GNU GRUB rescue script functions.
Now, from the script, scroll down to the line that starts with linux
. You can also reach the bottom of the script by pressing ctrl
and the e
button (ctrl + e) at a time. Now, from the script, delete the following data string.
Delete the string from the script
“$vt_handoff”.
Now, add the following string line inside the script.
systemd.unit=rescue.target
You can now save the script and exit it by pressing the ctrl + X
at a time on the keyboard. Now, when the boot loader reboots please perform the following commands to reset the system password and see the block device lists.
# passwd ubuntupit
# blkid
Finally, reboot your Ubuntu system to exit the rescue mode and go back to the regular Ubuntu mode.
# systemctl reboot
2. Enter Emergency Mode in Ubuntu for Booting
The process of entering the rescue mode and the emergency mode on Ubuntu is pretty much the same. The emergency mode in Ubuntu defines that the system has filesystem error or the configuration error with the mounting and unmounting. fixing this issue also requires the boot-level tasks that we have just seen in the rescue mode.
First, fire up your computer and enter the boot menu by pressing the Esc button, then press the e button on the boot menu to enable the configuration script. Now, from the script, go to the line that starts with linux
and delete the following handoff string.
$vt_handoff
You may now add the system daemon emergency daemon string into the script then save it and exit it by pressing the Ctrl + X button from the keyboard.
systemd.unit=emergency.target
Now, after a reboot, you would see the command-line interface to dig into the emergency mode. First, make sure that your system is now functional with default root access. Then execute the following cat command to locate the fstab
file from the etc directory.
Then mount and remount the file inside the system. Finally, rescue the password from the emergency mode on your Ubuntu system. When you successfully end up in the emergency mode, please perform the reboot command.
# cat /etc/fstab
# mount -o remount,rw /
# passwd root
# systemctl reboot
In addition, if you need to do more changes on the emergency mode, please make sure that your filesystem is mounted and remounted. Then after finishing the configuration, execute a system reboot.
# mount -o remount,rw /
# systemctl reboot
Extra Tip: Use GRUB Repair If You Break the Boot
The above-mentioned methods are for those who have already destroyed the boot menu. Sometimes, if you use multiple operating systems on the machine, that might also cause you to break the boot. However, please do not forget to use the powerful GRUB repair tool before you think of erasing the entire OS.
It can recover, update, fix MBR repair, and even it can fix the Windows GRUB. The official website of Ubuntu also promotes this handy tool to be more used for fixing broken boots.
Final Words
Entering the original boot menu and recovering the entire broken or locked system is nothing new in the world of open source. Since Ubuntu is one of the most used Linux distributions, we have illustrated the methods on how you can boot into rescue mode or emergency mode in Ubuntu. Please follow the above-mentioned steps to recover your system with extra care so you don’t make harm to the other filesystem drives.
Please share it with your friends and the Linux community if you find this post useful and informative. You can also write down your opinions regarding this post in the comment section.