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
- Boot to
single-user mode
as described in Procedure 33.2, “Booting into Single-User Mode”. - 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
- 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. - Execute the following command to change the root partition:
sh-3.00b#
chroot /mnt/sysimage
- 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
). - Review the
/boot/grub/grub.conf
file, as additional entries may be needed for GRUB to control additional operating systems. - 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
- 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. - Change the root directory to
/mnt/sysimage/
:sh-3.00b#
chroot /mnt/sysimage
- Run the following command to remove the driver package:
sh-3.00b#
rpm -e driver_name
- Exit the
chroot
environment:sh-3.00b#
exit
- 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
- 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. - 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/
. - Change the root directory to
/mnt/sysimage/
:sh-3.00b#
chroot /mnt/sysimage
- 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. - Exit the
chroot
environment:sh-3.00b#
exit
- 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
- Boot to
rescue mode
with the commandlinux 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. - Open the
/boot/grub/grub.conf
file in the vi editor:sh-3.00b#
vi /boot/grub/grub.conf
- Identify the default kernel used to boot the system. Each kernel is specified in the
grub.conf
file with a group of lines that beginstitle
. The default kernel is specified by thedefault
parameter near the start of the file. A value of0
refers to the kernel described in the first group of lines, a value of1
refers to the kernel described in the second group, and higher values refer to subsequent kernels in turn. - Edit the
kernel
line of the group to include the optionrdblacklist=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
- Save the file and exit the vi editor by typing:
:wq
- 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
- Reboot the system.