# FreeBSD 13 booting with Grub



## shuveb (May 28, 2021)

Hello, Folks.

I have FreeBSD installed on the 5th partition of a GPT-based disk on a Mac Mini. In Grub, I have a custom menu entry file that looks like this:

```
menuentry "FreeBSD" {                                       
         insmod ufs2
         insmod part_gpt
         set root=(hd1,5)
         kfreebsd /boot/loader
         kfreebsd_loadenv /boot/device.hints
         set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ada0s5a
         set kFreeBSD.vfs.root.mountfrom.options=rw
}
```

When I choose the entry during boot, I just get a blank screen with no info or error messages. Any help would be great!

Thanks!


----------



## _martin (May 28, 2021)

Frankly I'd leave grub just to chainload to the FreeBSD bootloader and go from there, similar to what I suggested here: grub


----------



## balanga (May 28, 2021)

shuveb said:


> Hello, Folks.
> 
> I have FreeBSD installed on the 5th partition of a GPT-based disk on a Mac Mini. In Grub, I have a custom menu entry file that looks like this:
> 
> ...


I have the following and it works fine:-

```
menuentry "FreeBSD 13.0-RELEASE amd64 ***** STABLE default - use for XWindows ******  {
    insmod ufs2
    insmod part_gpt
    set root=(hd0,2)
    kfreebsd /boot/loader
}
```
Do you have two disks? Do you need those two set lines? It might be better to use gpt labels in your /etc/fstab


----------



## Vull (May 28, 2021)

Do you have a EFI partition on your disk? I've never been able to get kfreebsd to work for EFI booting, I have to use chainloader. I've just been going over my old notes for this. It's not uncommon to use GPT partitions and still do MBR type boots. In those cases, kfreebsd works fine. Since you're using bsdlabels, that suggests you're doing legacy booting, but I'm not sure.

For legacy boots, I use this style of menuentry... even with bsdlabels, I've never needed the /boot/device.hints...


```
menuentry "FreeBSD" {
      insmod ufs2
      root=(hd0,gpt5)
      kfreebsd /boot/loader
}
```

But for EFI booting, I have to use this type of menuentry:


```
menuentry "FreeBSD" {
      insmod ufs2
      root=(hd0,gpt5)
      chainloader /boot/loader.efi
}
```
Hope this helps. Good luck with it.


----------



## Alain De Vos (May 28, 2021)

If you have a freebsd boot partition you can chainload

```
menuentry "FREEBSD BOOT FROM BSDPMBR  " {
insmod part_gpt
insmod part_msdos
insmod ufs2
insmod chain
set root=(hd2)
chainloader (hd2)+1
}
```

If you don't have a freebsd boot partition you can directly load the kernel e.g.,

```
menuentry "FREEBSD DIRECTLY LOAD KERNEL" {
insmod part_gpt
insmod part_msdos
insmod ufs2
insmod bsd
set root=(hd2,gpt2)
kfreebsd /boot/kernel/kernel
kfreebsd_loadenv /boot/device.hints
set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ada2p2
set kFreeBSD.kern.vty=vt
}
```


----------



## shuveb (May 29, 2021)

Vull said:


> Do you have a EFI partition on your disk? I've never been able to get kfreebsd to work for EFI booting, I have to use chainloader. I've just been going over my old notes for this. It's not uncommon to use GPT partitions and still do MBR type boots. In those cases, kfreebsd works fine. Since you're using bsdlabels, that suggests you're doing legacy booting, but I'm not sure.
> 
> For legacy boots, I use this style of menuentry... even with bsdlabels, I've never needed the /boot/device.hints...
> 
> ...



Yes, I do have an EFI partition and that seems to have been the issue. I needed to chainload /boot/loader.efi. I think you're right that's probably the reason the kfreebsd directive wasn't working.

Thanks a lot. I now have FreeBSD 13 booting from Grub!


----------

