Grub2 -12.2 re-install - via yast

I tried installing the grub2 bootloader (as I had Mint in control) via Yast
Anyway, it didn’t work. Tried a few times too. Bootloader to / and MBR
So I basically went to the terminal to do exactly the same, which worked.

Has anyone else experimented with this?

For obvious reasons, I have not ran the grub2-install on a working system that already boots. None the less I would like to know how this works. The terminal commands that did work were similar to these?

# for the MBR
sudo grub2-install /dev/sda 

# for the /
sudo grub2-install /dev/sda1

Just wanting to know what does work. Have you considered filing a bug report?

Thank You,

For obvious reasons, the latter will not work:

# grub2-install /dev/sda2
/usr/sbin/grub2-bios-setup: warning: File system `ext2' doesn't support embedding.
/usr/sbin/grub2-bios-setup: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub2-bios-setup: **error: will not proceed with blocklists**.

You need to use the –force option to install the boot loader to a partition boot sector. See this post: http://forums.opensuse.org/english/get-technical-help-here/install-boot-login/478220-trouble-installing-12-2-grub2-efi-2.html#post2486196 (has nothing to do with EFI though).

I upgraded to 12.2 from 11.4 a couple of days ago. So, I still have grub-legacy in place. However, I noticed in menu.lst the following entry

###Don't change this comment - YaST2 identifier: Original name: linux###
title GNU GRUB 2 -- openSUSE 12.2 - GNU GRUB 2
    kernel (hd0,5)/boot/grub2/core.img root=/dev/disk/by-id/ata-Hitachi_HTS542525K9SA00_080402BB3F00WDD6EV6C-part6 resume=/dev/disk/by-id/ata-Hitachi_HTS542525K9SA00_080402BB3F00WDD6EV6C-part5 splash=silent quiet 
showopts vga=0x31a

Curiosity got the better of me, and I attempted to boot grub2 from it, but of course core.img didn’t yet exist and it failed. Anyway, since reading this thread, I did

grub2-install --force /dev/sda6

It created core.img and placed in /boot/grub2/i386-pc/, so the above grub entry still failed (error11: unrecognised device string)

I edited it like this

###Don't change this comment - YaST2 identifier: Original name: linux###
title GNU GRUB 2 -- openSUSE 12.2 - GNU GRUB 2
    set root=(hd0,5)
    insmod ext2
    kernel (hd0,5)/boot/grub2/i386-pc/core.img root=/dev/disk/by-id/ata-Hitachi_HTS542525K9SA00_080402BB3F00WDD6EV6C-part6 resume=/dev/disk/by-id/ata-Hitachi_HTS542525K9SA00_080402BB3F00WDD6EV6C-part5 splash=silent quiet 
showopts vga=0x31a

Now it chainloads grub2 as expected. :slight_smile:

I’m only dipping my toes in the grub2 water at the moment, so I don’t want to get rid of the legacy grub just yet, but this might be useful to others who just want to play

Cleaned it up a little

###Don't change this comment - YaST2 identifier: Original name: linux###
title GNU GRUB 2 -- openSUSE 12.2 - GNU GRUB 2
    set root=(hd0,5)
    kernel /boot/grub2/i386-pc/core.img root=/dev/disk/by-id/ata-Hitachi_HTS542525K9SA00_080402BB3F00WDD6EV6C-part6 resume=/dev/disk/by-id/ata-Hitachi_HTS542525K9SA00_080402BB3F00WDD6EV6C-part5 splash=silent quiet 
showopts vga=0x31a

and forgot to mention about running ‘grub2-mkconfig’ to create the necessary…

I’m going to do some tests, also with the DVD recovery and a Live CD

Yes, James. But I actually only ran the install to sda because I knew it was on /

Thanks so far. Not 100% sure if it’s a bug yet.

Let me explain: I have Mint and openSUSE on this machine. Mint was controlling grub.
So I tried Yast > Bootloader but it kept failing. So I did from a terminal:

# grub2-install /dev/sda

This worked.

So I started this thread.

Next I booted Mint and re-installed it’s grub
From Mint Grub I booted to SUSE and:

I found when I went to Yast > Bootloader again it looked different, I mean the settings were different. I don’t have the original from before I manually wrote SUSE grub, but IIRC only checks were MBR and Root, I might even be mistaken about MBR.
But having installed manually it now looked like this: https://dl.dropbox.com/u/10573557/Grub2_Project/A1.png
I tried installing grub with the settings:

  1. https://dl.dropbox.com/u/10573557/Grub2_Project/A1.png
  2. https://dl.dropbox.com/u/10573557/Grub2_Project/A2.png
  3. https://dl.dropbox.com/u/10573557/Grub2_Project/B1.png
  4. https://dl.dropbox.com/u/10573557/Grub2_Project/C1.png

FYI: the disk ID seen in image 1 and 3 changes to sda as soon as you click the drop down

So I use the Rescue from the DVD.
Here is how to re-install grub from the DVD. I don’t run grub2-mkconfig -o /boot/grub2/grub.cfg
Because I know it’s already correct:

Once the DVD rescue gets to ‘login’, type: root
from there I run fdisk -l to confirm my HD partitition order

Now mount / (sda3) with:

**mount /dev/sda3 /mnt**

Next do:

**mount --bind /dev /mnt/dev**

Then chroot:

**chroot /mnt**

Your prompt changes to: Rescue:/>
Here type:

**grub2-install /dev/sda**

You can see it all here: https://dl.dropbox.com/u/10573557/Grub2_Project/rescue.jpg

**‘exit’

reboot**

Are you sure you need the chroot environment? I didn’t need it to reinstall Grub from the rescue system into a boot sector partition (with the --force option). I did this only for testing purpose. It worked. My guess is that you would need chroot if you’re going to install packages of stuff like that, but not to just install the boot loader. I can not be 100% sure but I don’t think that I ever used chroot to reinstall Grub (provided the package is already installed).

If I get chance later, I’ll test it.

Hi Carl, that makes sense to me.

I think you could have also done

grub2-install --boot-directory=/mnt/boot/grub2 /dev/sda

What I am interested in though, keeping to the main point of this thread, is:

Has anyone else tested the Yast > Bootloader?

To me, it seems buggy, or at the very least; totally incomprehensible.

@please_try_again
What do you make of those yast screen attempts at installing grub?

YaST uses the Perl Bootloader to install Grub. See if you can find something in /var/log/YaST2/perl-BL-standalone-log.

It seemed to have worked for me, but I didn’t check “Custom boot partition” . Why did you?


# findgrub
Find Grub Version 4.1 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ... --> **Grub2 (1.99) found in sda MBR     => sda?   0x?? (openSUSE)**
 - searching partition /dev/sda1      (FAT16)         ... --> Windows NT/2K/XP Loader found in /dev/sda1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can add the following entry to /boot/grub/menu.lst :

###Don't change this comment - YaST2 identifier: Original name: WindowsBootLoader###
title Windows on /dev/sda1
    rootnoverify (hd0,0)
    chainloader +1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 - reading bootsector  /dev/sda2   *  (LINUX)         ... --> **Grub2 (1.99) found in /dev/sda2   => sda?   0x?? (openSUSE)**
 - skipping partition  /dev/sda3      (OpenBSD)      
 - reading bootsector  /dev/sda4      (Extended)      ... --> Legacy GRUB  found in /dev/sda4   => sda2   0x83 (openSUSE)
 - skipping partition  /dev/sda5      (swap)         
 - reading bootsector  /dev/sda6      (LINUX)         ...
 - reading bootsector  /dev/sda7      (LINUX)         ...
 - reading bootsector  /dev/sda8      (LINUX)         ...
 - reading bootsector  /dev/sda9      (LINUX)         ...
 - reading bootsector  /dev/sda10     (LINUX)         ...
 - reading bootsector  /dev/sda11     (LINUX)         ...
 - reading bootsector  /dev/sda12     (LINUX)         ...

 - skipping protective MBR on disk /dev/sdb                       ...
 - reading MBR on disk /dev/sdc                       ... --> Legacy GRUB  found in sdc MBR     => sdc1   0xfd (openSUSE)
 - searching partition /dev/sdc1      (LINUX RAID AUTO) ...
 - searching partition /dev/sdc2      (LINUX RAID AUTO) ...
 - searching partition /dev/sdc3      (LINUX RAID AUTO) ...
 - reading bootsector  /dev/sdc4      (Extended)      ...
 - searching partition /dev/sdc5      (LINUX RAID AUTO) ...

 - reading MBR on disk /dev/sdd                       ... --> Legacy GRUB  found in sdd MBR     => sda2   0x83 (openSUSE)
 - searching partition /dev/sdd1      (LINUX RAID AUTO) ...
 - searching partition /dev/sdd2      (LINUX RAID AUTO) ...
 - searching partition /dev/sdd3      (LINUX RAID AUTO) ...
 - reading bootsector  /dev/sdd4      (Extended)      ...
 - searching partition /dev/sdd5      (LINUX RAID AUTO) ...


Press <enter> to Exit findgrub...

I can tell that it is openSUSE Grub2 because it is not fully supported by findgrub yet. So findgrub doesn’t know where it should read the boot partition. It is tricky since Grub 1.99, because the embedded core is compressed. It says 1.99, because it has the same signature as Grub 1.99, but it should be 2.0.

On a machine with Mint Grub in MBR, I get that (Mint uses Grub 1.99):

 # findgrub
Find Grub Version 4.1 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ... --> **Grub2 (1.99) found in sda MBR     => sda7   0x83 (Ubuntu)**
 - searching partition /dev/sda1   *  (FAT16)         ... --> Windows NT/2K/XP Loader found in /dev/sda1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can add the following entry to /boot/grub/menu.lst :

###Don't change this comment - YaST2 identifier: Original name: WindowsBootLoader###
title Windows on /dev/sda1
    rootnoverify (hd0,0)
    chainloader +1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 - skipping partition  /dev/sda2      (FreeBSD)      
 - skipping partition  /dev/sda3      (FreeBSD)      
 - reading bootsector  /dev/sda4      (Extended)      ...
 - searching partition /dev/sda5      (NTFS)          ...
 - skipping partition  /dev/sda6      (swap)         
 - reading bootsector  /dev/sda7      (LINUX)         ...
 - reading bootsector  /dev/sda8      (LINUX)         ...
 - reading bootsector  /dev/sda9      (LINUX)         ... --> Legacy GRUB  found in /dev/sda9   => sda9   0x83 (Mandriva/ArchLinux/Debian)
 - reading bootsector  /dev/sda10     (LINUX)         ...
 - reading bootsector  /dev/sda11     (LINUX)         ...

 - reading MBR on disk /dev/sdb                       ... --> Legacy GRUB  found in sdb MBR     => sdb5   0x83 (openSUSE)
 - skipping partition  /dev/sdb1      (FreeBSD)      
 - skipping partition  /dev/sdb2      (FreeBSD)      
 - reading bootsector  /dev/sdb4      (Extended)      ...
 - reading bootsector  /dev/sdb5      (LINUX)         ... --> Legacy GRUB  found in /dev/sdb5   => sdb5   0x83 (openSUSE)
 - reading bootsector  /dev/sdb6      (LINUX)         ...
 - reading bootsector  /dev/sdb7      (LINUX)         ...
 - reading bootsector  /dev/sdb8      (LINUX)         ...
 - skipping partition  /dev/sdb9      (swap)         

********************************************************************************
WARNING: /boot/grub/device.map not found.
         Displayed BIOS device mapping may be incorrect!
********************************************************************************

Press <enter> to Exit findgrub...

If fingrub reports Grub 1.99 (I’ll try at least to fix that) and can not identify the boot partition (sda? 0x??), it will be openSUSE’s Grub (most likely).

Well, I don’t have any other Linux OS partitions, apart from openSUSE, and I’ve never had to use the yast bootloader utility. In fact, generally when one does have a boot loader issue, they’re usually having to resort to a rescue disk and grub CLI tools :slight_smile:

Anyway, I had a quick look at it, and found nothing unusual with it’s behaviour.

I’ve been struggling with this as well. From a user’s perspective, it certainly seems like a (serious) bug: YaST says it’s writing a new bootloader, but does not do so.

I’ll be the first to admit that I accidentally installed legacy GRUB while attempting to install openSUSE’s GRUB. =)