How to boot into emergency or multi-user mode from GRUB2
Environment
- Red Hat Enterprise Linux 10
- Red Hat Enterprise Linux 9
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 7
Issue
- How to boot into the emergency target (formerly single user mode) or multi-user target (equivalent to runlevel 3 in RHEL6/RHEL5) in GRUB2?
Resolution
When the server is booting and reaches the grub menu example below.
Red Hat Enterprise Linux Server (3.10.0-327.36.1.el7.x86_64) 7.2 (Maipo)
Red Hat Enterprise Linux Server (3.10.0-327.28.2.el7.x86_64) 7.2 (Maipo)
Red Hat Enterprise Linux Server (3.10.0-327.22.2.el7.x86_64) 7.2 (Maipo)
Use the ^ and v keys to change the selection.
Press 'e' to edit the selected item, or 'c' for a command prompt.
Choose which kernel that needs to be edited, by using the arrow key to highlight the kernel version, then press the letter e key to edit the boot entry. The next screen should look similar to the below example of me selecting the 3.10.0-327.36.1.el7.x86_64 kernel for editing.
setparams 'Red Hat Enterprise Linux Server (3.10.0-327.36.1.el7.x86_64) 7.2 (M\
aipo)'
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' a9bc46b\
9-2760-4c0a-98d9-700de2285293
else
search --no-floppy --fs-uuid --set=root a9bc46b9-2760-4c0a-98d9-700d\v
e2285293
fi
linux16 /vmlinuz-3.10.0-327.36.1.el7.x86_64 root=/dev/mapper/rhel_unus\
ed-root ro console=tty0 crashkernel=128M rd.lvm.lv=rhel_unused/root rd.lvm.lv=\
rhel_unused/swap console=ttyS0,115200 LANG=en_US.UTF-8
initrd16 /initramfs-3.10.0-327.36.1.el7.x86_64.img
Press Ctrl-x to start, Ctrl-c for a command prompt or Escape to
discard edits and return to the menu. Pressing Tab lists
possible completions.
Once on this screen use the arrow keys to arrow down to the line starting with linux, for most systems it will be linux16, but it can also be just linux and linuxefi. Once the blinking cursor is on the linux16 line, press the End key, this will move the cursor to the end of the linux16 line. Then to boot into which ever target is desired, the below can be appended.
- For booting into the emergency target.
systemd.unit=emergency.target
- For booting into the multi-user target.
systemd.unit=multi-user.target
Once the above has been appended to the linux16 line it should look similar to the below example.
linux16 /vmlinuz-3.10.0-327.36.1.el7.x86_64 root=/dev/mapper/rhel_unus\
ed-root ro console=tty0 crashkernel=128M rd.lvm.lv=rhel_unused/root rd.lvm.lv=\
rhel_unused/swap console=ttyS0,115200 LANG=en_US.UTF-8 systemd.unit=emergency.target
Once the parameter has been appended, press the Ctrl key and the x key at the same time to boot with the specified parameter.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.