What is the cause for the degradation of environment?
Capitalism, corruption, consuming society? - OVERPOPULATION!
Please, save the Planet - kill yourself...

Saturday, March 9, 2013

GRUB2 Recovery

Encountered an unpleasant issue today. Suddenly without any reason GRUB2 at my dual boot laptop halted with the "GRUB" string on the black screen and refused to proceed any further. Seems that is a known issue for the openSUSE 12.2 (GRUB2 became a bootloader for this version).

GRUB recovery usually an easy procedure and I did it quite often having several machines with a windows as a spare OS (it has an annoying habit deleting GRUB during own installation). I just used openSUSE live USB to load, and in Yast in Bootloader settings asked to propose the configuration for GRUB and then just saved it to the /boot partition.

This time it didn't work at all... So I've spent all the day looking for solution. This two sources helped me a lot: Re-install Grub2 from DVD Rescue and openSUSE Help and Troubleshooting. Here you are the steps that helped me with my dualboot needs:
  1. Boot to Rescue System from the openSUSE installation DVD (login is root).
  2. Run fdisk -l to locate root partition (/dev/sda6 for me)
  3. Mount all that is needed (including partitions with other OSs so they will be scanned and included in GRUB configuration):
    • mount /dev/sda6 /mnt 
    • mount --bind /dev /mnt/dev 
    • chroot /mnt 
    • mount /proc 
    • mount /sys 
    • mount -a
  4. If the configuration file for GRUB is lost (like in my case):
    • grub2-mkconfig -o /boot/grub2/grub.cfg
  5. Write GRUB2 configuration to disc:
    • grub2-install /dev/sda
  6. Unmount and reboot:
    • umount -a
    • exit
    • reboot

1 comment :

  1. Hi, thanks for your post. In my case I had it screwed up by swapping disks, changing boot order, MBR locations, and whatnot... In addition I had separate partitions for "/boot" and "/". My solution was to mount the "/" partition on /mnt first, then the "/boot" partition on /mnt/boot and finally "/proc" and "/sys" on /mnt/proc and /mnt/sys, respectively. Then chroot'ed, grub2-mkconfig'ed and grub2-install'ed. It worked! (OS is opensuse 13.2 x86_64)