25.10. Terminal Menu Editing During Boot
25.10.1. Booting to Rescue Mode
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
linuxline on 64-Bit IBM Power Series, thelinux16line on x86-64 BIOS-based systems, or thelinuxefiline 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, andsingle, can be passed to the kernel as well. - Press Ctrl+x to boot the system with the parameter.
25.10.2. Booting to Emergency Mode
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
linuxline on 64-Bit IBM Power Series, thelinux16line on x86-64 BIOS-based systems, or thelinuxefiline 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,emergencyand-b, can be passed to the kernel as well. - Press Ctrl+x to boot the system with the parameter.
25.10.3. Booting to the Debug Shell
systemd debug shell provides a shell very early in the startup process that can be used to diagnose systemd related boot-up problems. Once in the debug shell, systemctl commands such as systemctl list-jobs, and systemctl list-units can be used to look for the cause of boot problems. In addition, the debug option can be added to the kernel command line to increase the number of log messages. For systemd, the kernel command-line option debug is now a shortcut for systemd.log_level=debug.
Procedure 25.4. Adding the Debug Shell Command
- On the GRUB 2 boot screen, move the cursor to the menu entry you want to edit and press the e key for edit.
- Add the following parameter at the end of the
linuxline on 64-Bit IBM Power Series, thelinux16line on x86-64 BIOS-based systems, or thelinuxefiline on UEFI systems:systemd.debug-shell
Optionally add thedebugoption.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. - Press Ctrl+x to boot the system with the parameter.
systemctl enable debug-shell command. Alternatively, the grubby tool can be used to make persistent changes to the kernel command line in the GRUB 2 menu. See Section 25.4, “Making Persistent Changes to a GRUB 2 Menu Using the grubby Tool” for more information on using grubby.
Warning
Procedure 25.5. Connecting to the Debug Shell
systemd-debug-generator will configure the debug shell on TTY9.
- Press Ctrl+Alt+F9 to connect to the debug shell. If working with a virtual machine, sending this key combination requires support from the virtualization application. For example, if using Virtual Machine Manager, select → from the menu.
- The debug shell does not require authentication, therefore a prompt similar to the following should be seen on TTY9:
[root@localhost /]# - If required, to verify you are in the debug shell, enter a command as follows:
/]#
systemctl status $$● debug-shell.service - Early root shell on /dev/tty9 FOR DEBUGGING ONLY Loaded: loaded (/usr/lib/systemd/system/debug-shell.service; disabled; vendor preset: disabled) Active: active (running) since Wed 2015-08-05 11:01:48 EDT; 2min ago Docs: man:sushell(8) Main PID: 450 (bash) CGroup: /system.slice/debug-shell.service ├─ 450 /bin/bash └─1791 systemctl status 450 - To return to the default shell, if the boot succeeded, press Ctrl+Alt+F1.
systemd units can be masked by adding systemd.mask=unit_name one or more times on the kernel command line. To start additional processes during the boot process, add systemd.wants=unit_name to the kernel command line. The systemd-debug-generator(8) manual page describes these options.
25.10.4. Changing and Resetting the Root Password
root password is a mandatory part of the Red Hat Enterprise Linux 7 installation. If you forget or lose the root password it is possible to reset it, however users who are members of the wheel group can change the root password as follows:
~]$ sudo passwd root
root password is now required to operate in single-user mode as well as in emergency mode.
root password are shown here:
- Procedure 25.6, “Resetting the Root Password Using an Installation Disk” takes you to a shell prompt, without having to edit the GRUB 2 menu. It is the shorter of the two procedures and it is also the recommended method. You can use a boot disk or a normal Red Hat Enterprise Linux 7 installation disk.
- Procedure 25.7, “Resetting the Root Password Using rd.break” makes use of
rd.breakto interrupt the boot process before control is passed frominitramfstosystemd. The disadvantage of this method is that it requires more steps, includes having to edit the GRUB 2 menu, and involves choosing between a possibly time consuming SELinux file relabel or changing the SELinux enforcing mode and then restoring the SELinux security context for/etc/shadow/when the boot completes.
Procedure 25.6. Resetting the Root Password Using an Installation Disk
- Start the system and when BIOS information is displayed, select the option for a boot menu and select to boot from the installation disk.
- Choose .
- Choose .
- Choose which is the default option. At this point you will be promoted for a passphrase if an encrypted file system is found.
- Press OK to acknowledge the information displayed until the shell prompt appears.
- Change the file system
rootas follows:sh-4.2#
chroot /mnt/sysimage - Enter the
passwdcommand and follow the instructions displayed on the command line to change therootpassword. - Remove the
autorelablefile to prevent a time consuming SELinux relabel of the disk:sh-4.2#
rm -f /.autorelabel - Enter the
exitcommand to exit thechrootenvironment. - Enter the
exitcommand again to resume the initialization and finish the system boot.
Procedure 25.7. Resetting the Root Password Using rd.break
- Start the system and, on the GRUB 2 boot screen, press the e key for edit.
- Remove the
rhgbandquietparameters from the end, or near the end, of thelinux16line, orlinuxefion 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.Important
Therhgbandquietparameters must be removed in order to enable system messages. - Add the following parameters at the end of the
linuxline on 64-Bit IBM Power Series, thelinux16line on x86-64 BIOS-based systems, or thelinuxefiline on UEFI systems:rd.break enforcing=0
Adding theenforcing=0option enables omitting the time consuming SELinux relabeling process.Theinitramfswill stop before passing control to the Linux kernel, enabling you to work with therootfile system.Note that theinitramfsprompt will appear on the last console specified on the Linux line. - Press Ctrl+x to boot the system with the changed parameters.With an encrypted file system, a password is required at this point. However the password prompt might not appear as it is obscured by logging messages. You can press the Backspace key to see the prompt. Release the key and enter the password for the encrypted file system, while ignoring the logging messages.The
initramfsswitch_rootprompt appears. - The file system is mounted read-only on
/sysroot/. You will not be allowed to change the password if the file system is not writable.Remount the file system as writable:switch_root:/#
mount -o remount,rw /sysroot - The file system is remounted with write enabled.Change the file system's
rootas follows:switch_root:/#
The prompt changes tochroot /sysrootsh-4.2#. - Enter the
passwdcommand and follow the instructions displayed on the command line to change therootpassword.Note that if the system is not writable, the passwd tool fails with the following error:Authentication token manipulation error
- Updating the password file results in a file with the incorrect SELinux security context. To relabel all files on next system boot, enter the following command:
sh-4.2#
Alternatively, to save the time it takes to relabel a large disk, you can omit this step provided you included thetouch /.autorelabelenforcing=0option in step 3. - Remount the file system as read only:
sh-4.2#
mount -o remount,ro / - Enter the
exitcommand to exit thechrootenvironment. - Enter the
exitcommand again to resume the initialization and finish the system boot.With an encrypted file system, a pass word or phrase is required at this point. However the password prompt might not appear as it is obscured by logging messages. You can press and hold the Backspace key to see the prompt. Release the key and enter the password for the encrypted file system, while ignoring the logging messages.Note
Note that the SELinux relabeling process can take a long time. A system reboot will occur automatically when the process is complete. - If you added the
enforcing=0option in step 3 and omitted thetouch /.autorelabelcommand in step 8, enter the following command to restore the/etc/shadowfile's SELinux security context:~]#
Enter the following commands to turn SELinux policy enforcement back on and verify that it is on:restorecon /etc/shadow~]#
setenforce 1~]#getenforceEnforcing

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.