How to Boot Ubuntu 18.04 / Debian 9 Server in Rescue (Single User mode) / 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,
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.
Now Press Ctrl-x or F10 to boot,
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”
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,
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”
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 :
Now press Ctrl-x or F10 to boot in rescue mode
Press Enter to get the shell and from there you can start troubleshooting.
Now press ctrl-x or F10 to boot your system in emergency mode
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.