This article explains how to bootup RHEL/CentOS 7 and 8 system into emergency mode through systemd emergency target unit.
There are situations where you need to boot Red Hat 8/7 or CentOS 8/7 Linux system into emergency mode, if you are unable to complete the normal boot sequence.
What is Emergency Mode (Target)
You can boot the system with emergency mode to troubleshoot and repair your system when the system cannot enter rescue mode. This provides a very minimal environment for the user.
In emergency mode, the system mounts the root file system for read-only purposes and does not attempt to load any other local file systems. Also, it does not activate network interfaces and only starts some essential services.
Bootup RHEL/CentOS 8/7 into Emergency Mode (target)
Step-1: When the ‘GRUB 2’
menu appears, press the 'e'
key to interrupt the boot process.
Make a note: By default it selects the first kernel, which is the latest kernel used by the operating system, while the others are kept for backup purposes. If you have any problems, you can start the operating systems with other old kernels.
Step-2: Go to the line that contains the word ‘linux’
and press ‘Ctrl+e’ to jump to the end of the line then add 'systemd.unit=emergency.target'
and press 'Ctrl+x'
to boot the system with the changed parameters.
On RHEL 7 and CentOS 7 Linux systems the line starts with 'linux16'
instead of ‘linux’.
Step-3: When the ‘Emergency Mode’ appears, enter the root password to log into emergency mode.
Step-4: In emergency mode, the '/'
filesystem is mounted as 'read-only'
and you need to remount it as 'read-write'
for further troubleshooting.
mount -o remount,rw /
Step-5: Once you have fixed the system issue, type ‘reboot’ to boot the system in normal mode either ‘multiuser.target’ or ‘graphical.target’.
reboot
Over to You
In this guide, we have explained how to boot Red Hat (RHEL) 8/7 system in Emergency Mode. This same procedure works on other RHEL clones such as CentOS 8/7, Rocky Linux 8 and AlmaLinux 8.
If you have any questions or feedback, feel free to comment below.