How do you dual boot Debian and FreeBSD using GRUB2?

10,550

Append the following to your /etc/grub.d/40_custom replacing UUID with the UUID of the disk discovered with grub-probe -d /dev/sda2 -t fs_uuid

menuentry 'FreeBSD' {
   insmod ufs2
   insmod bsd

   search --fs-uuid --no-floppy --set=root UUID

   kfreebsd /boot/kernel/kernel
   kfreebsd_loadenv /boot/device.hints

   set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ufsid/UUID
   set kFreeBSD.vfs.root.mountfrom.options=rw
}

Note that for other distros and/or GRUB versions, kfreebsd might have to be changed to just freebsd.

Reference:

Share:
10,550

Related videos on Youtube

Fuyash Porchant
Author by

Fuyash Porchant

Updated on September 18, 2022

Comments

  • Fuyash Porchant
    Fuyash Porchant over 1 year

    I've been trying to install FreeBSD alongside my Debian installation in a single partition. All examples readily present on the Internet had shortcomings:

    1. Some required chainloading the FreeBSD chainloader in ways GRUB2 refused to accept with "invalid signature".
    2. Some assume you've installed FreeBSD inside a BSD disklabel.
    3. None of the solutions (including loading /boot/loader) boot after changing the order of the devices or moving them from server to server.
    4. None of the solutions work on Debian: The naming of the GRUB2 options on Debian seems to be different from e.g. Ubuntu.

    So how do I dual boot Debian and FreeBSD in the most reliable way?

    • Admin
      Admin over 11 years
      Instead of putting your answer in the question, please instead post it as an answer...
  • Admin
    Admin about 11 years
    I tried this. The first time the boot process stopped at a screen of many multi-colored squares blinking. Some with letters, some with extended ascii symbols. I went back and replaced --set=root UUID w/ --set root=UUID. This time I got three error msgs no argument specified, file not found, and you need to load the kernel first