Booting FreeBSD 12 on an iMac

outpaddling

Member

Reaction score: 19
Messages: 80

I recently installed FreeBSD 12.0 on two older iMacs. dmidecode info from one of them:

BIOS Information
Vendor: Apple Inc.
Version: IM91.88Z.008D.B08.0904271717
Release Date: 04/27/09
ROM Size: 4096 kB
Characteristics:
PCI is supported
BIOS is upgradeable
BIOS shadowing is allowed
Boot from CD is supported
Selectable boot is supported
ACPI is supported
IEEE 1394 boot is supported
Smart battery is supported
Function key-initiated network boot is supported
BIOS Revision: 0.1

Handle 0x000F, DMI type 1, 27 bytes
System Information
Manufacturer: Apple Inc.
Product Name: iMac9,1
Version: 1.0
Serial Number: H00126VQDWY

Installation proceeded without any issues on both of them and both will boot FreeBSD without any 3rd party boot menu (just hold Alt/Option during startup and select the FreeBSD partition from the bootable icons that appear.

Only problem is I cannot figure out how to select FreeBSD as the startup disk. It does not appear as an option when choosing a startup disk in OS X System Preferences and the bless commands I've found on the web don't help either.

Anyone know if this is possible and how to do it?

Thanks,

Jason
 

Beastie7

Well-Known Member

Reaction score: 170
Messages: 415

You may need to change the EFI boot manager entirely to do this. To my knowledge, the default EFI boot manager on macs doesn't support non-macOS systems as the startup disk. If Apple provided boot camp support for FreeBSD then you should be able to select your newly created partition as the startup disk from system preferences - but that's yet to be seen.

Something like rEFInd would need to be installed first for you to do something like this.
 

NapoleonWils0n

Active Member

Reaction score: 50
Messages: 155

I recently installed FreeBSD 12.0 on two older iMacs. dmidecode info from one of them:

BIOS Information
Vendor: Apple Inc.
Version: IM91.88Z.008D.B08.0904271717
Release Date: 04/27/09
ROM Size: 4096 kB
Characteristics:
PCI is supported
BIOS is upgradeable
BIOS shadowing is allowed
Boot from CD is supported
Selectable boot is supported
ACPI is supported
IEEE 1394 boot is supported
Smart battery is supported
Function key-initiated network boot is supported
BIOS Revision: 0.1

Handle 0x000F, DMI type 1, 27 bytes
System Information
Manufacturer: Apple Inc.
Product Name: iMac9,1
Version: 1.0
Serial Number: H00126VQDWY

Installation proceeded without any issues on both of them and both will boot FreeBSD without any 3rd party boot menu (just hold Alt/Option during startup and select the FreeBSD partition from the bootable icons that appear.

Only problem is I cannot figure out how to select FreeBSD as the startup disk. It does not appear as an option when choosing a startup disk in OS X System Preferences and the bless commands I've found on the web don't help either.

Anyone know if this is possible and how to do it?

Thanks,

Jason
Hi Mate

I wrote a guide on how to bless the efi partition on the mac so it boots into Freebsd automatically after 3 or 4 seconds,
without having to hold down alt

If you install Freebsd 12 with the bios+uefi option it should automatically boot into Freebsd

Im pretty sure you can't use the OSX System Preferences to set Freebsd as the start up disk,
you need to bless the efi partition
 
OP
OP
O

outpaddling

Member

Reaction score: 19
Messages: 80

That's awesome, thanks! I assume this same procedure should work on a dual-booted system, Mac OS X and FreeBSD on the same hard disk. One of my iMacs is FreeBSD-only, so I'll try this trick to eliminate the 30-second delay. On the other I shrunk the El Capitan partition via Disk Utility and installed FreeBSD on the freed up space. Problem is it won't boot into recover mode from the hard disk. :-/ Not sure when I'll have time to go at this again, but I'll follow up if I discover anything new.
 

NapoleonWils0n

Active Member

Reaction score: 50
Messages: 155

That's awesome, thanks! I assume this same procedure should work on a dual-booted system, Mac OS X and FreeBSD on the same hard disk. One of my iMacs is FreeBSD-only, so I'll try this trick to eliminate the 30-second delay. On the other I shrunk the El Capitan partition via Disk Utility and installed FreeBSD on the freed up space. Problem is it won't boot into recover mode from the hard disk. :-/ Not sure when I'll have time to go at this again, but I'll follow up if I discover anything new.
Hi Mate

It should work on a dual boot but i havent tried to be honest

The 30 second delay is because there isnt a blessed efi partition and so falls back to legacy boot,
you can hold down option at boot and the freebsd partition will show up and then you can click on it but thats a pain

You can install osx onto a usb stick and then plug that in and hold down alt to boot up from the usb drive
and then use osx on the external drive to bless the efi partition on the internal drive

I helped another user on the forum who had exactly the same problem as you and blessing the efi partition worked for them,
i think they may have been using an iMac as well

Let me know if you need any help more than happy to talk you through the steps if you get stuck
 
OP
OP
O

outpaddling

Member

Reaction score: 19
Messages: 80

Thanks, I'm good. I know exactly what you're saying. They only thing I hadn't realized is that you have to disable SIPS for the bless command to work. Waiting 30-seconds for a reboot once a month doesn't really bother me. The inability to boot FreeBSD by default on the dual-booted system is an issue, though. I was also unable to install refind because I could not boot into recovery mode and disable SIPS, so my next step is to fix the recovery mode issue regardless. I think this is purely an OS X issue. Thanks again...
 

NapoleonWils0n

Active Member

Reaction score: 50
Messages: 155

Thanks, I'm good. I know exactly what you're saying. They only thing I hadn't realized is that you have to disable SIPS for the bless command to work. Waiting 30-seconds for a reboot once a month doesn't really bother me. The inability to boot FreeBSD by default on the dual-booted system is an issue, though. I was also unable to install refind because I could not boot into recovery mode and disable SIPS, so my next step is to fix the recovery mode issue regardless. I think this is purely an OS X issue. Thanks again...
HI Mate

You can't boot into the recovery partition on your dual boot set up,
what you can do is install osx onto a usb drive or thumb stick, that will create a recovery partition on the external usb drive
which you can use to disable sips

The other thing you can do is create a bootable usb installer for the mac,
which you can boot up from and then use the terminal in the installer to disable sips and bless the efi partition

heres the apple documentation on how to create a bootable usb installer

Plug in the usb drive hold down alt and boot into the mac osx installer,
what you do is go to the screen where it ask you to select the drive to install osx onto to

In the menu at the top of the screen there is an option to open the terminal,
which you can use to disable sips and bless the efi partition, after you bless the efi partition you can re enable sips if you want

Then you exit the mac osx installer without installing mac osx and reboot and freebsd should boot automatically
 
OP
OP
O

outpaddling

Member

Reaction score: 19
Messages: 80

Finally had a chance to look into this. It's been a brutal month...

Here's a log of exactly what I did:

In FreeBSD, run
gpart list
to determine EFI partition (disk 0, partition 1 in this case)
Boot from installer USB (El Capitan)
Immediately open Terminal from utilities menu (no need to go to disk selection screen)
csrutil disable
Quit Terminal
Restart from Apple menu
Boot into installer USB again
Open Terminal
mkdir /Volumes/ESP
mount -t msdos /dev/disk0s1 /Volumes/ESP
bless --mount /Volumes/ESP --setBoot --file /Volumes/ESP/efi/boot/BOOTx64.efi -
umount /Volumes/ESP

Note that case differs from your instructions. This is what shell autocomplete produced. It probably doesn't matter since it's an MSDOS filesystem.
Quit Terminal
Restart from Apple menu - no immediate boot
Power off, power on - booted FreeBSD with no delay

Thanks very much for providing the detailed instructions!
 
OP
OP
O

outpaddling

Member

Reaction score: 19
Messages: 80

Hmm, so I found that this doesn't work on the dual boot system. The success above refers to my FreeBSD-only iMac. I was able to bless the FreeBSD partition (disk0s4 in this case) but it still boots OS X by default. Any suggestions? Thanks again...
 

trev

Aspiring Daemon

Reaction score: 175
Messages: 806

Two suggestions:

1. Hold down the Option/ALT key when booting and choose FreeBSD (it shows as an EFI option)
2. If the FreeBSD boot partition shows up in macOS, select it for the Startup Disk in Preferences
 
OP
OP
O

outpaddling

Member

Reaction score: 19
Messages: 80

Thanks, but that's what I've been doing all along and would prefer not to have to do. I.e. I'd like FreeBSD to boot by default and to hold Alt if I want OS X instead.
 
OP
OP
O

outpaddling

Member

Reaction score: 19
Messages: 80

#2 doesn't work. OS X won't recognize the FreeBSD partition as a potential boot device. Sorry I forgot to address that.
 

NapoleonWils0n

Active Member

Reaction score: 50
Messages: 155

I only have a 128gb internal hard drive on my old Macbook air,
so i have always performed a full install of either linux or unix on the internal drive and not a dual boot

It is possible to install Mac os on an external and then hold down alt at boot and select the Mac drive to boot into osx

But there is a big issue with Dual booting Mac osx from an external drive

Updating Mac osx on the external drive will also update the EFI partition on the internal drive,
which will then wipe the Freebsd or Linux bootloader and mean you wont be able to boot into the os on the internal drive

This has happened to me several times over the years, running arch, debian or freebsd on a macs internal drive,
and mac osx on an external drive and then updating osx on the external drive

The only way to fix the issue is to boot from an external usb running freebsd or linux and then fix the efi partition

This issue can happen can occur when doing a major update from one version of osx to a newer version,
or just doing a minor incremental update.
There is no information in the Mac software updates that tell you if the EFI partition is going to be updated as well

I would imagine that this would also happen if you are dual booting mac and freebsd from the same internal drive as well

The only safe way to work around this issue is to keep Mac os installed on the internal drive,
and install Freebsd on an external hard.
 

trev

Aspiring Daemon

Reaction score: 175
Messages: 806

Another method:

When you use the option key at startup to select the drive, you can press the Control key when selecting the disk. The Mac remembers that for future boots.
 

mfletcher

New Member


Messages: 1

I just tried NapoleonWils0n's method on my MacPro 3 1 and it worked a charm! The only issue I had was booting into recovery mode to do the csrutil disable step. For some reason when trying this on the usb stick containing osx, nothing would happen and then the device would reboot into osx normally.

My workaround to this was to basically two internal disks in my mac pro - disk 1 was the freebsd install, disk 2 was the os x install. Once the bless step was complete id shutdown the device and pull disk 2 and restart. Freebsd would boot normally with no delay.
 
Top