How to Boot into Rescue Mode Or Emergency Mode in Ubuntu 22.04?

The rescue and emergency modes of Ubuntu are quite helpful when users want to recover lost files. Another use could be to fix the system that is not booting up or is slowed down. The rescue mode is used when the system needs to be recovered with only a few services available. Emergency mode is when the system boots with minimal services and mounts the root filesystem as read-only. But how do you boot the system into rescue or emergency mode on Ubuntu? By pressing the escape key.

Today’s post will demonstrate the ways to boot into rescue/emergency mode on Ubuntu. 

  • Importance of the Rescue or Emergency Mode on Ubuntu
  • Boot Ubuntu 22.04 Into Rescue Mode or Emergency Mode?
  • Exit From the Rescue or Emergency Mode on Ubuntu?

Importance of the Rescue/Emergency Mode on Ubuntu

The Rescue and Emergency Mode on Ubuntu 22.04 are important features that allow users to troubleshoot and fix various system issues that may arise during the boot. It can help users deal with the following:

  • Rescue Mode provides a command-line interface that can be used to repair file system errors that may prevent the system from booting up normally. 
  • By the use of the Rescue Mode, users can also reset the root password. 
  • Emergency Mode can diagnose and fix problems responsible for preventing the system from booting, such as read-only file system and it is the best for debugging.

How to Boot into Rescue/Emergency Mode on Ubuntu? 

To boot Ubuntu 22.04 either into rescue or emergency mode, the process is almost the same. Let’s discuss them in the following steps:

Step 1: Start or Reboot the System

When the system boots, users can see a GRUB menu like below. If you use VMware or VirtualBox to use Ubuntu 22.04, press the “ESCAPE” key right after you start the system and the above menu appears.

From here, Highlight the Ubuntu entry on the GRUB menu and press the “E” key to edit the boot parameters.

Step 2: Edit Boot Parameters

From this screen, use the arrow keys to reach the end, and then find the line starting with Linux. Add the following text to boot into Rescue Mode, at the end of the line starting with ‘linux.’

systemd.unit=rescue.target

For Emergency mode, add this line:

systemd.unit=emergency.target

Step 3: Boot into Rescue Mode

After adding “systemd.unit=rescue.target” in the GRUB menu entry, use the combination of the buttons “CTRL+X” of just “F10” to boot into rescue mode. It takes a few seconds to load from this point, so don’t panic if the screen goes black:

As the above image highlights, the system is now in rescue mode. Press “CTRL+D” or “Enter” for maintenance.

For example, if you want to mount the root file system, the following command can be used:

# mount -n -o remount, rw /

You can view the system logs using the “journalctl command. Let’s view the last ten system logs using this command:

# journalctl -n 10

In the above image, the last ten system logs are displayed.

Step 4: Boot into Emergency Mode

After adding “systemd.unit=emergency.target” in the GRUB menu entry, use the combination of the buttons “CTRL+X” of just “F10” to boot into rescue mode. From the next menu, press the “Enter” key to continue:

As the above image highlights, the system is now in rescue mode. Press “CTRL+D” or “Enter” for maintenance. For example, if you want to mount the root file system, the following command can be used:

# mount -n -o remount,rw /

You can view the system logs using the “journalctl command. Let’s view the last ten system logs using this command:

# journalctl -n 10

In the above image, the last ten system logs are displayed.

How to Exit from the Rescue/Emergency Modes on Ubuntu?

To exit from the rescue or emergency mode on Ubuntu 22.04, press “CTRL+D” or use the following commands:

# exit
# reboot
# systemctl default
# systemctl reboot

After a while, the system boots up normally.

Note: Once the system restarts, the edited settings in the GRUB Boot Parameters are automatically reverted.

Conclusion

To boot into Rescue or Emergency modes, users must enter “systemd.unit=rescue.target” and “systemd.unit=emergency.target” in the boot parameters. Both of these modes are useful when fixing system issues, such as mounting the root file system, and the user is always logged in as the root user.

This guide has explained how to boot into rescue or emergency mode in Ubuntu 22.04.