Change GRUB to GRUB2

Hi.

I’ve recently wanted to hibernate Windows and couldn’t so I searched for some time and found that I have to make Windows partition active so I did.
Then only Windows was booting (skipping boot loader) so as smart as I am I changed the partition back to inactive. And as you may suspect - I have currently no OS (or at least GRUB is not finding any).

So I got LiveCD, opened terminal and logged as root:

su -
mount /dev/sda5 /mnt
mount --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys
mount --rbind /dev /mnt/dev
cp /etc/resolv.conf /mnt/etc
chroot /mnt /bin/bash

Then I checked and I have no file /boot/grub/menu.lst. However, /boot/grub2/grub.cfg exists. That’s what I got after “refreshing” it:

linux:/ # grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub.cfg ...
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found linux image: /boot/vmlinuz-3.7.10-1.16-desktop
Found initrd image: /boot/initrd-3.7.10-1.16-desktop
Found linux image: /boot/vmlinuz-3.7.10-1.1-desktop
Found initrd image: /boot/initrd-3.7.10-1.1-desktop
Found memtest image: /boot/memtest.bin
ERROR: opening path /mnt/sys/block
ERROR: failed to discover devices
ERROR: opening path /mnt/sys/block
ERROR: failed to discover devices
ERROR: opening path /mnt/sys/block
ERROR: failed to discover devices
ERROR: opening path /mnt/sys/block
ERROR: failed to discover devices
ERROR: opening path /mnt/sys/block
ERROR: failed to discover devices
  No volume groups found
Found Windows 7 (loader) on /dev/sda2
done

So I think that at least Windows should boot.
Moreover, I’ve tried and copied everything from /boot/grub2 to /boot/grub but still no OS after reboot - only GRUB 0.97.
I’ve also tried removing grub from disk but each and every time I had beloved GRUB 0.97.

Maybe it’s important that Yast’s telling me that I’m booting GRUB2 (which is default) from extended partition (root+swap+home).

I’d be extremely grateful for help as not having OS is very harmful and I have some projects to finish.

Assuming a BIOS and not an UEFI. If you install grub2 to the MBR then that would not happen since the flag is ignored and the code in the MBR simply is pointed to the right partition to boot openSUSE. I have to assume you have generic code in the MBR which does use the boot flag to select the boot partition.

If you have openSUSE running you can fix that in Yast-boot just put grub into the MBR.

NOTE if you have a UEFI then ignore the above you can bork the system.

Just to be sure (as if I destroy MBR I will have to buy another disk) - I have to choose in Yast->System->Boot Loader->“Boot loader location” the option “Boot from Master Boot Record”?
Are you sure it’s that simple? (sorry for being pessimistic but I spent several hours trying to fix this)

No the MBR is just the first sector on any disk. You can just reinstall the code you want there. You can’t destroy The disk you just won’t be able to boot from it/

It worked! Love you man, thanks! Nearly lost hope.
So I can’t install grub2 unless I have UEFI instead of BIOS?

You can install grub2 for BIOS machine you use grub2-efi for EFI-GPT machines

Nothing wrong with just plain grub but it is being phased out and at some point will not be supported and plain grub(1) does not support UEFI

When I was speaking about grub I generally mean grub2 since that is the new default.