Install GRUB to MBR on second disk

Having fun installing OpenSuse 42.3 and getting GRUB where I want it.

My PC is older (BIOS) with 2 SATA disks.

Disk 1 (sda) holds the O/S’s and software, Disk 2 holds data

If I boot from Disk 1 I go straight to Windows which is fine. Essentially the boot on this disk is as Windows install left i
If I boot from Disk 2 I get GRUB from OpenSuse 42.2 and I can boot various Linuxes (excepting rebuilding GRUB misses some out) or Windows and this is how I want it.

In previous installs I just tell the installer to use the MBR and since BIOS has put Disk 2 first it’s always gone in there as desired. But with 42.3 it doesn’t seem to want to install to MBR of Disk 2. Playing with options suggests it may go to MBR of Disk 1 but that isn’t what I want.

I simply want to put GRUB into MBR of Disk 2 nice and easily as before so if BIOS boots from Disk 2 I get GRUB, if from Disk 1 I go straight to Windows which is handy for those silly Windows updates with several reboots.

I really don’t understand EFI/UEFI or other. It’s an older PC (Core i7 720 or something like that), it all works fine so far.

Any ideas, especially if it sorts the issue with GRUB in 42.2 that doesn’t see other Linux’s properly (that’s in another thread but no working solution yet.)

Your system is NOT an EFI system, thus don’t bother your mind with any thoughts about it.

I’m looking at the installer screen right now.

After going through most of the setup steps, there is a summary screen. Click on “Booting” near the top of that screen.

On the next screen, look for “Edit Disk Boot Order” (near the bottom left). Click on that.

You can move disks up and down. Arrange so that disk 2 (probably listed as “/dev/sdb” is at the top in disk boot order.

Then select MBR for installing boot – you can do that on the same screen, just check the box for “Boot from Master Boot Record”. And you should be set.

I have a multiboot setup on an older system and I have grub installed in the mbr of my 3rd disk as well as in the root partition
it’s rather simple from the grub setup just select the disk and partition where grub goes to
the thing is I stopped doing full installs years ago I just do live upgrades but I am sure that this is possible just read the partition and boot options carefully
you should also keep in mind that the mbr of your boot disk (the disk can be changed in bios) is bootable or else you might wonder what happened
personally I use EasyBCD for my win7 disk bootpart for my old xp disk and grub for my LEAP disk
yes I have 3 OS’s on 3 hard drives and each have their use their own boot code in the mbr of their disk

Select “Custom Boot Partition” and give name of your device for the second disk. It is better to use long persistent /dev/disk/by-something name as /dev/sda may change after reboot. It is not quite convenient during installation where you cannot easily copy-paste, indeed.

It just doesn’t work.

If boot order is sda then sdb it does work and I can see it will install to MBR of sda (not desireable).
If boot order is sdb then sda I can’t select to install to MBR - I can tick box in the config screen but the summary shows red warning and not installing at all.

If I could get my 42.2 install to see the 42.3 or even the Tumbleweed (it must have once since the current menu has entries for older kernels) then I think I could boot to 42.3 then work the GRUB install from there where I can cut/paste.

I’ll attach some photos when I receive them.

Photos

http://www.braggfamily.info/images/mbrsda.jpg http://www.braggfamily.info/images/mbrsda.jpg

http://www.braggfamily.info/images/mbrsdb.jpg

Click to change option if not what you want

It doesn’t work.

If I select to use sdb then clicking on install next to MBR doesn’t do anything. If I go into the options and tick MBR then save I get the screen for sdb first above.

Note software etc is all going to sda it’s just boot to MBR on sdb. It has always worked in past as you state.

it has also worked for me I can even change/re-install grub from a running system
but seeing how LEAP 15 is out I’d say try it with the new release
may I ask what does sdb hold?
to install the mbr in sdb that hdd has to be mbr formatted not gpt
I don’t get it why are you putting grub on a disk that doesn’t hold the OS if you install the OS on sdba put grub on it and change boot disk priority in bios to boot from sdba
in the past I use to put a copy of grub on a floppy drive just in case but other then that I always put grub on the mbr of the disk that I install the OS to if that hdd houses multiple OS’s I put grub on the root partition of that disk
this way I’ve been able to boot multiple OS’s from multiple disk loaders

edit
an Core i7 720 is not an “older PC”
by older PC’s I regard those that can boot from mbr only as your is a newer machine check bios if efi is turned off and check how your hard drives are partitioned if they’re gpt partitioned you can’t install grub in mbr as mbr does not exist you might need to repartition (or convert) your hard drives from gpt to mbr
https://docs.microsoft.com/en-us/windows-server/storage/disk-management/change-a-gpt-disk-into-an-mbr-disk
afaik there is no way to convert a gpt to mbr without data loss (ie full formatting)

You can get lucky.

The “gdisk” command will happily convert, but it warns you of possible loss of data.

I got lucky. I wasn’t using any space required for the GPT partition table – my last partition did not extend all the way to the end of the disk. And “gdisk” converted it with no problems.

Looking back I registered components in my PC in 2009 so it’s not new. I think I should have put i7 920.

Anyway I tried Leap 15 and hit 2 errors. Reading in an old fstab errored on the /boot mount (sda6) so tried again.

sda6 - ext4 - /boot
sda7 - brtfs - /
sda3 and sdb2 - swap
sdb3 - ext4 - /home not reformatting this - old dirs moved aside

This will let me order disks sdb then sda but the install summary shows boot to MBR on sda.

I have OpenSuse 42.2 intalled fine with boot in MBR on sdb but it doesn’t see Tumbleweed or a 42.3 without boot installed also on partitions of sda though at some point it must have done so as there are entries in there for 13.2 (replaced by 42.3) and Tumbleweed (old kernels) (I boot to Tumbleweed by using initrd and vmlinux links to latest kernels) I have another thread for that issue.

All very odd.

but what’s on sdb is sdb an mbr disk or a gpt
what’s the output of

sudo parted -l 

the only reason I can think of why grub is not being installed in sdb’s mbr if sdb does not have an mbr

this is a screenshot of my current grub setup
https://i.imgur.com/H6SoAcI.png
you can’t really see disks or partitions there but grub is installed in both /dev/sda and /dev/sda1 (my boot disk is /dev/sdc I redirect to LEAP with easybcd)
you should be able to select custom boot partition and put /dev/sdb

I don’t know why you are having this problem.

Is it possible that “sdb” uses GPT partitioning? If it does, then you might not be able to boot from its MBR unless you also have a bios_boot (or bios_grub) partition defined.

Sorry but I don’t know what GPT partitioning is. I’ve not touched the partitioning on sdb for yonks. It’s my data disk and it has always just worked with OpenSuse, other distro’s (Ubuntu Studio) simply overwrote MBR on sda but OpenSuse has always held my hand very nicely. EDIT - parted -l shows both disks as MBR (msdos) partitioning.

OpenSuse 42.2 at install also worked fine, spotted Tumbleweed and OpenSuse 13.2 (which is where I want to put Leap 15).

Now grub2-mkconfig in OpenSuse 42.2 doesn’t see Tumbleweed or OpenSuse 42.3 (installed without bootloader) - other thread - but it sees they are there just doesn’t see kernels so no menu entries.

But it seems I can just force to /dev/sdb and it will work? I will have to find way to backup important data first just in case. Some I can get/make again, most is backed up but some recent isn’t yet.

Thanks for all the help so far, just seems strange that it all used to work really well now (at least in my case) it doesn’t.

Okay. So it is not using GPT partitioning. So that’s not the problem.

Then I’m still puzzled as to why you are having these problems.

Yep - me too. 42.2 went in fine but 42.3 and now 15 are just not wanting to install to MBR on sdb. Was wondering if it’s a new “feature” so MBR has to be on same disk as the software which would be a pain but that doesn’t seem to be the case from other postings. If I had the money I’d pop an SSD in and install Linux to that, with it’s MBR are so on. It should then still see Windows and hopefully the other Linuxes but I am where I am.

As to earlier question as to why put MBR on sdb (data) disk it’s so I can leave Windows MBR intact on the other disk. So when it wants to do one of it’s big updates or takes a funny turn with multiple reboots needed I don’t need to sit there to select Windows in GRUB (Linux is my default of course). It also means when I take PC for repairs I can leave it with Windows booting so they don’t need to worry about GRUB/Linux or other “complications”.

david:~ # parted -l
Model: ATA WDC WD10EADS-00L (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  210GB   210GB   primary   ntfs            boot, type=07    - main Windows 10 partition
 2      210GB   419GB   210GB   primary   ntfs            type=07            - Windows test partition (I put prerelease versions in here but now used as space for Windows stuff
 3      419GB   426GB   6292MB  primary   linux-swap(v1)  type=82
 4      426GB   1000GB  574GB   extended                  boot, lba, type=0f
 5      426GB   531GB   105GB   logical   ntfs            type=07
 6      531GB   532GB   1077MB  logical   ext2            type=83            - want Leap 15 boot in here - reformat ext4
 7      532GB   639GB   107GB   logical   btrfs           type=83              - want Leap 15 root in here - format on install
 8      639GB   703GB   64.4GB  logical   btrfs           type=83             - OpenSuse 42.2  (current boot system)
 9      703GB   768GB   64.4GB  logical   btrfs           type=83              - Tumbleweed


Model: ATA WDC WD10EADS-00L (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  105GB   105GB   primary   ntfs            boot, type=07          - Windows data area (downloads)
 2      105GB   111GB   6292MB  primary   linux-swap(v1)  type=82        
 3      111GB   216GB   105GB   primary   ext3            type=83                  - Linux /home   - only used by main Linux platform
 4      216GB   1000GB  784GB   extended                  lba, type=0f
 5      216GB   426GB   210GB   logical   ntfs            type=07                    - Music
 6      426GB   1000GB  574GB   logical   ntfs            type=07                    - Photos     - these 2 could be other way round, mounted in Linux with group write e.g. photo group can write here


Okay. Thanks for providing that output.

Here’s what I would suggest:

Boot from “/dev/sda6” which I presume is “/boot” for Leap 15.0

Make sure that you check the box to write generic boot code in the MBR (which would be “/dev/sda”. And uncheck the box to boot from the extended partition. You might get a warning that your system is not guaranteed to boot.

The generic boot code that openSUSE uses is actually able to boot a logical partition, so that should work.

That does not satisfy everything that you wanted. But that can be fixed later.

Let me describe my laptop, and how I had it setup for Leap 42.3 (it now has Leap 15.0).

“/boot” was “/dev/sda5” (which is a logical partition). I set openSUSE to boot from there.
Windows 7 is in “/dev/sda3”.

The generic boot code that openSUSE installs comes from “syslinux” (in “/usr/share/syslinux”).
There’s an alternative boot code there, named “altmbr.bin”.

I took that alternative boot code, which is 439 bytes long, appended a binary 5 to the end to give 440 bytes, and wrote that to a file which I called “altmbr-05.bin”. I wrote that to the MBR with:

cat altmbr-05.bin > /dev/sda

That’s done as root. And it is important that the file be exactly 440 bytes so that only the boot code is changed.

The effect of that “altmbr-05.bin” boot code, is that it always boots partition 5 (or “/dev/sda5”). So I now set the active bit to “/dev/sda3”, which keeps Windows happy.

So Windows thinks that it is in the active partition. But booting actually uses openSUSE grub menu.

If I wanted to switch back to Windows booting during repairs, updates, etc, I need only write the original Windows-provided generic boot code to the MBR. Then it will revert to booting Windows. And when I’m done with that, I can reinstall the “altmbr-05.bin” boot code to the MBR and get the grub menu back.

The issue with Leap 15 is similar but slightly different.

1)Partitioning - unlike previous installers that spotted space on sda and offered that as default this sees the /home on sbd and wants to reformat and use that. If I read from old fstab in sda7 the installer errors. Still I can partition how I want and reuse sda7 as / and for testing leave sda6 alone.
2)Boot installer now wants to use MBR but wants to use sda. I go to change the boot order to sdb, sda but it still wants to use MBR on sda.

I’ve installed without boot loader but my 42.2 grub2-mkconfig sees Leap15 and Tumbleweed but doesn’t seem to see any kernels so doesn’t build the menu. I’ve updated osprober.

Isn’t all this good fun? But the question would now be can I put /dev/sdb into the “alternative” in the boot loader installation? Would that work? Is it likely that the prober on Leap15 would see Tumbleweed and OpenSuse 42.2. (What I have tended to do when new opensuse is released is to put it into a spare part of sda then I can play, once I’m happy I can update my main partition and move settings etc to the new install. Then cycle repeats. Things are easier now I’m the only user, family all have own laptops - all Linux)