25.8. Using rescue mode
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.
The installation program’s rescue mode is different from rescue mode (an equivalent to single-user mode) and emergency mode, which are provided as parts of the systemd system and service manager.
To boot into rescue mode, you must be able to boot the system using one of the Red Hat Enterprise Linux boot media, such as a minimal boot disc or USB drive, or a full installation DVD.
Advanced storage, such as iSCSI or zFCP devices, must be configured either using dracut boot options such as rd.zfcp= or root=iscsi: options, or in the CMS configuration file on 64-bit IBM Z. It is not possible to configure these storage devices interactively after booting into rescue mode. For information about dracut boot options, see the dracut.cmdline(7) man page on your system.
25.8.1. Booting into rescue mode リンクのコピーリンクがクリップボードにコピーされました!
Boot your RHEL system into rescue mode to troubleshoot and repair system issues when the normal boot process fails. Rescue mode provides a minimal environment to diagnose problems, recover data, and fix configuration issues that prevent normal system operation.
Procedure
- 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.
-
From the boot menu, either select Troubleshooting > Rescue a Red Hat Enterprise Linux system option, or append the
inst.rescueoption 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. Optional: If your system requires a third-party driver provided on a driver disc to boot, append the
inst.dd=driver_nameto the boot command line:inst.rescue inst.dd=driver_nameOptional: If a driver that is part of the Red Hat Enterprise Linux distribution prevents the system from booting, append the
modprobe.blacklist=option to the boot command line:inst.rescue modprobe.blacklist=driver_namePress Enter (BIOS-based systems) or Ctrl+X (UEFI-based systems) to boot the modified option. Wait until the following message is displayed:
The rescue environment will now attempt to find your Linux installation and mount it under the directory: /mnt/sysroot/. You can then make any changes required to your system. Choose 1 to proceed with this step. You can choose to mount your file systems read-only instead of read-write by choosing 2. If for some reason this process does not work choose 3 to skip directly to a shell. 1) Continue 2) Read-only mount 3) Skip to shell 4) Quit (Reboot)If you select 1, the installation program attempts to mount your file system under the directory
/mnt/sysroot/. You are notified if it fails to mount a partition. If you select 2, it attempts to mount your file system under the directory/mnt/sysroot/, but in read-only mode. If you select 3, your file system is not mounted.For the system root, the installer supports two mount points
/mnt/sysimageand/mnt/sysroot. The/mnt/sysrootpath is used to mount/of the target system. Usually, the physical root and the system root are the same, so/mnt/sysrootis attached to the same file system as/mnt/sysimage. The only exceptions are rpm-ostree systems, where the system root changes based on the deployment. Then,/mnt/sysrootis attached to a subdirectory of/mnt/sysimage. Use/mnt/sysrootfor chroot.Select 1 to continue. Once your system is in rescue mode, a prompt appears on VC (virtual console) 1 and VC 2. Use the
Ctrl+Alt+F1key combination to access VC 1 andCtrl+Alt+F2to access VC 2:sh-4.2#Even if your file system is mounted, the default root partition while in rescue mode is a temporary root partition, not the root partition of the file system used during normal user mode (
multi-user.targetorgraphical.target). If you selected to mount your file system and it mounted successfully, you can change the root partition of the rescue mode environment to the root partition of your file system by executing the following command:sh-4.2# chroot /mnt/sysrootThis is useful if you need to run commands, such as
rpm, that require your root partition to be mounted as/. To exit the chroot environment, type exit to return to the prompt.If you selected 3, you can still try to mount a partition or LVM2 logical volume manually inside rescue mode by creating a directory, such as
/directory/, and typing the following command:sh-4.2# mount -t xfs /dev/mapper/VolGroup00-LogVol02 /directoryIn the above command,
/directory/is the directory that you created and/dev/mapper/VolGroup00-LogVol02is the LVM2 logical volume you want to mount. If the partition is a different type than XFS, replace the xfs string with the correct type (such as ext4).If you do not know the names of all physical partitions, use the following command to list them:
sh-4.2# fdisk -lIf you do not know the names of all LVM2 physical volumes, volume groups, or logical volumes, use the
pvdisplay,vgdisplayorlvdisplaycommands.
25.8.2. Using an SOS report in rescue mode リンクのコピーリンクがクリップボードにコピーされました!
The sos report command-line utility collects configuration and diagnostic information, such as the kernel version, loaded modules, and system and service configuration files from the system. The utility output is stored in a tar archive in the /var/tmp/ directory. The sos report utility is useful for analyzing system errors and troubleshooting. You can capture an sos report output in rescue mode.
Prerequisites
- You have booted into rescue mode.
-
You have mounted the installed system
/ (root)partition in read-write mode. - You have contacted Red Hat Support about your case and received a case number.
Procedure
Change the root directory to the
/mnt/sysroot/directory:sh-4.2# chroot /mnt/sysroot/Execute
sos reportto generate an archive with system configuration and diagnostic information:sh-4.2# sos reportsos reportprompts you to enter your name and the case number you received from Red Hat Support. Use only letters and numbers because adding any of the following characters or spaces could render the report unusable:# % & { } \ < > > * ? / $ ~ ' " : @ + ` | =Optional: If you want to transfer the generated archive to a new location by using the network, it is necessary to have a network interface configured. In this scenario, use the dynamic IP addressing as no other steps are required. However, when using static addressing, enter the following command to assign an IP address (for example 10.13.153.64/23) to a network interface, for example dev eth0:
bash-4.2# ip addr add 10.13.153.64/23 dev eth0Exit the chroot environment:
sh-4.2# exitStore the generated archive in a new location, from where it can be easily accessible:
sh-4.2# cp /mnt/sysroot/var/tmp/sos report new_locationFor transferring the archive through the network, use the
scputility:sh-4.2# scp /mnt/sysroot/var/tmp/sos report username@hostname:sos report
25.8.3. Reinstalling the GRUB2 boot loader リンクのコピーリンクがクリップボードにコピーされました!
In some scenarios, the GRUB2 boot loader is mistakenly deleted, corrupted, or replaced by other operating systems. You can reinstall GRUB2 on the master boot record (MBR) on AMD64 and Intel 64 systems with BIOS.
Prerequisites
- You have booted into rescue mode.
-
You have mounted the installed system
/ (root)partition in read-write mode. -
You have mounted the
/bootmount point in read-write mode.
Procedure
Change the root partition:
sh-4.2# chroot /mnt/sysroot/Reinstall the GRUB2 boot loader, where the
install_deviceblock device was installed:sh-4.2# /sbin/grub2-install install_device重要Running the
grub2-installcommand could lead to the machine being unbootable if all the following conditions apply:- The system is an AMD64 or Intel 64 with Extensible Firmware Interface (EFI).
- Secure Boot is enabled.
After you run the
grub2-installcommand, you cannot boot the AMD64 or Intel 64 systems that have Extensible Firmware Interface (EFI) and Secure Boot enabled. This issue occurs because thegrub2-installcommand installs an unsigned GRUB2 image that boots directly instead of using the shim application. When the system boots, the shim application validates the image signature, which when not found fails to boot the system.- Reboot the system.
25.8.4. Using dnf to add or remove a driver リンクのコピーリンクがクリップボードにコピーされました!
Missing or malfunctioning drivers cause problems when booting the system. Rescue mode provides an environment in which you can add or remove a driver even when the system fails to boot. Wherever possible, use the dnf package manager to remove malfunctioning drivers or to add updated or missing drivers.
When you install a driver from a driver disc, the driver disc updates all initramfs images on the system to use this driver. If a problem with a driver prevents a system from booting, you cannot rely on booting the system from another initramfs image.
Prerequisites
- You have booted into rescue mode.
- You have mounted the installed system in read-write mode.
Procedure
To add a new driver using
dnf:-
Make the RPM package that contains the driver available. For example, mount a CD or USB flash drive and copy the RPM package to a location of your choice under
/mnt/sysroot/, for example:/mnt/sysroot/root/drivers/. Change the root directory to
/mnt/sysroot/:sh-4.2# chroot /mnt/sysroot/Use the
dnf installcommand to install the driver package. For example, run the following command to install thexorg-x11-drv-wacomdriver package from/root/drivers/:sh-4.2# dnf install /root/drivers/xorg-x11-drv-wacom-0.23.0-6.el7.x86_64.rpm注記The
/root/drivers/directory in this chroot environment is the/mnt/sysroot/root/drivers/directory in the original rescue environment.Exit the chroot environment:
sh-4.2# exit
-
Make the RPM package that contains the driver available. For example, mount a CD or USB flash drive and copy the RPM package to a location of your choice under
To remove a driver by using
dnf:Change the root directory to the
/mnt/sysroot/directory:sh-4.2# chroot /mnt/sysroot/Use the
dnf removecommand to remove the driver package. For example, to remove thexorg-x11-drv-wacomdriver package, run:sh-4.2# dnf remove xorg-x11-drv-wacomExit the chroot environment:
sh-4.2# exitIf you cannot remove a malfunctioning driver for some reason, you can instead blocklist the driver so that it does not load at boot time.
- When you have finished removing drivers, reboot the system.