Bug 982847 - os-prober should indicate that grub should chainload the OS X bootloader
Summary: os-prober should indicate that grub should chainload the OS X bootloader
Alias: None
Product: Fedora
Classification: Fedora
Component: os-prober
Version: 20
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Hedayat Vatankhah
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2013-07-10 02:52 UTC by Chris Murphy
Modified: 2013-11-23 09:08 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2013-11-23 09:08:21 UTC
Type: Bug

Attachments (Terms of Use)

Description Chris Murphy 2013-07-10 02:52:23 UTC
Description of problem: After installing Fedora 18, 19, rawhide, the OS X boot options in GRUB2 don't work. Proposal is for mactel-boot to cause anaconda to create /etc/default/grub with GRUB_DISABLE_OS_PROBER="true".

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Reboot after installing e.g. Fedora 19 and in the grub menu choose any of the OS X boot options.

Actual results:
No options work, stale bug 903937. Even if that bug is fixed, then stale bug 904668 applies. Even if that's fixed, the mactel-boot creation of an hfs+ /boot/efi ESP causes os-prober to consider it as a valid OS X volume and two entries are added to the grub menu for them as well.

Expected results:
No OS X entries in grub because none of them are working and there's no traction on fixing them. By offering OS X as a boot option, the user reasonably expects they should work and it gives the initial impression that their OS X system no longer works (and that Fedora broke it). So it's better to just remove the options IMO.

Additional info:

Comment 1 Hedayat Vatankhah 2013-07-10 13:23:11 UTC
I wonder if this is something that should be fixed in os-prober. os-prober is just an OS Prober. It doesn't tell grub how to boot the OS. I think grub2 should know how to boot OS X (in the scripts which parse os-prober's output). Is there any information about the OS which is not provided by os-prober?

Comment 2 Chris Murphy 2013-07-10 16:42:34 UTC
To fox rather than suppress:
os-prober needs to recognize the mactel-boot created ESP isn't a genuine OS X installation, so prevent bogus entries from being added to grub.cfg.

grub-mkconfig needs to be modified to chainload Apple's boot.efi instead of using grub's (non-working) boot loader module for xnu. 

Aside: Apple appears to change how xnu loads in every release, and I think the last time the grub2 xnu module could boot OS X was 10.5 or at best 10.6. That's 4+ years ago. The two current releases 10.7 and 10.8 (release 2 years and 1 year ago respectively) kp with grub's xnu bootloader. So maybe this is better taken up with grub2 upstream again, and propose either fixing and maintaining the xnu module, or chainloading the Apple one? Can either of you think of an advantage of using grub's xnu bootloader rather than chainloading Apple's?

Comment 3 Hedayat Vatankhah 2013-07-10 17:47:59 UTC
Since I don't have access to any Macs, would you please give the output of os-prober in such a system, and what is the expected output? :P 
Also, what is the difference between mactel-boot created ESP and genuine OS X installation?

Comment 4 Chris Murphy 2013-07-10 17:59:19 UTC
(In reply to Hedayat Vatankhah from comment #3)
> Since I don't have access to any Macs, would you please give the output of
> os-prober in such a system, and what is the expected output? :P

If you have a specific command for os-prober output you'd like to see, let me know. Otherwise I'll do a bash -x on grub2-mkconfig with os-prober not suppressed in /etc/default/grub and you can see the whole interaction.

> Also, what is the difference between mactel-boot created ESP and genuine OS
> X installation?

OS X itself doesn't use an EFI System partition. But its Disk Utility, when formatting any disk as GPT, creates a conventional FAT32 ESP. So far, this ESP is only used for staging firmware updates supplied by Apple. It's not used for booting. However, the firmware startup disk manager won't list boot loaders on an FAT32 ESP located on non-removable media. So the mactel-boot ESP is hfs+ and also contains grub.efi renamed as /System/Library/CoreServices/boot.efi which is identical to how the OS X bootloader is named/located. That way the firmware is tricked into thinking it's the OS X bootloader, therefore it's displayed as a boot option both by the firmware's startup manager as well as the OS X System Preferences Startup disk panel. And I'm leaving out a lot of details. But this is likely why os-prober thinks the mactel-boot ESP contains a bootable OS X instance.

Comment 5 Chris Murphy 2013-07-10 18:14:29 UTC
Actually bash -x on grub2-mkconfig doesn't reveal what's going on in /etc/grub.d/30_os-prober which contains a lot of OS X specific code, including xnu sleep/resume code.

What I get for os-prober is:
[root@f19s ~]# os-prober
/dev/sda2:Mac OS X:MacOSX:macosx
/dev/sda4:Mac OS X:MacOSX1:macosx

sda2 is a legit install, and sda4 is the mactel-boot produced ESP. I get two entries for each (a 32bit and 64bit option). I guess that distinction is one advantage to grub's xnu bootloader, for some time the 64bit kernel is used by default by Apple, however there's little use case now for 32bit xnu since vendors have long updated their kexts to 64bit.

Comment 6 Hedayat Vatankhah 2013-07-10 18:53:19 UTC
Thank you for the description, and the output. Now, the problem is how os-prober can detect an ESP compared to a real OSX installation? 
All that might be fixed in os-prober is to remove the non-real entry (the second line in your output). All the rest (e.g. chainloading) should be fixed in grub2 and is not related to os-prober. 
So, no working OSX entry is actually a grub2 bug. os-prober bug is detecting mactel-boot ESP.
The first bug is the same as bug #893179. The second is new, and I need help for fixing it (or it should be fixed in os-prober upstream!).

Comment 7 Chris Murphy 2013-07-10 19:01:42 UTC
This bug was mainly about punting by removing the bogus entries by disabling os-prober on Apple installs. It's sort of a brut force hammer (other installed linux systems would also not be found as a result). But if the idea is to actually fix the existing bugs, then I'm fine with closing this one and filing the various aspects of this bug with their proper counterparts.

Comment 8 Fedora End Of Life 2013-09-16 14:27:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 20 development cycle.
Changing version to '20'.

More information and reason for this action is here:

Comment 9 Hedayat Vatankhah 2013-11-23 09:08:21 UTC
Well, if you want proposing disabling os-prober you should probably open a report against anaconda. But, I'd suggest creating reports for each problem separately to help solving the problem. Personally, I think creating working entries AND non-working entries is better than not creating any entries.

I'd be glad to help detecting ESP.

Note You need to log in before you can comment on or make changes to this bug.