0

I made the choice to make a triple boot on my 2008 macbook 5,1 with mac OSX 10.6.8, elementary OS and Windows 7 (64bit). I ended up doing this without much knowledge of what would happen to my GPT/MBR.

The installation process I followed was very convoluted and involved swapping drives into my optical bay and virtual box (install order OS X, eOS, W7), but (luckily) the end result is that I now have three functioning installations that boot through rEFInd.

The problem - I'm not sure if this is working as well as it should. Before I installed W7 rEFInd detected OS X and the eOS grub loader correctly. After W7 (and a subsequent reinstall of rEFInd to correct rogue booting) rEFInd now provides many menu options:

  • Mac OS (works properly)
  • eOS (boots through EFI stub loader, was not present before W7 install, works properly)
  • A linux entry (eOS on ext4) (used to boot to eOS through grub before W7, selecting this option now boots into W7 for some reason?)
  • W7 entry (works properly)

On top of that to get everything booting I created a hybrid MBR, but I am unsure if I have set it up correctly as gdisk verify provides the following output:

$ sudo gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with hybrid MBR; using GPT.

Command (? for help): v

Warning! Mismatched GPT and MBR partition! MBR partition 4, of type 0x0A,
has no corresponding GPT partition! You may continue, but this condition
might cause data loss in the future!

Identified 1 problems!

Command (? for help): 

Moving into the recovery menu and typing o and p to get MBR and GPT lists the following:

    Recovery/transformation command (? for help): o

Disk size is 468862128 sectors (223.6 GiB)
MBR disk identifier: 0x4F5D06CB
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1       409639   primary     0xEE
   2                409640    137128391   primary     0xAF
   3      *      284540928    468860927   primary     0x07
   4             137128392    284540927   primary     0x0A

Recovery/transformation command (? for help): p
Disk /dev/sda: 468862128 sectors, 223.6 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): AEF39373-7FA0-4FD9-A968-99C6D20E9C8C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 468862094
Partitions will be aligned on 8-sector boundaries
Total free space is 2765 sectors (1.3 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       137128391   65.2 GiB    AF00  Fry
   3       137129984       266962943   61.9 GiB    8300  
   4       266962944       284540927   8.4 GiB     8200  
   5       284540928       468860927   87.9 GiB    0700  ROBOFRY

where:

  • GPT 1 is EFI under MBR 1
  • GPT 2 is MacOS under MBR 2
  • GPT 3 and 4 are Linux eOS and swap under MBR 4
  • GPT 5 is W7 under MBR 3

My questions:

  • Did I accidentally destroy my grub bootloader forcing rEFInd to use the EFI stub loader? How can I repair the linux menu item in rEFInd to point back to grub instead of W7?
  • Is my Hybrid MBR set up correctly?
  • Edit: do I even need to use a hybrid MBR?
1

do I even need to use a hybrid MBR?

To boot Windows 7, yes -- at least, if your installations are all on one disk. Windows 8 and later can usually be installed in EFI mode on Macs, but Windows 7 is next to impossible to install in EFI mode. (I've heard of success stories, but they're difficult to do.) For Windows 7, booting in BIOS/CSM/legacy mode is the only way to do it reliably on a Mac, and that requires either an MBR or a hybrid MBR. If you wanted to boot Windows 7 from another physical disk, it could be a straight-up MBR disk and your main disk could be GPT, but if everything's on one disk, as yours is, then you need a hybrid MBR.

Is my Hybrid MBR set up correctly?

That's an almost philosophical question, since hybrid MBRs violate the GPT specification, so in a sense, any hybrid MBR is wrong. That said, your hybrid MBR is OK, but sub-optimal. There are two parts to this, really:

  • gdisk is warning you that MBR partition #4 spans two GPT partitions. This is something that Apple's software would not do, and it could create problems if other tools that manipulate hybrid MBRs don't expect such a configuration. (FWIW, I created gdisk, and I gave it the ability to set things up in this way in the interests of maximum flexibility; but such flexibility can lead people into trouble.) Your configuration works, and if you understand it and record data on it (like the gdisk output you've shown here) so you can re-create it, you should be OK with it as it is.
  • Your MBR partitions #2 and #4 cover OS X and Linux, respectively, neither of which needs or uses the hybridized partitions; both OS X and Linux look at the GPT side when shown hybrid MBR disks.

The first issue is only sort-of-kind-of a problem, but the second issue provides a possible way to create a cleaner configuration: Because Windows is the only OS with a partition that needs to be hybridized, and because it resides at the end of the disk, you could re-create your hybrid MBR to hold only the type-0xEE protective partition and the Windows partition. In this configuration, the type-0xEE protective partition will cover from sector 1 through the OS X and Linux partitions. This is a cleaner setup than what you've got and is less likely to confuse other tools. OTOH, changing the setup now might confuse Windows. In particular, if its MBR partition changes from #3, Windows might fail to boot. Thus, you risk a serious problem if you decide to address this one bit of weirdness in your current setup.

Did I accidentally destroy my grub bootloader forcing rEFInd to use the EFI stub loader? How can I repair the linux menu item in rEFInd to point back to grub instead of W7?

This one's tougher. As I understand it, you've got one entry that's identified as "eOS on ext4" that boots Windows, but that used to boot Linux through GRUB. This sounds like a BIOS-mode boot loader on an ext4 partition. This should be GRUB, and my suspicion is that it still is, but that the GRUB configuration has been changed to chainload to Windows without presenting the GRUB menu. If so, editing the GRUB configuration file (/boot/grub/grub.cfg), either directly or (better) by using GRUB's setup tools (the update-grub script or GRUB Customizer) might bring back the GRUB menu.

OTOH, it could be that rEFInd's description is misleading, or the Windows boot loader somehow got installed to the wrong partition. (Maybe Windows decided to put it there at some point when you were messing with the hybrid MBR setup?)

Because of the uncertainty, I'm unsure of how to recover a BIOS-mode GRUB (if that's what it was) to functionality. I could offer some suggestions, but I'm concerned that I might end up giving you advice that would end up creating new problems.

Thus, my inclination is to advise you to either ignore that entry or to use the dont_scan_volumes option in refind.conf to hide the mis-labeled entry and instead rely on the EFI stub loader to get into Linux. If you wanted a backup, installing an EFI version of GRUB could provide that, with the caveat that installing GRUB might cause a boot coup from which you'd need to recover.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.