How to Boot Ubuntu 18.04 / Debian 9 Server in Rescue / Emergency Mode

Booting a Linux Server into a single user mode or rescue mode is one of the important troubleshooting that a Linux admin usually follow while recovering the server from critical conditions. In Ubuntu 18.04 and Debian 9, single user mode is known as a rescue mode.

Apart from the rescue mode, Linux servers can be booted in emergency mode, the main difference between them is that, emergency mode loads a minimal environment with read only root file system file system, also it does not enable any network or other services. But rescue mode try to mount all the local file systems & try to start some important services including network.

In this article we will discuss how we can boot our Ubuntu 18.04 LTS / Debian 9 Server in rescue mode and emergency mode.

Booting Ubuntu 18.04 LTS Server in Single User / Rescue Mode:

Reboot your server and go to boot loader (Grub) screen and Select “Ubuntu“, bootloader screen would look like below,

Bootloader-Screen-Ubuntu18-04-Server

Press “e” and then go the end of line which starts with word “linux” and append “systemd.unit=rescue.target“. Remove the word “$vt_handoff ” if it exists.

rescue-target-ubuntu18-04

Now Press Ctrl-x or F10 to boot,

rescue-mode-ubuntu18-04

Now press enter and then you will get the shell where all file systems will be mounted in read-write mode and do the troubleshooting. Once you are done with troubleshooting, you can reboot your server using “reboot” command.

Booting Ubuntu 18.04 LTS Server in emergency mode

Reboot the server and go the boot loader screen and select “Ubuntu” and then press “e” and go to the end of line which starts with word linux, and append “systemd.unit=emergency.target

Emergecny-target-ubuntu18-04-server

Now Press Ctlr-x or F10 to boot in emergency mode, you will get a shell and do the troubleshooting from there. As we had already discussed that in emergency mode, file systems will be mounted in read-only mode and also there will be no networking in this mode,

Emergency-prompt-debian9

Use below command to mount the root file system in read-write mode,

# mount -o remount,rw /

Similarly, you can remount rest of file systems in read-write mode .

Booting Debian 9 into Rescue & Emergency Mode

Reboot your Debian 9.x server and go to grub screen and select “Debian GNU/Linux

Debian9-Grub-Screen

Press “e” and go to end of line which starts with word  linux and append “systemd.unit=rescue.target”  to boot the system in rescue mode and to boot in emergency mode then append “systemd.unit=emergency.target

Rescue mode :

Rescue-mode-Debian9

Now press Ctrl-x or F10 to boot in rescue mode

Rescue-Mode-Shell-Debian9

Press Enter to get the shell and from there you can start troubleshooting.

 Emergency Mode:

Emergency-target-grub-debian9

Now press ctrl-x or F10 to boot your system in emergency mode

Emergency-prompt-debian9

Press enter to get the shell and use “mount -o remount,rw /” command to mount the root file system in read-write mode.

Note: In case root password is already set in Ubuntu 18.04 and Debian 9 Server then you must enter root password to get shell in rescue and emergency mode

That’s all from this article, please do share your feedback and comments in case you like this article.

Also Read : How to Use TimeShift to Backup and Restore Ubuntu Linux

1 Response

  1. nb says:

    Hi

    In the first section: Reboot your server and go to boot loader (Grub) screen

    How do we get to this GRUB screen, if the system always boots to the login screen (even with or without pressing SHIFT key)?

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest