How to Boot into Rescue/Emergency Mode in Ubuntu 20.04 LTS

The ability to boot into rescue mode or emergency mode in Ubuntu 20.04 LTS is vital for system recovery and troubleshooting. Essential services are activated in these modes, providing a command-line interface for repairing the system.

This article will explain rescue and emergency modes, their significance in system maintenance, and a step-by-step guide to boot into them in Ubuntu 20.04 LTS. Whether recovering a forgotten password, fixing file system errors, or addressing other crucial system issues, this guide will equip you with the necessary knowledge and procedures. Understanding these modes is important for any Ubuntu user, making this article a valuable resource for the maintenance of the reliability and stability of your system. 

Read our Ubuntu Review

Nowadays, people are getting more strict about their online privacy and data, and this leads to switching their Operating System to Linux as it is known as most secured and privacy-centric Operating System from its core.

Booting into Rescue Mode

Whenever your Ubuntu system encounters issues that prevent it from booting normally, you may need to boot into rescue mode to pinpoint and fix the problem. This section will demonstrate two ways to boot into the rescue mode in Ubuntu 20.04 LTS..

Method 1: Accessing the GRUB menu and editing the boot parameters.

Follow the step-by-step procedures to access the GRUB boot menu during the boot process and edit the boot parameters to boot Ubuntu into rescue mode:

  • Power on your system and wait until the BIOS logo disappears to display the GRUB menu.

Use the arrow keys, navigate to the “Advanced options for Ubuntu” option, and hit the Enter key, or press the ESC key when the menu appears.

  • Choose the first option that says “Ubuntu, with Linux 5.15.0-30-generic (Recovery Mode) ” and press Enter.

    oot-menu-recovery-mode
  • A recovery menu with several options will be displayed. Highlight “root – Drop to root shell prompt” and press Enter.

    2 - recovery menu

  • You will be asked to enter the root password. If you don’t have a root password, enter your user password.
  • When you are in rescue mode, the root file system is mounted in read-only mode to prevent accidental modifications that can cause damage. However, if you need to perform troubleshooting tasks. Use the following command when you want to mount the root filesystem in read/write mode:
mount -n -o remount,rw /
  • Type “exit” command to return to the recovery menu. Select the “resume – Resume normal boot” option to boot into the normal mode.

    3 - exit the recovery menu


Method 2: Holding the ‘ESC’ key during the boot process to display the GRUB bootloader menu and editing boot parameters.

  • Start your Linux system. Press the ESC key right immediately the BIOS logo disappears to see a GRUB menu.
  • Select the “Ubuntu” option in the GRUB bootloader menu and press “e” to edit.

    4 - selection in the boot menu
  • Find the line that begins with “Linux” and append the string “systemd.unit=rescue.target” at the end of it.

    5 - system rescue target
  • After you add the string, press Ctrl + X to boot into rescue mode.
  • You are now in rescue mode as root user. Press the ‘Enter’ key to enter maintenance mode.

    6 - emergency mode
  • If you need to troubleshoot in single user mode. Mount the root file system in read/write mode.
mount -n -o remount,rw /
  • When you are done with your troubleshooting tasks. Use the ‘exit’ command to boot to normal mode.

Troubleshooting in rescue mode.

Rescue mode, also known as single-user mode provides users with a command line interface that allows you to perform numerous troubleshooting tasks, such as running file system checks, recovering lost files, diagnosing network issues, changing passwords, and  and so on. Here are some common tasks you can perform in single-user mode:

  • Check the filesystem for errors with the following command:
fsck /dev/sda1
  • Recover lost files using the following command:
photorec /dev/sda1
  • Diagnose network issues with the following command:
ifconfig -a

Booting from Emergency Mode

In certain situations, it may not be possible to boot your system into rescue mode due to filesystem corruption. In such cases, you can boot Ubuntu into emergency mode, providing a minimal bootable environment and allowing you to repair your system. Follow these steps to boot into emergency mode:

  • Reboot your system and wait for the GRUB menu to appear. If the menu does not appear automatically, press the ‘ESC’ key right after the BIOS logo disappears.
  • Use the arrow keys to navigate your desired boot entry and press the “e” key to edit the boot parameters.

    4 - selection in the boot menu
  • Move down to the line that begins with “Linux” and contains “ro quiet splash $vt_handoff” and add the following string at the end of the line:

    1 - system unit
systemd.unit=emergency.target
  • Press Ctrl + X or F10 to boot with the modified parameters and start off emergency mode.
  • In emergency mode, the root filesystem is automatically mounted in read-only mode to prevent data corruption / lose. The read-only state makes sure that the integrity of the filesystem is intact while you perform crucial troubleshooting tasks.
  • Once you are done with the necessary troubleshooting tasks, you can exit emergency mode and resume normal system operations. To exit emergency mode, reboot the system with the “reboot” command.

This will restart your system and start a normal boot process, ensuring all normal services resume and the system operates as usual.

Troubleshooting Tasks in Rescue/Emergency Mode

Whenever your Ubuntu 20.04 LTS system comes across critical issues, booting into rescue or emergency mode can provide useful tools to diagnose and fix various system issues. We will explore various troubleshooting tasks that can be performed in rescue/emergency mode, providing you with the knowledge to address system issues effectively.

  1. Recovery Lost Files: In case files are accidentally deleted or get corrupted, you can attempt to recover such files using tools like ‘photorec’ to recover lost files from local filesystems.
  2. Resetting Forgotten Password: If you forget your password, you can reset it using the ‘passwd’ command.
  1. Fixing File System Error: In single-user mode and emergency mode, you can use commands like ‘fsck’ to check and repair file system errors.
  2. Repair Boot Loader: If the boot loader gets corrupted, you can reinstall it using ‘grub-install’ command.
  3. Inspect System Logs: Identify the root cause of system issues with tools like ‘journalctl’. You can check system logs for errors and warnings with this tool in rescue and emergency modes.    

Conclusion

In conclusion, acquiring the skill of booting into rescue and emergency modes in Ubuntu 20.04 LTS is a valuable asset for any Linux user. These modes equip you with essential tools and a command-line interface to diagnose and repair various system issues, such as forgotten passwords, file system errors, and troubleshooting network issues. 

By understanding the difference between rescue/emergency modes and trying out the troubleshooting tasks available, you can ensure that the stability and reliability of your system remain intact. 

We encourage you to use a virtual box to get familiar with the booting process into rescue mode and emergency mode and the associated troubleshooting tasks. It will undoubtedly improve your ability to maintain a healthy and efficient system.   

Silas Akagwu
Silas Akagwu
Articles: 2