Red Hat Training

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

33.4. Resolving Problems in System Recovery Modes

This section provides several procedures that explain how to resolve some of the most common problems that needs to be addressed in some of the system recovery modes.
The following procedure shows how to reset a root password:

Procedure 33.4. Resetting a Root Password

  1. Boot to single-user mode as described in Procedure 33.2, “Booting into Single-User Mode”.
  2. Run the passwd command from the maintenance shell command line.
One of the most common causes for an unbootable system is overwriting of the Master Boot Record (MBR) that originally contained the GRUB boot loader. If the boot loader is overwritten, you cannot boot Red Hat Enterprise Linux unless you reconfigure the boot loader in rescue mode.
To reinstall GRUB on the MBR of your hard drive, proceed with the following procedure:

Procedure 33.5. Reinstalling the GRUB Boot Loader

  1. Boot to rescue mode as described in Procedure 33.1, “Booting into Rescue Mode”. Ensure that you mount the system's root partition in read-write mode.
  2. Execute the following command to change the root partition:
    sh-3.00b# chroot /mnt/sysimage
  3. Run the following command to reinstall the GRUB boot loader:
    sh-3.00b# /sbin/grub-install boot_part
    where boot_part is your boot partition (typically, /dev/sda).
  4. Review the /boot/grub/grub.conf file, as additional entries may be needed for GRUB to control additional operating systems.
  5. Reboot the system.
Another common problem that would render your system unbootable is a change of your root partition number. This can usually happen when resizing a partition or creating a new partition after installation. If the partition number of your root partition changes, the GRUB boot loader might not be able to find it to mount the partition. To fix this problem,boot into rescue mode and modify the /boot/grub/grub.conf file.
A malfunctioning or missing driver can prevent a system from booting normally. You can use the RPM package manager to remove malfunctioning drivers or to add updated or missing drivers in rescue mode. 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.

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.
To remove a malfunctioning driver that prevents the system from booting, follow this procedure:

Procedure 33.6. Remove a Driver in Rescue Mode

  1. Boot to rescue mode as described in Procedure 33.1, “Booting into Rescue Mode”. Ensure that you mount the system's root partition in read-write mode.
  2. Change the root directory to /mnt/sysimage/:
    sh-3.00b# chroot /mnt/sysimage
  3. Run the following command to remove the driver package:
    sh-3.00b# rpm -e driver_name
  4. Exit the chroot environment:
    sh-3.00b# exit
  5. Reboot the system.
To install a missing driver that prevents the system from booting, follow this procedure:

Procedure 33.7. Installing a Driver in Rescue Mode

  1. Boot to rescue mode as described in Procedure 33.1, “Booting into Rescue Mode”. Ensure that you mount the system's root partition in read-write mode.
  2. Mount a media with an RPM package that contains the driver and copy the package to a location of your choice under the /mnt/sysimage/ directory, for example: /mnt/sysimage/root/drivers/.
  3. Change the root directory to /mnt/sysimage/:
    sh-3.00b# chroot /mnt/sysimage
  4. Run the following command to install the driver package:
    sh-3.00b# rpm -ihv /root/drivers/package_name
    Note that /root/drivers/ in this chroot environment is /mnt/sysimage/root/drivers/ in the original rescue environment.
  5. Exit the chroot environment:
    sh-3.00b# exit
  6. Reboot the system.
To blacklist a driver that prevents the system from booting and to ensure that this driver cannot be loaded after the root device is mounted, follow this procedure:

Procedure 33.8. Blacklisting a Driver in Rescue Mode

  1. Boot to rescue mode with the command linux rescue rdblacklist=driver_name, where driver_name is the driver that you need to blacklist. Follow the instructions in Procedure 33.1, “Booting into Rescue Mode” and ensure that you mount the system's root partition in read-write mode.
  2. Open the /boot/grub/grub.conf file in the vi editor:
    sh-3.00b#  vi /boot/grub/grub.conf
  3. Identify the default kernel used to boot the system. Each kernel is specified in the grub.conf file with a group of lines that begins title. The default kernel is specified by the default parameter near the start of the file. A value of 0 refers to the kernel described in the first group of lines, a value of 1 refers to the kernel described in the second group, and higher values refer to subsequent kernels in turn.
  4. Edit the kernel line of the group to include the option rdblacklist=driver_name, where driver_name is the driver that you need to blacklist. For example:
    kernel /vmlinuz-2.6.32-71.18-2.el6.i686 ro root=/dev/sda1 rhgb quiet rdblacklist=driver_name
  5. Save the file and exit the vi editor by typing:
    :wq
  6. Run the following command to create a new file /etc/modprobe.d/driver_name.conf that will ensure blacklisting of the driver after the root partition is mounted:
    echo "install driver_name" > /mnt/sysimage/etc/modprobe.d/driver_name.conf
  7. Reboot the system.