As the name implies, rescue mode is there to rescue you from something. In normal operation, your Red Hat Linux system uses files located on your system's hard drive to do everything -- run programs, store your files, and more.
However, there may be times when you are unable to get Linux running completely enough to access its files on your system's hard drive. By using rescue mode, it's possible to access the files stored on your system's hard drive.
Normally, you'll need to get into rescue mode for one of two reasons:
There are different types of rescue/emergency modes:
rescue
, emergency
, rd.break
emergency.target
, rescue.target
inst.rescue
At the GRUB boot menu hit 'e'
Look for the line starting with 'linux' and at the end of the line add the kernel parameter for the desired mode
Hit 'Ctrl+x' to continue
Emergency mode provides the most minimal environment possible and allows you to repair your system even in situations when the system is unable to enter rescue mode. In emergency mode, the system mounts the root file system only for reading, does not attempt to mount any other local file systems, does not activate network interfaces, and only starts a few essential services.
Kernel paramenters:
emergency
systemd.unit=emergency.target
Description:
Equivalent to the old single user mode, where some services are started and every disk is mounted.
Rescue mode provides a convenient single-user environment and allows you to repair your system in situations when it is unable to complete a regular booting process. In rescue mode, the system attempts to mount all local file systems and start some important system services, but it does not activate network interfaces or allow more users to be logged into the system at the same time.
Kernel paramenters:
rescue
systemd.unit=rescue.target
Description:
Breaks to an interactive shell while in the 'initrd' allowing interaction before the system disk is mounted. The main '/' is available under '/sysroot'. Useful if you forgot root's password.
Kernel paramenters:
rd.break
Commands:
The instructions here uses rd.break
as kernel parameter on GRUB menu, load_policy
and restorecon
.
a. At boot, hit e
to edit the boot kernel parameters
b. Add rd.break
at the end of the line that starts with linux
c. Press 'Ctrl + x' to start
d. Mount sysroot
switch_root:/# mount -o rw,remount /sysroot
e. Chroot into sysroot
#switch_root:/# chroot /sysroot
f. Change the password for root
sh-4.4# passwd
g. Load SELinux
sh-4.4# load_policy -i
h. Fix SELinux context for /etc/shadow
sh-4.4# restorecon -v /etc/shadow
i. Exit chroot
sh-4.4# exit
j. Remount as RO
#switch_root:/# mount -o ro,remount /sysroot
k. Reboot
đź“Ś TIP: For more methods on resetting the root password, see RHCSA v8: Boot Targets, Systemd Targets and root Password Reset
đź“ť NOTE: Booting from the Anaconda rescue mode is most likelly not needed for the exam.
The installation program’s rescue mode is a minimal Linux environment that can be booted from the Red Hat Enterprise Linux DVD or other boot media. It contains command-line utilities for repairing a wide variety of issues. Rescue mode can be accessed from the Troubleshooting menu of the boot menu. In this mode, you can mount file systems as read-only, blacklist or add a driver provided on a driver disc, install or upgrade system packages, or manage partitions.
a. Boot the system from either minimal boot media, or a full installation DVD or USB drive, and wait for the boot menu to be displayed.
b. From the boot menu, either select Troubleshooting > Rescue a Red Hat Enterprise Linux system option, or append the inst.rescue option to the boot command line. To enter the boot command line, press the Tab key on BIOS-based systems or the e key on UEFI-based systems.