On 12 March 2016 at 22:59, joshua stein <[email protected]> wrote:
> I used the built-in Disk Utility in Mac OS X to slice off a new FAT
> partition, and then booted the OpenBSD installer and changed the
> partition type in fdisk to OpenBSD to install to it.
>
> Because Disk Utility creates a hybrid MBR and not just a single
> protective EE partition that takes up the whole disk, the logic in
> fdisk and the kernel treated it as an MBR disk instead of GPT.  This
> caused the installer to not mount the EFI partition and copy
> bootx64.efi to it, making it unbootable.
>
> fdisk -v sd0:
>
> Primary GPT:
> Disk: sd0       Usable LBA: 34 to 490234718 [490234752 Sectors]
> GUID: 1588ef13-c415-4473-b63e-c6307a0054a9
>    #: type                                 [       start:         size ]
>       guid                                 name
> ------------------------------------------------------------------------
>    0: EFI Sys                              [          40:       409600 ]
>       73e39ada-3f6e-41d6-9cc4-41cc3a8bd7ed EFI System Partition
>    1: 53746f72-6167-11aa-aa11-00306543ecac [      409640:    420761992 ]
>       2aa0ce41-f07d-4a46-a420-69d1dfa5cc1f mac
>    2: MacOS X boot                         [   421171632:      1269536 ]
>       abbdba88-85ec-4c46-8693-32b9f6c6be02 Recovery HD
>    3: DOS FAT-12                           [   422441168:     67531400 ]
>       0af6ad7b-423b-4c65-ae93-78c4a75ef14e DOS_FAT_32_Untitled_3
>
> Secondary GPT:
> Disk: sd0       Usable LBA: 34 to 490234718 [490234752 Sectors]
> GUID: 1588ef13-c415-4473-b63e-c6307a0054a9
>    #: type                                 [       start:         size ]
>       guid                                 name
> ------------------------------------------------------------------------
>    0: EFI Sys                              [          40:       409600 ]
>       73e39ada-3f6e-41d6-9cc4-41cc3a8bd7ed EFI System Partition
>    1: 53746f72-6167-11aa-aa11-00306543ecac [      409640:    420761992 ]
>       2aa0ce41-f07d-4a46-a420-69d1dfa5cc1f mac
>    2: MacOS X boot                         [   421171632:      1269536 ]
>       abbdba88-85ec-4c46-8693-32b9f6c6be02 Recovery HD
>    3: DOS FAT-12                           [   422441168:     67531400 ]
>       0af6ad7b-423b-4c65-ae93-78c4a75ef14e DOS_FAT_32_Untitled_3
>
> MBR:
> Disk: sd0       geometry: 30515/255/63 [490234752 Sectors]
> Offset: 0       Signature: 0xAA55
>             Starting         Ending         LBA Info:
>  #: id      C   H   S -      C   H   S [       start:        size ]
> -------------------------------------------------------------------------------
>  0: EE      0   0   2 -     25 127  14 [           1:      409639 ] EFI GPT
>  1: AC     25 127  15 -  26216 183  63 [      409640:   420761992 ] <Unknown 
> ID>
>  2: AB  26216 184   1 -  26295 190  23 [   421171632:     1269536 ] MacOS X 
> boot
>  3: A6  26295 190  24 -  30499  97  22 [   422441168:    67531400 ] OpenBSD
>
>
> I was able to fix this by using the 3rd party gptfdisk program in OS
> X to wipe out the hybrid MBR and instead create just a protective EE
> partition taking up the whole disk.  This forced OpenBSD to see the
> disk as GPT, but then of course it panicked trying to mount root
> because it couldn't find an OpenBSD partition in the GPT label,
> since it still had a type of DOS/FAT (since fdisk was previously
> operating on it as an MBR disk and only changed it to A6 in the
> MBR).
>
> I think the logic in fdisk and the kernel to figure out whether a
> disk is GPT or MBR should not require only a single protective EE
> over the whole disk to consider it GPT.  What would be the scenario
> where a disk has an EE partition of any size, along with other MBR
> partitions, and a valid GPT, but we want to keep talking to it as
> MBR?
>

The non-support for Hybrid MBRs was a deliberate choice and there are
no plans to open that can of worms. Hybrid MBRs are not part of the
GPT/UEFI standard as far as I can discover, and almost everything
Google turns up on the intertubes says DON'T DO IT!!

The only scenario they seem to be used in is on Intel Macs to allow
the dual booting of Windows versions so old that they need to be
fooled into thinking that they are booting on a BIOS system.

Not being a Mac OS X Disk Utility guru I can't say for sure but I can
read some of the docs as saying the Hybrid MBR is only created when
you create a DOS FAT partition. So my first suggestion would be to try
creating the new partition as something else like HFS+ and changing it
to A6 with GPT editing during install.

My second suggestion would be to notice that the installer is offering
MBR partitioning and forcibly flip it to GPT mode by editing the MBR
to have a single EE partition spanning sectors 1 to <size-1>. i,e.
manually create a protective MBR. The existing GPT should be revealed.
Then do the requisite GPT editing to change the DOS FAT GPT partition
to A6. No need for another tool to clear out the MBR when you can do
it manually in a few commands.

My third suggestion is that having cleared out the MBR with that third
party tool and thus made the GPT visible to the installer, you just
re-install, editing the DOS FAT partition into an A6 partition.

My fourth suggestion is that you simply edit the GPT to make the DOS
FAT partition A6 and then run installboot to place the boot files in
the EFI partition.

One or more of these should get you booting.

.... Ken

Reply via email to