Restore the /boot directory after corruption or missing files

  • Enable the network so yum can function.
  • Mount /boot from your disk.
#mount /dev/sda1 /boot
  • Make a directory grub2 on /boot as follows.
#mkdir /boot/grub2
  • Copy the modules as or copy the entire things from an identical system as fonts locale directive.
#cp -r /usr/lib/grub/i386-pc /boot/grub2/i386-pc
  • Reinstall the kernel packages
# yum remove kernel-<release>
# yum install kernel-<release>

It is anticipated to have grubby fatal error: unable to find a suitable template, which can be ignored at this time because /boot does not yet have /boot/grub2/grub.cfg.

  • Install the grub2 package as follows.
#yum reinstall $(rpm -qa | grep grub)
  • Recreate the grub configuration as follows.
#grub2-mkconfig -o /boot/grub2/grub.cfg
  • Check if /etc/grub2.cfg has a symbolic link to /boot/grub2/grub.cfg
  • Finally, reinstall the grub on new created partition as follows.
#grub2-install <disk>
Ex:
#grub2-install /dev/sda

This should be sufficient to create the /boot directory and boot the system, but if you have a backup of /boot, you should restore it from the backup.

Leave a Reply