Reinstalling grub2 manually under CentOS 7

Reinstalling grub2 manually under CentOS 7

In this tutorial we will see reinstalling grub2 manually under CentOS 7 server.

How to Reinstall the Deleted / Corrupted / Replaced GRUB2 Boot Loader on CentOS 7 / RHEL 7 / SL 7 / OL 7. The GRUB2 is the default boot loader for Enterprise Linux 7.  GRUB2 boot loader is the most important part of any Enterprise Linux. Most important thing it is used by millions. If the GRUB2 boot loader is Deleted / Corrupted / Replaced by any other OS then this guide provide you fix for this issues with ease. This tutorial shows the step by step methods that applies quickly and easily to fix this issue for your enterprise Linux.

How to Reinstall the GRUB2 Boot Loader on EL 7

Step-1 (Check the default location GRUB2 configuration files)

[root@linuxmasters ~]# rpm -qc grub2-tools

Sample Output

/etc/default/grub
/etc/grub.d/00_header
/etc/grub.d/10_linux
/etc/grub.d/20_linux_xen
/etc/grub.d/20_ppc_terminfo
/etc/grub.d/30_os-prober
/etc/grub.d/40_custom
/etc/grub.d/41_custom

Step-2 (Remove the Default GRUB2 configuration file)

[root@linuxmasters ~]# rm -rf /etc/default/grub

Step-3 (Remove the grub2-tools configuration files)

[root@linuxmasters ~]# rm -rf /etc/grub.d/*

Step-4 (Reinstall the GRUB2 using yum command)

[root@linuxmasters ~]# yum reinstall grub2-tools

Step-5 (Regenerate and save the GRUB2 configuration file)

[root@linuxmasters ~]# grub2-mkconfig -o /boot/grub2/grub.cfg

Sample Output

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-7e890c03ebb940a9a67163adaef14894
Found initrd image: /boot/initramfs-0-rescue-7e890c03ebb940a9a67163adaef14894.img
done

Final Words

That’s all finally you have fixed and reinstalled the damaged / corrupted GRUB2 boot loader using the above steps. If you have issues regarding this topic then you have to use the comment section below.

 
    1. balaji October 25, 2017
      • Mathan October 25, 2017
Enjoyed this video?
Reinstalling grub2 manually under CentOS 7
"No Thanks. Please Close This Box!"