Chapter 12. Reinstalling GRUB


You can reinstall the GRUB boot loader to fix certain problems, usually caused by an incorrect installation of GRUB, missing files, or a broken system. You can resolve these issues by restoring the missing files and updating the boot information.

Reasons to reinstall GRUB:

  • Upgrading the GRUB boot loader packages.
  • Adding the boot information to another drive.
  • The user requires the GRUB boot loader to control installed operating systems. However, some operating systems are installed with their own boot loaders and reinstalling GRUB returns control to the desired operating system.
Note

GRUB restores files only if they are not corrupted.

12.1. Reinstalling GRUB on BIOS-based machines

You can reinstall the GRUB boot loader on your BIOS-based system. Always reinstall GRUB after updating the GRUB packages.

Important

This overwrites the existing GRUB to install the new GRUB. Ensure that the system does not cause data corruption or boot crash during the installation.

Procedure

  1. Reinstall GRUB on the device where it is installed. For example, if sda is your device:

    # grub2-install /dev/sda
  2. Reboot your system for the changes to take effect:

    # reboot

Additional resources

  • grub-install(1) man page on your system

12.2. Reinstalling GRUB on UEFI-based machines

You can reinstall the GRUB boot loader on your UEFI-based system.

Important

Ensure that the system does not cause data corruption or boot crash during the installation.

Procedure

  1. Reinstall the grub2-efi and shim boot loader files:

    # yum reinstall grub2-efi shim
  2. Reboot your system for the changes to take effect:

    # reboot

12.3. Reinstalling GRUB on IBM Power machines

You can reinstall the GRUB boot loader on the Power PC Reference Platform (PReP) boot partition of your IBM Power system. Always reinstall GRUB after updating the GRUB packages.

Important

This overwrites the existing GRUB to install the new GRUB. Ensure that the system does not cause data corruption or boot crash during the installation.

Procedure

  1. Determine the disk partition that stores GRUB:

    # bootlist -m normal -o
    sda1
  2. Reinstall GRUB on the disk partition:

    # grub2-install partition

    Replace partition with the GRUB partition that you found in the previous step, such as /dev/sda1.

  3. Reboot your system for the changes to take effect:

    # reboot

Additional resources

  • grub-install(1) man page on your system

12.4. Resetting GRUB

Resetting GRUB completely removes all GRUB configuration files and system settings and reinstalls the bootloader. You can reset all the configuration settings to their default values, and thus fix failures caused by corrupted files and incorrect configuration.

Important

The following procedure will remove all the customization the user has made.

Procedure

  1. Remove the configuration files.

    # rm /etc/grub.d/*
    # rm /etc/sysconfig/grub
  2. Reinstall packages.

    • On BIOS-based machines, enter:

      # yum reinstall grub2-tools
    • On UEFI-based machines, enter:

      # yum reinstall grub2-efi shim grub2-tools
  3. Rebuild the grub.cfg file for the changes to take effect.

    • On BIOS-based machines, enter:

      # grub2-mkconfig -o /boot/grub2/grub.cfg
    • On UEFI-based machines, enter:

      # grub2-mkconfig -o /boot/grub2/grub.cfg
  4. Follow Reinstalling GRUB procedure to restore GRUB on the /boot/ partition.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.