How to Boot into Rescue Mode Or Emergency Mode In Ubuntu 20.04 / 18.04

It’s not uncommon for users to forget their login passwords or have their system suffer a corrupt filesystem. When that happens, the recommended solution is to boot into rescue or emergency mode and apply the required fixes.

The rescue mode is also referred to as the single-user mode. As the name suggests, the rescue mode is used when you want to salvage your system from a system failure, for example, boot failure or reset a password. In rescue mode, all the local filesystems are mounted. However, only salient services are started. Normal services such as network services will not be started.

Emergency mode provides a minimal bootable environment and enables you to repair your Linux system even when rescue mode is not available. In emergency mode, only the root file system is mounted, and in read-only mode. Just as with rescue mode, only the essential services are activated in emergency mode.

In this guide, you will learn how to boot into rescue mode or emergency mode in Ubuntu 20.04 / 18.04.

Booting Ubuntu 20.04 in Rescue Mode

To get started, boot, or reboot your system. You will get the grub menu with options listed as shown. If you are running Ubuntu as a VM in VirtualBox, press the ESC button.

By default, the first option is selected. With the first option selected, press the ‘e’ key on the keyboard to access the grub parameters.

Ubuntu Grub Menu
Ubuntu Grub Menu

Scroll and locate the line that starts with ‘linux’. Go to the very end of the line by pressing ctrl + e and delete the string “$vt_handoff”.

Edit Grub Parameters
Edit Grub Parameters

Next, append ‘systemd.unit=rescue.target’ at the end of the line.

Enable Rescue Mode in Ubuntu
Enable Rescue Mode in Ubuntu

To boot the system into rescue mode, press ctrl + x. Proceed and press ENTER on your keyboard to gain access to the rescue mode. From there you can perform operations such as changing a user’s password. In the example below, I have managed to reset my password.

In rescue mode, all filesystems are mounted in read & write mode and you can run almost any commands just as you would in a normal session. Once you are done, reboot the system to save the changes using the command:

# passwd james
# blkid
# systemctl reboot
Reset Password in Ubuntu
Reset Password in Ubuntu

Booting Ubuntu 20.04 in Emergency Mode

As we mentioned earlier, in emergency mode, all files are mounted in read-only mode. The emergency mode comes in handy especially when it’s not possible to boot into rescue mode due to file system corruption.

To boot into emergency mode, reboot or boot your system. On the grub menu, ensure that the first option is highlighted and press the ‘e’ key on the keyboard to access the grub parameters.

Ubuntu Grub Menu
Ubuntu Grub Menu

Once again, navigate to the end of the line by pressing ctrl + e and delete the string “$vt_handoff”.

Edit Grub Parameters
Edit Grub Parameters

Next, append the ‘systemd.unit=emergency.target’ string at the end of the line.

Enable Emergency Mode in Ubuntu
Enable Emergency Mode in Ubuntu

Thereafter, press ctrl + x to reboot into emergency mode. Hit ENTER to access the root filesystem. From here you can view various files on your Linux system. In this example, we are viewing the contents of the /etc/fstab to see the mount points that are defined.

# cat /etc/fstab
# mount -o remount,rw /
# passwd root
# systemctl reboot
Emergency Mode in Ubuntu
Emergency Mode in Ubuntu

To make any changes to the system, you need to mount it in read and write mode as shown.

# mount -o remount,rw /

From here, you can perform any troubleshooting tasks such as changing the root password as shown. Once you are done, reboot for the changes to come into effect.

# systemctl reboot

This draws the curtain on this article. Hopefully, you can now access both the rescue and emergency mode and fix system issues in the Ubuntu system.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

James Kiarie
This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.