# Stuck on EFI loader dual-boot MacOS and FreeBSD



## L0RDmomo (Jan 18, 2020)

Hi! This is my first time posting on the FreeBSD forums, so if there is any additional information I can provide or standard I overlooked please let me know. I am a Unix user and computer scientist, so feel free to get technical in any answers.

I am currently attempting to install FreeBSD on a 2011 8,2 MacBook Pro, with the goal of dual-booting alongside MacOS. I have previously successfully dual-booted Arch Linux on the same computer, and FreeBSD will be replacing Arch.

I have tried a few different things but have been unable to proceed beyond the 3rd stage of the boot process, the EFI loader.

I have been using a usb drive and the memstick (not bootonly) image as my installation media. I have not had any issues with booting the installation media or using the installer.

My first attempt was with 12.1-RELEASE. After completing installation using the auto-partitioner on the GPT main disk (efi, ufs, swap) alongside an existing MacOS installation, I rebooted and saw the something nearly identical to the following (exact taken from a later attempt using 11.2-RELEASE):


```
FreeBSD EFI boot block
Loader path: /boot/loader.efi

Initializing modules: ZFS UFS
BootCurrent: 0080
BootOrder: 0080[*]
Probing 11 block devices........*...+. done
ZFS found no pools
UFS found 2 partitions
Consoles: EFI console
Command line arguments: loader.efi
Image base: 0x85b12000
EFI version: 1.10
EFI Firmware: Apple (rev 1.10)

FreeBSD/amd64 EFI loader, Revision 1.1
(Fri Jun 22 04:20:29 UTC 2018 root@releng2.nyi.freebsd.org)
BootCurrent: 0080
BootOrder: 0080[*]
Setting currdev to disk1p4
Setting currdev to disk1p1
Setting currdev to disk1p2
Setting currdev to disk1p3
Setting currdev to disk1p4
Setting currdev to disk1p5
Failed to find bootable partition
press any key to interrupt reboot in 4 seconds
can't load 'kernel'
```

After some research around the forums, I attempted re-installation, manually creating a "freebsd-boot" partition. No luck. Additionally, I began encountering the "lua" loader bug and copied the loader from 11.2 and got back to the output above. Then, I switched over to using a 11.2-RELEASE image (default partitions, no freebsd-boot). Once again, I received the output above.

When I use the installation media as a LiveCD and mount the created partitions, I can see and access all files and the installation appears to be fully there, including created users. The EFI parition has both BOOTx64.efi and startup.nsh (which is located under disk1p4, seen using `ls disk1p4:/efi/boot` from the loader "OK" prompt.

From here I am not sure how to proceed with troubleshooting and addressing the issue. Any advice is greatly appreciated!


----------



## NapoleonWils0n (Jan 18, 2020)

Hi Mate

I wrote a guide on how to set up the EFI partition on Mac hardware

It might point you in the right direction
I run Freebsd 12 on a Macbook Air 11 inch 2011

To be honest i wouldnt even bother with installing Mac,
the latest release Crapalina is so bad its untrue

Mac OS should be renamed Nanny OS


----------



## L0RDmomo (Jan 18, 2020)

I have consulted that guide and implemented it already! It was very helpful for setting the default boot 

Unfortunately, it did not fix the issue described above. And while I share your sentiment regarding MacOS this computer needs to have that option.


----------



## NapoleonWils0n (Jan 18, 2020)

HI Mate

I dont know if using bootcamp to create the partition would help

The only other option i can think of is installing is install Mac osx on an external drive,
then holding down option at boot and booting into OSX

My Macbook Air 2011 only has USB2 so booting off an external drive is a bit slow

However if you boot osx on an external drive and then upgrade osx 
it will wipe the bootloader on the internal drive


----------



## Sevendogsbsd (Jan 18, 2020)

Is refind an option? I haven’t dual booted a Mac since my 5.x Pro days and never FreeBSD, only Linux.


----------



## JAW (Jan 19, 2020)

OP: Could you also post output from the following command;
`gpart list`

(+1 for using rEFInd, I use it on my MacBookAir 2015)


----------



## L0RDmomo (Jan 21, 2020)

I have installed refind and played around a bit with the conf file but it looks like the issue occurs after refind completes its task (locating and kicking off the boot loader). It always detects the FreeBSD loader as a "fallback" loader (not sure if this is standard or might shed some light on probable issues).

Here's the output from "gpart list" run using a liveusb. I only included the main disk, not the usb gpart was being run from. I used OCR to grab the output so if there are any weird characters / numbers or misspellings that is most likely the culprit.


```
Geom name: ada0
modified: false
state: OK
fwheads: 16
fwsectors: 63
last: 976773134
first: 34
entries: 128
scheme: GPT
Providers:
1. Name: ada0p1
Mediasize: 209715200 (200M)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 583319552
Mode: r0w0e0
efimedia: HD(1, GPT, ccfbca2b-3973-11ea-a117-3c07546c8e6c, 0x23116260,0x64000)
rawuuid: ccfbca2b-3973-11ea-a117-3c67546c8e6c
rawtype: c12a7328-f81f-11d2-ba4b-00a@c93ec93b
label: (null)
length: 209715200
offset: 301231030272 
type: efi index: 1
end: 588751455 
start: 588341856 
2. Name: ada0p2
Mediasize: 300371292160 (280G)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 209735680
Mode: r0w0e0
efimedia: HD (2, GPT, 76838f63-eac6-4ff7-99b7-7a975fbc5cf4,0x64028, 0x22f7c318)
rawuuid: 76838f63-eac6-4ff7-99b7-7a975fbc5cf4
rawtype: 53746f72-6167-11aa-aa11-00306543ecac
label: Untitled 
length: 300371292160 
offset: 209735680 
type: apple-core-storage 
index: 2 
end: 587072319
start: 409640
3. Name: ada0p3
Mediasize: 650002432 (626M)
Sectorsize: 512 
Stripesize: 
Stripeoffset: 4228284416 
Mode: r0w0e0
efimedia: HD(3,GPT, bcd9f6e1-f5d4-4165-952f-9a63f6c9effa, 0x22fe0340, 0x135f20)
rawuuid: bcd9f6e1-f5d4-4165-952f-9a63f8c9effa 
rawtype: 426f6f74-0000-11aa-aa11-00386543ecac
label: (null)
length: 650002432
offset: 300581027840
type: apple-boot
index: 3
end: 588341855
start: 587072320
4. Name: ada0p4
Media size: 194137554944 (181G) 
Sectorsize: 512
Stripesize: 0
Stripeoffset: 793034752
Mode: r0w0e0 
efimedia: HD(4, GPT, cd3044d1-3973-11ea-a117-3c07546c8e6c, 0x2317a260,0x1699c000) rawuuid: cd3044d1-3973-11ea-a117-3c07546c8e6c
rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b 
label: (null) 
length: 194137554944 
offset: 301440745472 
type: freebsd-ufs 
index: 4
end: 967926367
start: 588751456
5. Name: ada0p5
Mediasize: 4294967296 (4.0G) 
Sectorsize: 512 
Stripesize: 
Stripeoffset: 1657061376 
Mode: r0w0e0 
efimedia: HD(5, GPT, cd35c462-3973-11ea-a117-3c87546c8e6c, 0x39b16260, 0x800000)
rawuuid: cd35c462-3973-11e7-a117-3c87546c8ebc
rawtype: 516e7cb5-bect-11d6-8ff8-80022009712b
label: (null) 
length: 4294967296 
offset: 495578300416 
type: freebsd-swap 
index: 5 
end: 976314975
start: 967926368
```

Thank you all for your help!


----------



## Lamia (Jan 21, 2020)

That Lua error could be signalling data corruption and the way out is reinstallation.
I would have gone for freebsd-boot i.e. legacy boot with the (grub) dual boot machine. Legacy boot takes partition two i.e. failover when EFI in partition one won't work. 
If your system still boots MAC OS, I guess the boot partition for FreeBSD can't be read. Of course, EFI could be in any partition but not legacy freebsd-boot. 
I wiil take it that this machine already runs MAC and you now want to add FreeBSD. If you could try choose a priority boot in the BIOS with the FreeBSD EFI partition as your choice, that could tell you if all is well with the FreeBSD installation.

Otherwise, you may need try more tricks - install FreeBSD first then add MAC etc.


----------



## L0RDmomo (Jan 21, 2020)

Hey all, here's an update:

After all that I have tried, I began to suspect that the problem lay in the freebsd installer itself. I did a quick google of third-party installers and arrived at GhostBSD (PC-BSD and TrueOS successor). On the first try, installation completed and the system booted up without a hitch. Right now I'm going through the forums and fixing various niggles like the backlight, keyboard backlight, GPU switching, touchpad, and wifi. I may be posting a piece (either a how-to or question depending on how it goes) on the wifi in the near future.

I guess there is something in the FreeBSD installer that doesn't play nicely with Apple hardware or more likely, MacOS configured disks. I did see something about the installer potentially mislabeling Mac partitions in my journey through the forums and mailing lists looking for information. Either way, the solution appears to be installing using a slightly more robust piece of software.

Thank you all so much for your help!


----------



## Sevendogsbsd (Jan 21, 2020)

Glad you got it working! Keep in mind to not ask questions here about any other variant of FreeBSD - each of the ones you mentioned should have forums for support, I believe.


----------

