Solved Unable to "bless" FreeBSD 13 boot file on a Mac Mini (Late 2012)

I want to create a dual boot system on a Mac Mini (late 2012, model A1347, Macmini6,2) with macOS in the internal HDD and FreeBSD 13 on an external HDD.

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. But when I try to follow the final steps to "bless" and make the FreeBSD 13 HDD bootable on a Mac and try to run mount -t msdos /dev/disk3s1 /Volumes, I get the error mount_msdos: Unsupported sector size (37251).

I am not sure what to do next. How do I resolve this and make the disk bootable on a Mac?
 
It's a mismatch with the disklabel on /dev/disk3s1 and its partition table (sector/block sizes).
Can you run diskutil from the Mac's Utilities disk/Installer and see if the diskutil info shows for "block size"
I'm guessing the 37251 mentioned is the block size it's detecting. That's an odd size, because it should be 512 or 4096 bytes.
FreeBSD has diskinfo -c /dev/disk3s1 (or whatever FreeBSD calls the disk device name) to show you its sector size.

That's all I can suggest. Perhaps it's a start?
 
Last edited:
The block size / sector size is 512 on both diskutil and diskinfo.

And the exact error I get on macOS is: mount_msdos: Unsupported sector size (33467) (In the first post, I made up the number "37251" as I didn't recall it).
 
Actually the error "Unsupported sector size (?????)" is misleading. Looking at the code, it's actually the bytes per sector.
Apple defines this as a maximum of 4096. Something DEFINITELY in the boot sector is screwed up. This is your problem.

Does gpt show disk3 show any weird numbers?
 
msplsh : I didn't create a macOS installer. Since I want a dual boot system and am installing FreeBSD 13 on an external drive, I am just booting again into macOS Mojave (10.14.6) and trying to "bless" the FreeBSD bootfile from there.

mark_j : I have no idea what to look for exactly.

I am using a 1 TB notebook HDD and connecting it to the Mac Mini via a SATA-USB cable. This is what macOS shows about the drive after I have installed FreeBSD 13 on it:

$ diskutil list

Code:
$ /dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk3
   1: 83CD6B9D-7F42-14EC-BE0B-001860B85F0F               524.3 KB   disk3s1
   2:               FreeBSD Swap                         2.1 GB     disk3s2
   3: 5A6E7CBA-6EEF-11D6-8FA8-00032D09722B               998.1 GB   disk3s3

$ diskutil info /dev/disk3s1

Code:
$ Device Identifier:         disk3s1
   Device Node:               /dev/disk3s1
   Whole:                     No
   Part of Whole:             disk3

   Volume Name:               Not applicable (no file system)
   Mounted:                   Not applicable (no file system)
   File System:               None

   Partition Type:            83CD6B9D-7F42-14EC-BE0B-001860B85F0F
   OS Can Be Installed:       No
   Media Type:                Generic
   Protocol:                  USB
   SMART Status:              Not Supported
   Disk / Partition UUID:     82E6B749-2050-11AC-8C70-644B35D35543
   Partition Offset:          20480 Bytes (40 512-Byte-Device-Blocks)

   Disk Size:                 524.3 KB (524288 Bytes) (exactly 1024 512-Byte-Units)
   Device Block Size:         512 Bytes

   Read-Only Media:           No
   Read-Only Volume:          Not applicable (no file system)

   Device Location:           External
   Removable Media:           Fixed

$ gpt show disk3

Code:
       start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34           6         
          40        1024      1  GPT part - 83CD6B9D-7F42-14EC-BE0B-001860B85F0F
        1064         984         
        2048     4194304      2  GPT part - 5A6E7CBA-6EEF-11D6-8FA8-00032D09722B
     4196352        2044         
     4198396  1949325312      3  GPT part - 5A6E7CBA-6EEF-11D6-8FA8-00032D09722B
  1953523708        1423         
  1953525131          32         Sec GPT table
  1953525163           1         Sec GPT header
 
mark_j : I have no idea what to look for exactly.

Me neither ;), but I have seen if the GPT EFI stuff gets corrupted GPT SHOW will display a message.
$ gpt show disk3

Code:
       start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34           6        
          40        1024      1  GPT part - 83CD6B9D-7F42-14EC-BE0B-001860B85F0F
        1064         984        
        2048     4194304      2  GPT part - 5A6E7CBA-6EEF-11D6-8FA8-00032D09722B
     4196352        2044        
     4198396  1949325312      3  GPT part - 5A6E7CBA-6EEF-11D6-8FA8-00032D09722B
  1953523708        1423        
  1953525131          32         Sec GPT table
  1953525163           1         Sec GPT header

That looks ok.

Can you show what the GPTs (primary and secondary are)? gdisk -l /dev/disk3
 
Can you share the hexdump -C -n 1048576 /dev/disk3 ? If it's too long please attach it instead of just pasting it here.
 
diskutil is showing that you don't have an EFI partitition on /dev/disk3. It should show up as Type EFI with Name EFI. That's your problem there, so the issue is how you selected the partitioning scheme in the FreeBSD installer.
 
diskutil is showing that you don't have an EFI partitition on /dev/disk3.

I followed the instructions in the wiki, and chose Guided Disk Setup during installation (Auto Guided UFS / Auto Guided ZFS in FreeBSD 13 installer) - tried both UFS and ZFS but face the same issue with both. If you believe that's the issue, please guide me on how to manually create the EFI partition, the Swap partition and the Root partition in the FreeBSD 13 installer and I will try that too.

Can you show what the GPTs (primary and secondary are)?

$ gdisk -l /dev/disk3

Code:
GPT fdisk (gdisk) version 1.0.8

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/disk3: 1953525164 sectors, 931.5 GiB
Sector size (logical): 512 bytes
Disk identifier (GUID): 82E6B749-2050-11AC-8C70-644B35D35543
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 40, last usable sector is 1953525127
Partitions will be aligned on 8-sector boundaries
Total free space is 4448 sectors (2.2 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40            1063   512.0 KiB   A501  gptboot0
   2            2048         4196351   2.0 GiB     A502  swap0
   3         4198396      1953523707   929.5 GiB   A504  zfs0


Can you share the hexdump -C -n 1048576 /dev/disk3
Please see att: hexdump.txt.zip
 

Attachments

  • hexdump.txt.zip
    258.5 KB · Views: 111
What happens if you run sudo fsck_msdos -d disk3s1.

Code:
fsck_msdos: illegal option -- d
Option 'd' not recognized
Usage: fsck_msdos [-fnpqy] [-M <integer>[k|K|m|M]] filesystem ...

$ sudo fsck_msdos -p /dev/disk3s1

Code:
Invalid BS_jmpBoot in boot block: 31c98e

/dev/disk3s1: UNEXPECTED INCONSISTENCY; RUN fsck_msdos MANUALLY.
 
msplsh is right, you are missing EFI partition. s1 seems to be a bootcode for FreeBSD, i.e. FreeBSD was installed as if to have non-efi boot on GPT disk. You don't need this partition in pure EFI setup.
 
… macOS in the internal HDD and FreeBSD 13 on an external HDD. …

… create the EFI partition, the Swap partition and the Root partition in the FreeBSD 13 installer …

Choose GPT (UEFI) as pictured below, or GPT (BIOS+UEFI). The latter will be more broadly compatible with other computers.

1632970802729.png

Hints: give a distinctive name to the pool, and be generous with swap.
 
Choose GPT (UEFI) as pictured below, or GPT (BIOS+UEFI).

Damn! I didnt see your post in time and wasted my time manually typing and setting up the EFI and ZFS partition. 😩

By the way, can you clarify why I should be "generous with swap" ... ? I have 16 GB RAM so isn't a 2 or 3 GB swap size sufficient?

(Note for those following the instructions on "Manually Installing FreeBSD on ZFS" - it suggests that for FreeBSD 12 and above, you have to create a FAT32 partition for EFI. But they have missed that the 800K partition size they have used is not sufficient for this as formatting that as FAT32 - newfs_msdos -F 32 -c 1 /dev/ada0p1 - will give an error about there not being enough "clusters" ( newfs_msdos: 1542 clusters too few clusters for FAT32, need 65525 ). So for FreeBSD 12 and above, use gpart add -t efi -s 33M -a 4k -l "EFI System Partition" ada0, with 33 MB being the minimum size you can use.)

--------

Anyway, after finally completing the installation successfully (with a FreeBSD EFI partition), I tried to "bless" it again after logging into my installed macOS. But running:

sudo mount -t msdos /dev/disk3s1 /Volumes
sudo bless --mount /Volumes --setBoot --file /Volumes/efi/boot/bootx64.efi --shortform

gave the error:

Could not set boot device property: 0xe00002e2

The solution for me (as I didn't create a macOS installer) was to boot into macOS Recovery mode and run the above bless command from the macOS Recovery Terminal. It executed successfully without any errors and after restarting the system, the Mac Mini successfully recognized the FreeBSD EFI partition and tried to boot from it.

I say tried to because 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. (Do I need to create a separate thread to seek help for this new issue and troubleshoot that, or can we continue here?).
 
Video record the booting process with a smartphone, play back with slower speed.

I tried that - it's just a blur because it shows a blank screen initially while booting for a few seconds, and then the text appear and disappear within a second, and then its blank screen again. By the time the camera can correctly focus and capture, the text disappears.

EDIT:

efi-boot-txt.jpg


To the best of my ability, this is what I could make out:

Code:
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.

So it looks like the Mac Mini doesn't even boot start FreeBSD ...
 
On further research, according to 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.

Perhaps the issue is because I am using an external HDD and / or a SATA-USB cable to connect it?
 
Have you tried just installing on the external disk without blessing and boot FreeBSD from the Mac Boot Manager pressing the Option (⌥) or alt key at start up?

I have a MacBook Pro8,2 (15-inch, Early 2011). FreeBSD (Root-on-ZFS, partition scheme GPT UEFI, not blessed) installed on a external drive, appears in the Mac Boot Manager as "EFI Boot" disk and can be booted from there.

EFI version:
Code:
~ % /usr/libexec/firmwarecheckers/eficheck/eficheck --integrity-check
EFI Version: MBP81.88Z.F000.B00.1906132217
 
Problem is probably SIP now

 
Don't Macs use HFS+ as the filesystem, rather than MSDOSFS? I don't recall seeing successful examples of Macs dual-booting with anything. VM's, yes, dual-booting - nothing that I know of. Not out of question, but a rare bird indeed.
 
… isn't a 2 or 3 GB swap size sufficient? …

Not for your use case.

Given your use of macOS: I assume that you'll want at least a desktop environment, maybe much more, on FreeBSD.

… SIP …

Good thinking, however does the protection prevent Startup Manager from running in response to its startup key combination?

<https://support.apple.com/HT201255>

… macOS in the internal HDD and FreeBSD 13 on an external HDD. …

Don't Macs use HFS+ as the filesystem,

It's no longer the default.

The issue here revolves around FreeBSD and startup management, not macOS use of any file system.
 
Back
Top