Grub2 Question

I’m trying to help my friend install openSUSE 13.1 x64. He has an issue where Grub2 is not giving the option to write the MBR to the hard drive that he wants openSUSE on. He has multiple hard drives in his machine, and Winblows is on one of those drives. Grub2 is writing the MBR to the Windows drive, and this isn’t the behavior that is desired. How do you get Grub2 to not write the MBR to the wrong drive?

Secondly, this install was on a drive that had FreeBSD on it, and the YaST Partioner had an issue erasing the MBR from the FreeBSD install, leaving an unbootable system. Does Grub2 sometimes have problems overwriting an existing MBR? He also tried having Grub2 write to the root partition, and that left the system unbootable.


You can set drive priority in the BIOS, choose the one to install openSUSE onto as the first drive, I suppose this isn’t UEFI? Besides, by default GRUB will boot from ‘root’(/boot) not MBR, choose whichever you like but to launch GRUB you need to set the oS drive at top.

It is not UEFI. He already did set the OS drive as the top drive and Grub2 writes an MBR to the Windows drive, which is the wrong drive.

At the scheme check screen all the things planed to happen are listed click the grub entry and change it.

Not Gurb does not have to be in the MBR if you use generic MBR code and put grub code on the boot partition (root usually) then the system will boot to the partition that is flagged to boot

If you need more info show use the output

fdisk -l
note that is lower case L not a one

You can use any live Linux to get that

During install, at the install summary proposal

GRUB2 writes to whatever device it is told to write. You probably mean YaST bootloader configuration which is something different. Please show /etc/default/grub_installdevice and /boot/grub2/

On the boot install screen, there’s a long button at the bottom “Boot Loader Installation Details”.

Click on that. There will be a list of drives, and up/down buttons. Arrange the list so that the first is the one where grub is to be installed. Then click “OK”. The summary screen should now show the MBR of the desired disk for installation.

I’m not sure whether it still works. It worked in the past by using legacy (hd0) as install device and changing mapping in; but today yast does not use legacy drive names anymore and simply refers to OS device name (/dev/…).

It worked for me, installing 13.1 to an external drive and booting from the MBR of that external drive.

The ordered list of drives did use “/dev/sda” etc. And that was a bit awkward, because I had to make sure which device name the installer was associating with which physical device. So it is more confusing than I indicated in my earlier comment.

He says he did this but it didn’t work. YaST puts the MBR on the wrong drive. Is there a bug here?

It’s hard to know, but I would guess user error.

The difficulty is that the names of drives ("/dev/sda", “/dev/sdb”, etc) are not fixed – they can change. If the install was done while booted to a USB, that could change the device names. During the install, you have to use the device names as they are used in that particular boot to the installer. And it isn’t always obvious what that order is.

I would probably use CTRL-ALT-F2 to get to a command line. Then I would use “df” to see what is mounted. That usually gives me a clue on what the device names are for this boot. And then, CTRL-ALT-F7 gets back to the installation screen to complete entering the settings.

This worked fine for me with opensuse 13.1, installing on an external drive and booting from the MBR of that external drive.

More information is required.

  1. Does he still want to boot Windows?
  2. If so, does he want to boot Windows from the Windows drive, or from Grub?
  3. Does Windows still boot? I think you indicated not, but I am uncertain;
  4. Depending on the above questions, how does he want to boot Linux?

From the Primary drive?
From the Windows drive?
From the Linux drive as a second or third drive by choosing it in the boot device screen at startup?

All these things make important differences in the approach.

Then, does he want to fix what is now installed, or do you want instructions how to install openSUSE again, but with a clear guide how to get GRUB written to a specific place?

If he wants Windows to still boot, and if it does not boot at the moment, then you should fix that, first. When Windows is working again, then come back here with the answers to the above questions.

And it is imperative that you post, as goglathorp asked:

He also tried having Grub2 write to the root partition, and that left the system unbootable.

If he tried booting by using his BIOS options and selecting to boot from the drive Linux is installed on, then this failure was most likely because the root partition was not set as the BOOT (or ACTIVE) partition. (Which gogalthorp also alluded to.)

On 2014-03-23 06:16, nrickert wrote:

> This worked fine for me with opensuse 13.1, installing on an external
> drive and booting from the MBR of that external drive.

I have not tried this, but on the photo caf4926 posted, you can see that
it offers a list of destinations for the boot loader. Maybe selecting
only the last one, “custom boot partition”, and there choose one,
would work :-?

Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

This is the Boot device list in the BIOS and I would rather think you made some mistake regarding this; but if so, just unplug the device (HD containing Win) install Linux and re-connect the other drive afterwards. Have the Linux drive as first boot device, then force a reinstall of GRUB to have the Windows entry automatically added to the GRUB boot menu.