{{tag>centos grub}}
====== Reinstall grub2 ======
===== On Software RAID =====
==== Prepare chroot ====
<sxh bash>
mount /dev/md2 /mnt
mount /dev/md1 /mnt/boot
mount -t dev -o bind /dev /mnt/dev
mount -t proc -o bind /proc /mnt/proc
mount -t sys -o bind /sys /mnt/sys
chroot /mnt
</sxh>

=== Install grub2 ===
<sxh bash>
grub2-install /dev/sda
</sxh>

=== Check if Grub was written in MBR ===
<sxh bash>
dd bs=512 count=1 if=/dev/sda 2>/dev/null | strings|grep GRUB
</sxh>

=== Check Grub 2 for the kernel line ===
<sxh bash>
egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
</sxh>

=== Set new kernel as default boot entry ===
<sxh bash>
grub2-set-default 1
</sxh>

=== Check current boot entry ===
<sxh bash>
grub2-editenv list
</sxh>