# Dualboot Fedora and FreeBSD with GRUB2



## Li Fo (Nov 1, 2016)

Hi guys!

I'm using laptop with UEFI, GRUB (2.02~beta3) and Fedora 24 on it. 
Yesterday I allocate space for the installation of FreeBSD  11. Everything were fine until I have started to add menu entry to GRUB. 
And here is my problem. GRUB can not find ufs module (insmod ufs or insmod ufs2), doesn't know "kfreebsd". Also "chainloader" with "+1", "/boot/loader" or "/boot/kernel/kernel".
Renstalling grub2-efi, grub2-efi-modules, shim and os-probe not work...


```
/dev/sda1: SEC_TYPE="msdos" UUID="F5B3-7A23" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="8e6bd39f-94d9-4b68-bc8c-070a4c93def4"
/dev/sda2: UUID="0dfbfde1-bdda-4bc1-8a1d-db9c2c436dc9" TYPE="ext4" PARTUUID="1d407b71-8916-4e82-822a-1489f6f0630a"
/dev/sda3: UUID="29ffa061-3297-47ec-b9db-030eddb52989" TYPE="swap" PARTUUID="6cf638b6-a49b-4e44-a344-9b82cf4f92d2"
/dev/sda4: UUID="58178c315ad96520" TYPE="ufs" PARTUUID="70ef023d-9fa5-11e6-b160-204747764c07"
/dev/sda5: UUID="612eee3e-93de-4166-bc97-31435205b6c2" TYPE="ext4" PARTLABEL="home" PARTUUID="13953edf-2bc9-40c7-92b7-3eae35529dc8"
/dev/sda6: UUID="5817a49bb3e5be02" TYPE="ufs" PARTUUID="97b612b0-9fa5-11e6-b160-204747764c07"
/dev/sda7: UUID="5817a49d1eb50e13" TYPE="ufs" PARTLABEL="freebsd-home" PARTUUID="a63390f3-9fa5-11e6-b160-204747764c07"
/dev/loop0: UUID="b62418da-bcd7-4495-a832-bb1c31c9deab" TYPE="xfs"
/dev/mapper/docker-8:2-921199-pool: UUID="b62418da-bcd7-4495-a832-bb1c31c9deab" TYPE="xfs"
/dev/sda8: PARTUUID="b0e3412e-9fa5-11e6-b160-204747764c07"
```


----------



## ASX (Nov 1, 2016)

Li Fo said:


> And here is my problem. GRUB can not find ufs module (insmod ufs or insmod ufs2), doesn't know "kfreebsd". Also "chainloader" with "+1", "/boot/loader" or "/boot/kernel/kernel".



As I understood from a different thread, grub2 support ufs but that support is optional and Fedora choose to not include that feature, same for kFreeBSD.

See if you can grab some help from this thread:
https://forums.freebsd.org/threads/58008/#post-331480


----------



## Li Fo (Nov 1, 2016)

ASX said:


> As I understood from a different thread, grub2 support ufs but that support is optional and Fedora choose to not include that feature, same for kFreeBSD.
> 
> See if you can grab some help from this thread:
> https://forums.freebsd.org/threads/58008/#post-331480




Thanks a lot!

I had to copy all from "/usr/lib/grub/x86_64-efi/" to "/boot/efi/EFI/fedora/x86_64-efi/". Just because files ufs2.mod and bsd.mod require lots of other *.mod files. The solution is pretty rough, but this works!

Also /etc/grub.d/40_custom looks like:

```
menuentry "FreeBSD" {
   insmod ufs2
   insmod bsd
   set root=(hd0,gpt6)
   chainloader /boot/boot1.efi
}
```


----------



## T-Daemon (Nov 1, 2016)

Li Fo said:


> I *had to copy* all from "/usr/lib/grub/x86_64-efi/" to "/boot/efi/EFI/fedora/x86_64-efi/". Just because files ufs2.mod and bsd.mod require lots of other *.mod files. *The solution is pretty rough*, but this works!


A soft link should have sufficed:

`ln -s /usr/lib/grub/x86_64-efi/ /boot/efi/EFI/fedora/x86_64-efi`


----------



## Li Fo (Nov 1, 2016)

T-Daemon said:


> A soft link should have sufficed:
> 
> `ln -s /usr/lib/grub/x86_64-efi/ /boot/efi/EFI/fedora/x86_64-efi`



Yes, this solution is better. But I'm installing GNOME in FreeBSD already. Too lasy to get back and regenerate configs


----------



## scottro (Mar 7, 2021)

Lately, I've been messing with having FreeBSD boot from Linux grub2. Li Fo's suggestion worked for me. I tried the symlink that T-Daemon suggested but got permission denied. (This is on Fedora 33). So I used rsync with 
	
	



```
rsync -avz /usr/lib/grub/x86_64-efi /boot/efi/EFI/fedora/
```
 and after that my custom grub entry worked. Mine reads

```
menuentry "FreeBSD" {
insmod ufs2
insmod part_gpt
set root=(hd0,4)
chainloader /boot/loader.efi
}
```

This is on a multiboot laptop. I did find that VoidLinux's version of Grub worked without having to move anything around.


----------



## Yampress (Mar 7, 2021)

How to install grub2 on FreeBSD
					

How to install grub2, which may be useful to run multiple systems described below. Of course, previously tested by me like everyone my faq.   THE WORKS  All I do the following as root.  Install grub 2 first. I do it with packages   pkg_add-r grub2   Prepares the directory structure  cd...




					forums.freebsd.org


----------

