Dual Boot with Grub on Linux

danaeckel

Active Member

Reaction score: 3
Messages: 107

Greetings,
I have been struggling trying to setup my system to use Grub2. I have a dual drive system with GPT. My sda drive is installed with Ubuntu 18.10, while my sdb has FreeBSD 12 formatted with UFS. How should I setup my Grub config?

Thank you!
 

T-Daemon

Daemon

Reaction score: 545
Messages: 1,171

[USER=784]drhowarddrfine[/USER], you missed the long description of the port sysutils/grub2-efi. If contains only the grub efi modules for EFI support, not the boot loader itself. :) The main boot loader port is sysutils/grub2.

[USER=30138]danaeckel[/USER], here is a minimal menu entry example for FreeBSD (in /etc/grub.d/40_custom - assuming you are configuring grub inside the Ubuntu installation).
Code:
menuentry "FreeBSD 12.0-RELEASE" {
          set root='(hd1,gpt2)’ 
          kfreebsd /boot/loader
}

hd1 - (sdb)
gpt2 - FreeBSD root partition.

Before setting the menu entry you can list all devices and partitions known to GRUB from grubs boot menu. Press “ c “ at the boot menu. This drops you to a command line, there execute ls .

If FreeBSD does not boot from grub, go to the FreeBSD menu entry, press " e ", edit the gpt number and retry (that way you don't need to configure the file, update-grub, reboot, every time). On success make the change permanent in the configuration file.
 

free-and-bsd

Aspiring Daemon

Reaction score: 110
Messages: 806

I just submitted a replacement for the deprecated sysutils/grub2. It is based on a recent enough snapshot (May, 2018), so it has the more or less up to date zpool features support etc. Don't know if that will be accepted, but it works fine for me.
 

emensee

New Member


Messages: 6

I have been trying to dual boot Linux and FreeBSD for quite sometime and finally got it working. The /etc/grub.d/40_custom entry in the linux (debian buster) install that worked for me is below. I set root to the efi partition installed by the FreeBSD installer. It can be found by hitting escape at the grub splash screen thereby going to the grub command line. Enter "ls (hd0 " then hit tab for tab completion which will list the disk partitions. A small (200mb) efi partition close to FreeBSD install should be listed. This partition in the below example is (hd0,gpt6). Change it to suit your installation.

Code:
Code:
menuentry "Freebsd 11.2" {
    set root='(hd0,gpt6)'
    chainloader (${root})/efi/boot/BOOTx64.efi
    boot
}

Don't put a space either side of the "=" sign. This alone cost me a lot of frustration. Use update-grub and reboot. Hope this helps someone.
 

penseleit

New Member


Messages: 1

Thanks.

That worked for me with FreeBSD installed on my NVME SSD (hd0):
  • EFI partition is (hd0,gpt1)
  • root (/) partition is (hd0,gpt2)
  • swap partition is (hd0,gpt3)
And my menu entry in /etc/grub.d/40_custom is:

Code:
menuentry "FreeBSD" {
    set root='(hd0,gpt1)'
    chainloader (${root})/efi/boot/BOOTx64.efi
    boot
}
 

F1R3-R4H

Member

Reaction score: 1
Messages: 26

Something rare happened to me: I was fighting for install freebsd 1X.x in my netbook, and when I boot, almost see that the USB has 13-Amd64; the strange was that I have x32 bits, don't know if my Linux Mint was programmed for this processor arch and I have another...
But going to the point: how should I configure which file for boot mine installation? See:
cat /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "FreeBSD 12.0-RELEASE" {
set root='(hd1,gpt2)’
kfreebsd /boot/loader
}
 
Top