redhat7 boot to rescue mode
22.6.1. Booting to Rescue Mode
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. In Red Hat Enterprise Linux 7, rescue mode is equivalent to single user mode and requires the root password.
To enter rescue mode during boot, on the GRUB 2 boot screen, press the e key for edit.
Add the following parameter at the end of the linux16 line, or linuxefi on UEFI systems:
systemd.unit=rescue.target
Press Ctrl+a and Ctrl+e to jump to the start and end of the line, respectively. On some systems, Home and End might also work.
Note that equivalent parameters, 1, s, and single, can be passed to the kernel as well.
Press Ctrl+x to boot the system with the parameter.
22.6.2. Booting to Emergency Mode
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 few essential services. In Red Hat Enterprise Linux 7, emergency mode requires the root password.
To enter emergency mode, on the GRUB 2 boot screen, press the e key for edit.
Add the following parameter at the end of the linux16 line, or linuxefi on UEFI systems:
systemd.unit=emergency.target
Press Ctrl+a and Ctrl+e to jump to the start and end of the line, respectively. On some systems, Home and End might also work.
Note that equivalent parameters, emergency and -b, can be passed to the kernel as well.
Press Ctrl+x to boot the system with the parameter.
22.6.3. Recovering Root Password
Setting up the root password is a mandatory part of the Red Hat Enterprise Linux 7 installation. If you forget or lose your password, it is possible to reset it.
Note that in GRUB 2, resetting the password is no longer performed in single-user mode as it was in GRUB included in Red Hat Enterprise Linux 6. The root password is now required to operate in single-user mode as well as in emergency mode.
Procedure 22.1. Resetting the Root Password
Start the system and, on the GRUB 2 boot screen, press the e key for edit.
Add the following parameter at the end of the linux16 line, or linuxefi on UEFI systems:
Press Ctrl+a and Ctrl+e to jump to the start and end of the line, respectively. On some systems, Home and End might also work.
The Linux kernel will run the /bin/sh shell rather than the system init daemon. Therefore, some functions may be limited or missing.
The rhgb and quiet parameters must be disabled in order to enable system messages.
Press Ctrl+x to boot the system with the parameter.
The shell prompt appears.
The file system is mounted read-only. You will not be allowed to change the password if the file system is not writable.
To remount the file system as writable, run the mount -o remount, rw / command.
Run the passwd command and follow the instructions displayed on the command line to change the root password.
Note that if the system is not writable, the passwd tool fails with the following error:
Authentication token manipulation error
To make sure that SELinux context of the files that were modified is restored properly after boot, run
Run the exec /sbin/init command to resume the initialization and finish the system boot.
Running the exec command with another command specified replaces the shell and creates a new process; init in this case.
Alternatively, if you want to reboot the system, run the exec /sbin/reboot command instead.