# FreeBSD 13 not Booting from External HDD on Mac Mini (Late 2012)



## sifar (Oct 1, 2021)

I have successfully managed to install FreeBSD 13 on an external HDD on a Mac Mini (Late 2012) and "bless" the FreeBSD EFI partition to make it bootable (thanks to the help from forum members here). But the Mac Mini still doesn't seem to recognize and boot FreeBSD from the external disk. The Mac Mini doesn't even look for the FreeBSD boot loader and complains about it







To the best of my ability, this is what I could decipher from the blurred text:


```
APFSStart: 1555: Mounting with apfs_efi_osx-945.275.13
efi_fusion_pairing: 666: Container 5dddf306-Deee-4385-8395c5fc2f1f95c3
efi_fusion_pairing: 673: fusion uuid 00000000-0000-0000-000000000000
efi_container_create: 972: Volume attached is internal
nx_kernel_mount: 1473: : checkpoint search: largest xid 2964289, best xid 2904289
 @ 106
er_state_obj_get_for_recovery: 4214: No ER state object for volume Preboot
 - rolling is not happening, nothing to recover
sanity_check_allocated_blocks: 243: fs_alloc_count mismatch: fs root nodes 153936
extent 9572 #### 2214 snap_meta 1 er: 0 udata: 214445955 fs_alloc_count 21610040
er_state_obj_get_for_recovery: 4214: No ER state object for volume Macintosh HD -
 rolling is not happening, nothing to recover.
er_state_obj_get_for_recovery: 4214: No ER state object for volume Recovery -
 rolling is not happening, nothing to recover.
er_state_obj_get_for_recovery: 4214: No ER state object for volume VM -
 rolling is not happening, nothing to recover.
```

After I select the FreeBSD disk to boot, there is a blank screen for a few seconds. Then this text appears and disappears in a second and then the screen remains blank.

On further research, this article on the _bless _tool - Booting the Mac: bless, and what makes a volume bootable :



> One final requirement which is sometimes forgotten, but which can stop any of this from happening, is that the hardware – the Mac’s interface and the drive enclosure (for external disks) – must support booting that Mac. Some drive cases offer connections such as USB 3 or Thunderbolt which cannot be used to boot through, even though many other external drives use the same connection very successfully. This affected some who tried to install early betas of macOS Mojave on external drives, for example, although in most cases the installation failed. Changing the interface used and the connection can often work around these quirks.



suggests that perhaps the issue is because I am using an external HDD and / or a SATA-USB cable to connect it? If so, can we somehow use the bootloader that is used to create the FreeBSD USB installers / Live disks instead?


----------



## msplsh (Oct 1, 2021)

sifar said:


> I do not think so - SIP comes to picture only after macOS boots. This seems more like a firmware issue.



You found the website I was going to link but you did not take the website's advice: Disable SIP and try again.


----------



## grahamperrin@ (Oct 2, 2021)

What's above might be more a part of the previous thread. 

This, I believe, was a point of separation (enlarged to draw attention) that fits the subject line:



sifar said:


> … FreeBSD 13 couldn't load for some reason - the boot loading messages appear and disappear too fast to make any sense of it, and finally shows only a blank screen. FreeBSD 13 seems to just hang there after. _…_



Can you share a recording of the messages? 

Hint: VLC playback of the recording should allow you to pause and take _snapshots_ of relevant frames.

I'll not object to blurring


----------



## sifar (Oct 2, 2021)

msplsh said:


> You found the website I was going to link but you did not take the website's advice: Disable SIP and try again.



The article is suggesting disabling SIP only if you want to use the _bless_ tool from within macOS. SIP is only applicable within macOS, not outside it. That is why you can run the _bless_ tool from other sources - like from a macOS installer or from macOS Recovery Mode like I did. 



grahamperrin said:


> Can you share a recording of the messages?



I have - the first post includes the relevant screenshot from boot video. (That's all there is - I have just inverted the colours to make the text black on white and sharpened the image to try and make the text more legible). And the text I have transcribed from the screenshot is what is displayed briefly on the screen for a second.


----------



## T-Daemon (Oct 2, 2021)

You said in the previous Thread 82219:


sifar said:


> As per the instructions on the "Apple Intel Mac mini support on FreeBSD" wiki I created a bootable FreeBSD installer and successfully installed FreeBSD 13 on the external HDD.


From which machine have you installed FreeBSD, from the Mac mini or on another machine? If on another machine, have you tried booting the USB FreeBSD installer on the Mac mini?


----------



## sifar (Oct 2, 2021)

T-Daemon said:


> From which machine have you installed FreeBSD, from the Mac mini or on another machine? If on another machine, have you tried booting the USB FreeBSD installer on the Mac mini?



I Installed FreeBSD to the external HDD on Mac Mini using the USB FreeBSD installer.

--------------

Suspecting the issue is because of the notebook HDD + SATA-USB cable that I was using, I tried a different proper external drive with a normal USB 3 cable.

After installing and blessing the FreeBSD boot file, I again faced the same issue - the same flash of text (as posted in the first post) and then a blank screen. This time however, I got distracted by something else and focused on another task. Suddenly after maybe 5 minutes or so, I noticed something else appear on screen:





and after another minute or so, the FreeBSD logo appeared and it seemed to be booting:





The booting begins but finally spews some error and goes into single user boot recovery mode:





I am confused about the error `Can't open `dev/da1p1`` as `gpart show` on FreeBSD boot recovery shows only 2 drives - ada0 and da0 ... what next?

----------

(*Note*: I can't be sure that the reason the Mac Mini detected / executed the FreeBSD boot loader this time is because of the different drive / interface I used. In the previous attempt with the notebook HDD + SATAUSB cable, I didn't wait for a long time after the first errors. I however did note a difference - with the previous drive, I always had to press the OPTION button when powering on the mini to go to the _Mac Mini Startup Manager_ and select the FreeBSD disk to boot into it. But now, Mac Mini always boots into the FreeBSD disk after I selected it one time.)


----------



## grahamperrin@ (Oct 2, 2021)

Thanks for clarifying. What's pictured in the opening post is difficult for me to relate to any aspect of FreeBSD.

The three pictures above are ideal.

Whilst using the same physical connections to hardware, and the same range of devices, please:

boot FreeBSD in single user mode
key Return or Enter (to get the command prompt) then run the commands below and take photographs.
`gpart show da1`
`cat /etc/fstab`
`tunefs -p /`

The third command is probably inappropriate (given use of ZFS), still I'd like to see the output. Thanks.


----------



## T-Daemon (Oct 2, 2021)

sifar said:


> and after another minute or so, the FreeBSD logo appeared and it seemed to be booting:


That's very good, it means FreeBSD can boot on the Mac mini.


sifar said:


> The booting begins but finally spews some error and goes into single user boot recovery mode:


That is nothing to worry about. The issue here is in FreeBSD /etc/fstab. The ESP on /dev/da1p1 mounted on /boot/efi and swap on /dev/da1p2 can't be found because of device name changes (now da2, disk2p1 on the Mac). This can be easily fixed by changing `/dev/da1p1` into `/dev/gpt/efiboot0` and for swap `/dev/da1p2` into `/dev/gpt/swap0`. You can display the partition labels and provider names executing `gpart show -lp da2`.

To edit /etc/fstab the file system needs to be mounted read/write. At the loader prompt execute:

```
# zfs set readonly=off zroot/ROOT/default
edit /etc/fstab
execute
# exit
```

Please show the exact command you used to bless the external drive.


----------



## T-Daemon (Oct 2, 2021)

T-Daemon said:


> Please show the exact command you used to bless the external drive.


If you mounted the FreeBSD EFI partition for blessing on /Volumes as before:


sifar said:


> sudo mount -t msdos /dev/disk3s1 /Volumes


you are mounting probably atop of partitions mounted on /Volumes, partitions OSX ... and Preboot. That might be the cause of the blessing failure.

To bless the external drive try the following approach:








						freebsd bless efi partition on mac hardware
					

A normal freebsd install on mac hardware uses legacy boot so it takes 30 seconds for the boot screen to appear, we can bless the efi partition and reduce the start up time to a couple of seconds  Preperation  1 - plug in a usb drive to your mac and then run the mac installer and select your...




					forums.freebsd.org


----------



## sifar (Oct 2, 2021)

T-Daemon said:


> you are mounting atop of partitions mounted on /Volumes, partitions OSX ... and Preboot. That might be the cause of the blessing failure.



Ok, I tried again after creating the ESP directory on /Volumes and mounting and blessing the FreeBSD partition on it from macOS Recovery. (I however did not disable SIP). The result was the same - the Mac starts booting, displays the flash of text complaining about the EFI, does something or nothing for 2 minutes, then loads the FreeBSD bootloader from the FreeBSD EFI, again does something or nothing for a minute, and then starts booting FreeBSD. (So basically the exact things I described in this post.)



grahamperrin said:


> I'd like to see the output ...



`root@:/ # gpart show da1`


```
gpart: No such geom: da1
```

`root@:/ # cat /etc/fstab`


```
#Device          Mountpoint       FStype       Options       Dump      Pass#
/dev/da1p1       /boot/efi        msdosfs      rw            2         2
/dev/da1p2       none             swap         sw            0         0
```

`root@:/ # tunefs -p /`


```
tunefs: /: could not open special device
```




T-Daemon said:


> You can display the partition labels and provider names executing `gpart show -lp`.



The GPT partition labels on da0 are: _efiboot0_ (da0p1), _swap0_ (da0p2), _zfs0_ (da0p3).


----------



## sifar (Oct 2, 2021)

T-Daemon said:


> To edit /etc/fstab the file system needs to be mounted read/write ...



I edited fstab as suggested and now FreeBSD boots fine and displays the login prompt!

One issue remains - The Mac Mini still takes around 3 minutes or so before it starts booting FreeBSD. This is quite irritating.


----------



## T-Daemon (Oct 2, 2021)

Try rEFInd without installing it, see if it makes a difference in the boot speed.


----------



## grahamperrin@ (Oct 2, 2021)

sifar said:


> … takes around 3 minutes or so before it starts booting FreeBSD …



This thought might be disconnected, but maybe try using efibootmgr(8) to make FreeBSD the default. 

I hesitate because I have used the utility so rarely. 

If you set a preference whilst booted from FreeBSD at (say) `da0p3`, then it might become necessary/appropriate for the external disk to be always the first found i.e. `0` for the preference to have the required effect. (Someone please correct me if I'm wrong.) In simple terms, unplug disks other than the FreeBSD boot disk before starting the Mac.

The general idea, hopefully sane, is a swift boot of FreeBSD by default; and for whenever you want macOS, there's the key for Apple's Startup Manager.


----------

