25.8. Upgrading from GRUB Legacy to GRUB 2
GRUB 2does not happen automatically, but it should be done manually. Perform the GRUB upgrade for these reasons:
- In RHEL 7 and later versions,
GRUB Legacyis no longer maintained and does not receive updates.
GRUB Legacyis unable to boot on systems without the
GRUB 2has more features and is more reliable.
GRUB 2supports more hardware configurations, file systems, and drive layouts.
GRUB Legacy to
GRUB 2 after the in-place upgrade of the operating system
Procedure 25.2. Upgrading from GRUB Legacy to GRUB 2
- Ensure that the GRUB Legacy package has been uninstalled by the Red Hat Upgrade Tool:
yum remove grub
NoteUninstalling the grub2 package does not affect the installed GRUB Legacy bootloader.
- Make sure that the grub2 package has been installed. If grub2 is not on the system after the upgrade to RHEL 7, you can install it manually by running:
yum install grub2
Generating the GRUB 2 configuration files
GRUB 2configuration without removing the original
GRUB Legacyconfiguration. We will keep
GRUB Legacyconfiguration in case
GRUB 2does not work correctly.
- Install the
GRUB 2files to the
grub2-install --grub-setup=/bin/true /dev/sdXSubstitute /dev/sdX with the bootable device file.The
--grub-setup=/bin/trueoption ensures that the old
GRUB Legacyconfiguration is not deleted.
WarningNote the difference in the configuration file extensions:
Do not overwrite the old
GRUBconfiguration file by mistake in the next step.
- Generate the
grub2-mkconfig -o /boot/grub2/grub.cfg
NoteFor customizing the generated
GRUB 2configuration file, see Section 25.5, “Customizing the GRUB 2 Configuration File”. You should make changes in
/etc/default/grub, not directly in
/boot/grub2/grub.cfg. Otherwise, changes in
/boot/grub2/grub.cfgare lost every time the file is re-generated.
Testing GRUB 2 with GRUB Legacy bootloader still installed
GRUB 2without removing the
GRUB Legacyconfiguration. The
GRUB Legacyconfiguration needs to stay until
GRUB 2configuration is verified; otherwise the system might become unbootable. To safely test
GRUB 2configuration, we will start
- Add a new section into
/boot/grub/grub.conf.For systems with a separate
title GRUB 2 Test root (hd0,0) kernel /grub2/i386-pc/core.img bootSubstitute (hd0,0) with the
GRUB Legacybootable device designation.For systems without a separate
title GRUB 2 Test root (hd0,0) kernel /boot/grub2/i386-pc/core.img bootSubstitute (hd0,0) with the
GRUB Legacybootable device designation.
- Reboot the system.
- When presented with a
GRUB Legacymenu, select the
GRUB 2 Testentry.
- When presented with a
GRUB 2menu, select a kernel to boot.
- If the above did not work, restart, and do not choose the
GRUB 2 Testentry on next boot.
Replacing GRUB Legacy bootloader
GRUB Legacybootloader to
GRUB 2has been successfully finished. This is due to the fact that installation of packages across major releases is not supported. In case of RHEL 7, only
GRUB 2is supported, developed, and tested; unlike
GRUB Legacyfrom RHEL 6.