Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

32.2. Anaconda Rescue Mode

The Anaconda installation program's rescue mode is a minimal Linux environment that can be booted from the Red Hat Enterprise Linux 7 DVD or other boot media. It contains command-line utilities for repairing a wide variety of issues. This rescue mode can be accessed from the Troubleshooting submenu of the boot menu. In this mode, you can mount file systems as read-only or even to not mount them at all, blacklist or add a driver provided on a driver disc, install or upgrade system packages, or manage partitions.

Note

Anaconda 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. For more information about these modes, see Red Hat Enterprise Linux 7 System Administrator's Guide.
To boot into Anaconda rescue mode, you must be able to boot the system using one Red Hat Enterprise Linux boot media, such as a minimal boot disc or USB drive, or a full installation DVD.
For detailed information about booting the system using media provided by Red Hat, see the appropriate chapters:

Important

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 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. For information about the CMS configuration file, see Chapter 21, Parameter and Configuration Files on IBM Z.

Procedure 32.1. Booting into Anaconda Rescue Mode

  1. Boot the system from either minimal boot media, or a full installation DVD or USB drive, and wait for the boot menu to appear.
  2. From the boot menu, either select the Rescue a Red Hat Enterprise Linux system option from the Troubleshooting submenu, 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 the UEFI-based systems.
  3. If your system requires a third-party driver provided on a driver disc to boot, append the inst.dd=driver_name to the boot command line:
    inst.rescue inst.dd=driver_name
    For more information on using a driver disc at boot time, see Section 6.3.3, “Manual Driver Update” for AMD64 and Intel 64 systems or Section 11.2.3, “Manual Driver Update” for IBM Power Systems servers.
  4. If a driver that is part of the Red Hat Enterprise Linux 7 distribution prevents the system from booting, append the modprobe.blacklist= option to the boot command line:
    inst.rescue modprobe.blacklist=driver_name
    For more information about blacklisting drivers, see Section 6.3.4, “Blacklisting a Driver”.
  5. When ready, press Enter (BIOS-based systems) or Ctrl+X (UEFI-based systems) to boot the modified option. Then wait until the following message is displayed:
    The rescue environment will now attempt to find your Linux installation and mount it under the /mnt/sysimage/ directory. You can then make any changes required to your system. If you want to proceed with this step choose 'Continue'. You can also choose to mount your file systems read-only instead of read-write by choosing 'Read-only'. If for some reason this process fails you can choose 'Skip' and this step will be skipped and you will go directly to a command line.
    
    If you select Continue, it attempts to mount your file system under the directory /mnt/sysimage/. If it fails to mount a partition, you will be notified. If you select Read-Only, it attempts to mount your file system under the directory /mnt/sysimage/, but in read-only mode. If you select Skip, your file system is not mounted. Choose Skip if you think your file system is corrupted.
  6. Once you have your system in rescue mode, a prompt appears on VC (virtual console) 1 and VC 2 (use the Ctrl+Alt+F1 key combination to access VC 1 and Ctrl+Alt+F2 to access VC 2):
    sh-4.2#
Even if your file system is mounted, the default root partition while in Anaconda rescue mode is a temporary root partition, not the root partition of the file system used during normal user mode (multi-user.target or graphical.target). If you selected to mount your file system and it mounted successfully, you can change the root partition of the Anaconda rescue mode environment to the root partition of your file system by executing the following command:
sh-4.2# chroot /mnt/sysimage
This 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 Skip, you can still try to mount a partition or LVM2 logical volume manually inside Anaconda rescue mode by creating a directory, such as /directory/, and typing the following command:
sh-4.2# mount -t xfs /dev/mapper/VolGroup00-LogVol02 /directory
In the above command, /directory/ is a directory that you have created and /dev/mapper/VolGroup00-LogVol02 is 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 -l
If you do not know the names of all LVM2 physical volumes, volume groups, or logical volumes, use the pvdisplay, vgdisplay or lvdisplay commands, respectively.
From the prompt, you can run many useful commands, such as:

32.2.1. Capturing an sosreport

The sosreport command-line utility collects configuration and diagnostic information, such as the running 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 sosreport utility is useful for analyzing the system errors and can make troubleshooting easier. The following procedure describes how to capture an sosreport output in Anaconda rescue mode:

Procedure 32.2. Using sosreport in Anaconda Rescue Mode

  1. Follow steps in Procedure 32.1, “Booting into Anaconda Rescue Mode” to boot into Anaconda rescue mode. Ensure that you mount the installed system / (root) partition in read-write mode.
  2. Change the root directory to the /mnt/sysimage/ directory:
    sh-4.2# chroot /mnt/sysimage/
  3. Execute sosreport to generate an archive with system configuration and diagnostic information:
    sh-4.2# sosreport

    Important

    When running, sosreport will prompt you to enter your name and case number that you get when you contact Red Hat Support service and open a new support case. Use only letters and numbers because adding any of the following characters or spaces could render the report unusable:
    # % & { } \ < > > * ? / $ ~ ' " : @ + ` | =
  4. Optional. If you want to transfer the generated archive to a new location using the network, it is necessary to have a network interface configured. In case you use the dynamic IP addressing, there are no other steps required. However, when using the 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 eth0
    See the Red Hat Enterprise Linux 7 Networking Guide for additional information about static addressing.
  5. Exit the chroot environment:
    sh-4.2# exit
  6. Store the generated archive in a new location, from where it can be easily accessible:
    sh-4.2# cp /mnt/sysimage/var/tmp/sosreport new_location
    For transferring the archive through the network, use the scp utility:
    sh-4.2# scp /mnt/sysimage/var/tmp/sosreport username@hostname:sosreport
See the references below for further information:

32.2.2. Reinstalling the Boot Loader

In some cases, the GRUB2 boot loader can mistakenly be deleted, corrupted, or replaced by other operating systems. The following steps detail the process on how GRUB is reinstalled on the master boot record:

Procedure 32.3. Reinstalling the GRUB2 Boot Loader

  1. Follow instructions in Procedure 32.1, “Booting into Anaconda Rescue Mode” to boot into Anaconda rescue mode. Ensure that you mount the installed system's / (root) partition in read-write mode.
  2. Change the root partition:
    sh-4.2# chroot /mnt/sysimage/
  3. Use the following command to reinstall the GRUB2 boot loader, where install_device is the boot device (typically, /dev/sda):
    sh-4.2# /sbin/grub2-install install_device
  4. Reboot the system.

32.2.3. Using RPM to Add, Remove, or Replace a Driver

Missing or malfunctioning drivers can cause problems when booting the system. Anaconda rescue mode provides an environment in which you can add, remove, or replace a driver even when the system fails to boot. Wherever possible, we recommend that you use the RPM package manager to remove malfunctioning drivers or to add updated or missing drivers.

Note

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.

Procedure 32.4. Using RPM to Remove a Driver

  1. Boot the system into Anaconda rescue mode. Follow the instructions in Procedure 32.1, “Booting into Anaconda Rescue Mode”. Ensure that you mount the installed system in read-write mode.
  2. Change the root directory to /mnt/sysimage/:
    sh-4.2# chroot /mnt/sysimage/
  3. Use the rpm -e command to remove the driver package. For example, to remove the xorg-x11-drv-wacom driver package, run:
    sh-4.2# rpm -e xorg-x11-drv-wacom
  4. Exit the chroot environment:
    sh-4.2# exit
If you cannot remove a malfunctioning driver for some reason, you can instead blacklist the driver so that it does not load at boot time. See Section 6.3.4, “Blacklisting a Driver” and Chapter 23, Boot Options for more information about blacklisting drivers.
Installing a driver is a similar process but the RPM package must be available on the system:

Procedure 32.5. Installing a Driver from an RPM package

  1. Boot the system into Anaconda rescue mode. Follow the instructions in Procedure 32.1, “Booting into Anaconda Rescue Mode”. Do not choose to mount the installed system as read only.
  2. 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/sysimage/, for example: /mnt/sysimage/root/drivers/
  3. Change the root directory to /mnt/sysimage/:
    sh-4.2# chroot /mnt/sysimage/
  4. Use the rpm -ivh command to install the driver package. For example, to install the xorg-x11-drv-wacom driver package from /root/drivers/, run:
    sh-4.2# rpm -­ivh /root/drivers/xorg-x11-drv-wacom-0.23.0-6.el7.x86_64.rpm

    Note

    The /root/drivers/ directory in this chroot environment is the /mnt/sysimage/root/drivers/ directory in the original rescue environment.
  5. Exit the chroot environment:
    sh-4.2# exit
When you have finished removing and installing drivers, reboot the system.