Hubba's Blog

Notes from a Linux/Unix Engineer

How to recover broken grub2 boot on SLES15

Posted on Wed, Nov 25, 2020 at 12:28 by Hubertus A. Haniel

I am currently having issues where the boot of one of my VM's gets corrupted and I frequently have to recover it - I sometimes miss out mounting one of the required mount points so I noted them here to jolt my memory mainly but they may be helpful for others......

These are the steps I currently follow to recover the boot sector:

  1. - Boot the system from the DVD or PXE into rescue mode
  2. Mount the existing root file system under /mnt which is on /dev/rootvg/rootlv using "mount /dev/rootvg/rootlv /mnt"
  3. mount -t proc none /mnt/proc
  4. mount -t sysfs sys /mnt/sys
  5. mount -o bind /dev /mnt/dev
  6. chroot /mnt
  7. /sbin/mkinitrd (to recreate the initrd for the existing kernel
  8. /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg (To regenerate the grub config)
  9. /usr/sbin/grub2-install --force /dev/sda (/dev/sda is my boot disk)

Now exit the chroot jail and reboot the system and hopefully everything should be back to normal

Edited on: Wed, Nov 25, 2020 12:36

Posted in HowTo (RSS), System - Linux (RSS)