grub2 can't be installed into MBR so installed in root partition / how to run openSUSE 13.2 now?

Hey guys,
so after two weeks of learning about grub and grub2, installing openSUSE 13.2 5 times with different settings and failing to run opensuse 13.2 I have given up. I hope someone can help me to run openSUSE on my old (2004) computer with P4P800-E motherboard.

It’s a window 7 computer with two hard disk, one hd is configured as raid, the other one is used for both windows and my new OS to be openSUSE (see for detailed info below the output of the boot info script).

First of all it’s a mystery why grub2 won’t install into MBR. Anyhow, I decided to install it in the root partition and the installation succeeded. I booted into windows and installed easybcd. I chose the root partition as the second entry in the windows boot menu and selected it when booting. I was confronted with the grub command line. After doing a search how grub works I managed to find out how to run opensuse from the grub command line but grub doesn’t recognize the btrfs file system so I’m not able to mount that partition. It just shows the partitions but it isn’t able to say what kind of partition it is. So I probably wasn’t working in grub2, but grub?

I then inserted the install dvd again in the dvd player and selected the rescue option and ended up in linux command line mode. I executed the boot info script. I copied the output in this message. Judging from this snippet I think the installation went fine.

Now, my question is basically two fold:

  1. why can’t grub2 be installed in the MBR?
  2. how can I run openSUSE from that root partition?
                  Boot Info Script 0.61      


============================= Boot Info Summary: ===============================

 => Windows is installed in the MBR of /dev/sda.
 => Windows is installed in the MBR of /dev/sdc.

sda1: __________________________________________________________________________

    File system:       
    Boot sector type:  -
    Boot sector info:
    Operating System:  
    Boot files:        

sdc1: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  Windows 7
    Boot files:        /bootmgr /Boot/BCD /Windows/System32/winload.exe

sdc2: __________________________________________________________________________

    File system:       Extended Partition
    Boot sector type:  Unknown
    Boot sector info:

sdc5: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7: NTFS
    Boot sector info:  According to the info in the boot sector, sdc5 starts
                       at sector 63. According to the info in the boot
                       sector, sdc5 has 71586512 sectors, but according to
                       the info from fdisk, it has 73304593 sectors.
    Operating System:  
    Boot files:        

sdc6: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7: NTFS
    Boot sector info:  According to the info in the boot sector, sdc6 starts
                       at sector 63.
    Operating System:  
    Boot files:        

sdc7: __________________________________________________________________________

    File system:       swap
    Boot sector type:  -
    Boot sector info:

sdc8: __________________________________________________________________________

    File system:       btrfs
    Boot sector type:  Grub2 (v1.99)
    Boot sector info:  Grub2 (v1.99) is installed in the boot sector of sdc8
                       and looks at sector 157599745 of the same hard drive
                       for core.img. core.img is at this location and looks
                       in partition 132 for .
    Operating System:  Welcome to openSUSE 13.2
                       "Harlequin" - Kernel ().
    Boot files:        /boot/grub2/grub.cfg /etc/fstab

sdc9: __________________________________________________________________________

    File system:       xfs
    Boot sector type:  -
    Boot sector info:
    Operating System:  
    Boot files:        

md127: _________________________________________________________________________

    File system:       
    Boot sector type:  Unknown
    Boot sector info:
    Operating System:  
    Boot files:        

sdb: ___________________________________________________________________________

    File system:       linux_raid_member
    Boot sector type:  Unknown
    Boot sector info:

============================ Drive/Partition Info: =============================

Drive: sda _____________________________________________________________________

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sda1               2,048 1,953,542,143 1,953,540,096   7 NTFS / exFAT / HPFS

/dev/sda1 ends after the last sector of /dev/sda

Drive: sdc _____________________________________________________________________

Disk /dev/sdc: 152.7 GiB, 163928604672 bytes, 320173056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sdc1    *             63    80,067,959    80,067,897   7 NTFS / exFAT / HPFS
/dev/sdc2    *     80,067,960   301,570,982   221,503,023   f W95 Extended (LBA)
/dev/sdc5          80,068,023   153,372,616    73,304,594   7 NTFS / exFAT / HPFS
/dev/sdc6         199,206,063   301,570,982   102,364,920   7 NTFS / exFAT / HPFS
/dev/sdc7         153,372,672   157,597,695     4,225,024  82 Linux swap / Solaris
/dev/sdc8         157,599,744   180,795,391    23,195,648  83 Linux
/dev/sdc9         180,797,440   199,204,863    18,407,424  83 Linux


"blkid" output: ________________________________________________________________

Device           UUID                                   TYPE       LABEL

/dev/loop0                                              squashfs   
/dev/loop1                                              squashfs   
/dev/loop2                                              squashfs   
/dev/loop3                                              squashfs   
/dev/loop4                                              squashfs   
/dev/sdb         03f59a1f-1e27-a280-630c-3a8a0930edea   linux_raid_member
/dev/sdc1        01D033441B44C9B0                       ntfs       
/dev/sdc5        01D03343EED11690                       ntfs       Local Disk
/dev/sdc6        01D0334265A20740                       ntfs       Local Disk
/dev/sdc7        d250b493-658d-4a48-acb9-46d6b363f4ea   swap       
/dev/sdc8        f85766a0-a45c-42b6-94b5-b3f8a3b38501   btrfs      
/dev/sdc9        9ee3f5a3-439f-4a0f-8ba1-997d4a5459f7   xfs        
/dev/sr0         2014-10-27-14-57-36-00                 iso9660    openSUSE-13.2-DVD-i5860054

================================ Mount points: =================================

Device           Mount_Point              Type       Options

/dev/loop0       /parts/mp_0000           squashfs   (ro,relatime)
/dev/loop1       /parts/mp_0001           squashfs   (ro,relatime)
/dev/loop2       /mounts/mp_0000          squashfs   (ro,relatime)
/dev/loop3       /mounts/mp_0001          squashfs   (ro,relatime)
/dev/loop4       /mounts/mp_0002          squashfs   (ro,relatime)
/dev/sdc1        /mnt                     fuseblk    (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)


I’ll try to address those questions.

Why can’t grub2 be installed in the MBR?

This is because (a), you used “btrfs” for the file system, and (b) the first partition on the disk starts at sector 63.

The problem is that grub2 does not fully support “btrfs” at present. On a newer computer, the first partition typically starts at sector 2048. When you install grub2 in the MBR, it uses that space between MBR and the first partition. There is enough space when it has 2048 sectors available. There is not enough space when it only has 63 sectors.

If you had used “ext4” for the root file system, then installing grub would have built a list of blocks in the root partition (called a “block list”), and used that to find the rest of grub2 (the part that won’t fit in the MBR). Apparently, that cannot be done with “btrfs” - or at least it is not currently supported.

What about using the root partition? I’m told that “btrfs” sets aside space for a boot block, and I presume that grub2 uses that.

How to boot?

You are on the right track using “EasyBCD”.

But there’s an issue there.

Your BIOS is presumably set to boot a particular disk. To do this, the BIOS makes a temporary logical re-arrangement of the disks. It puts the boot disk first.

Grub2 reads the disk using BIOS calls. So it needs to know the disk order that the BIOS is using. There’s a place to set this on the bootloader install screen. If you don’t get that right, then EasyBCD probably won’t help.

Let me add that I have no experience booting with grub2 in a “btrfs” root partition. When I tried “btrfs”, I used a separate “/boot” partition for booting (which worked fine).

Your choices:

1: Go into rescue mode, and reinstall grub2, setting the disk order correctly. Then try EasyBCD.
2: Do a complete reinstall. But select “ext4” rather than “btrfs” for the root partition. Install grub2 in the MBR.

There are other possible choices, but those are the two most basic.

Let us know what you want to do, and I can try to provide more details as needed.

Hey nrickert,
thanks a lot for your reply. I think I’ll go for option two. Option one won’t work because there is only one disk present and everything is on that disk. I can’t assign another disk to be the first to boot. Or will grub2 mark its partition as a dedicated disk drive? When you talk about another disk you actually mean a physical hard disk, right? Not a partition on my main disk?

I’ll likely give it a try tonight, but I am defnitely going to update this message when there is progress.

Cheers!

Yes, that’s right.

On the reinstall, when you are presented with a proposed partitioning, you can click either “Edit partitioning” or “Expert Partitioner”. Maybe “expert partitioner” is the easier.

That will give a list of partitions, including the proposed partitions. Find the partition for “/”. Right click and choose “Edit”. Then change the file system to “ext4”.

The chances are that the rest if the install will go well.

If you must use MBR and BTRFS then a separate boot partition formatted ext2 or ext4 would simplify your life. Or just don’t use BTRFS as the root partition and again all is good. If you do use the default BTRFS file system always double the amount of space you think you need because snapper is used and turned on by default and eats up file space taking snapshots.

Hey guys,
just want to thank you for the suggestions. I’m typing this from firefox in Opensuse so everything went fine. I reinstalled OpenSUSE and replaced the btrfs partition with an ext4 partition and chose to install grub2 in MBR. That did the trick.

Thanks a lot for the help!

Regards

Thanks for the update. I’m glad to see things are working out.

For the sake of archives.

That’s correct. Total size of grub image with btrfs support exceeds available space (30K).

If you had used “ext4” for the root file system, then installing grub would have built a list of blocks in the root partition (called a “block list”), and used that to find the rest of grub2 (the part that won’t fit in the MBR). Apparently, that cannot be done with “btrfs” - or at least it is not currently supported.

That’s wrong. btrfs reserves 128K for bootloader installation (outside of normal filesystem space) so grub has no problems to install on partition with btrfs - it will simply put itself in this reserved space. It does not need to use blocklists on btrfs at all. But in this case root is on logical partition which cannot be booted by standard MBR code.

Note that factory has patch that will attempt separate installation of primary boot sector (MBR) and grub image (btrfs partition) in this case. This should fix issues people have with btrfs.

Note that my comment (you quoted it) which you said was wrong was very specifically about what would have happened with “ext4”. Your “correction” was entirely about “btrfs”. There seemed to be a miscommunication.

Yes, it was my apologies. Probably there was.

I have successfully used GRUB2 with GPT, Btrfs, and a non-UEFI BIOS. I changed the disc alignment to start at sector 34, with the end sector being 2047. Between those values, I created a BIOS boot partition where GRUB2 resided. Using GPT has advantages over MBR even for non-UEFI comptuters, so I always use it when possible. However, one if my systems didn’t like the sector realignment trick, but it usually works.

Yes, I agree with this. It works well.

The one downside, is that it can confuse Windows on a non-UEFI box. Opensuse is fine with GPT partitioning.