# FreeBSD and Linux dual boot



## bsmith (Apr 4, 2017)

I have a new Dell Inspiron 15 3000 with Debian Linux.  I've done some research with mixed results.  I currently have Debian installed but I'd like to dual boot.  I normally do my partitioning with gparted live but read that it won't work with BSD.  I have and old IBM Thinkpad that I installed FreeBSD on but my wifi wasn't compatible.  I really like FreeBSD but I also like Debian.

I've read some discouraging things about dual booting and things I don't understand.  One thing I need to know how to do is partition and also what is the difference between a slice and a partition?  What file system do I use?  One thing I read is to use lilo instead of grub.  Any other information is appreciated.


----------



## Maxnix (Apr 4, 2017)

bsmith said:


> I have a new Dell Inspiron 15 3000 with Debian Linux.  I've done some research with mixed results.  I currently have Debian installed but I'd like to dual boot.  I normally do my partitioning with gparted live but read that it won't work with BSD.


I think that who wrote that gparted doesn't work with the BSDs meant that there is not a port of it for them. This doesn't mean that you can't partition a hard drive with gparted and then use the freed space to install FreeBSD (or whatever you want).


bsmith said:


> I've read some discouraging things about dual booting and things I don't understand.  One thing I need to know how to do is partition and also what is the difference between a slice and a partition?


What in the Linux and Windows worlds is referred as a partition, on FreeBSD is called slice. The slice then will contain your partitions.


bsmith said:


> What file system do I use?  One thing I read is to use lilo instead of grub.  Any other information is appreciated.


What filesystem to use is up to you: you can choose beetween UFS2 or ZFS. Regarding the bootloader I have a multiboot on my laptop, and use GRUB installed on FreeBSD.


----------



## Terry_Kennedy (Apr 4, 2017)

bsmith said:


> I've read some discouraging things about dual booting and things I don't understand.


A lot of dual-boot problems were caused by operating systems assuming that they "owned" the whole drive. The classic case was Windows and anything else, 20-ish years ago. Some of us still have the scars. Modern operating systems are better-behaved, as long as they know where their limits are.


> One thing I need to know how to do is partition and also what is the difference between a slice and a partition?


A slice is what Windows traditionally called a partition (how confusing is that - but the *BSDs were using "partition" long before MS-DOS decided to use that name for something else). That's the MBR 4 primary partitions plus optional extended partitions that started with MS-DOS 2.0.

A partition is what FreeBSD carves its part of the disk (which could be the space inside a MBR partition, or a whole physical drive, etc.) into. Traditionally there were up to 8 *BSD partitions, named a through h. a was traditionally the root filesystem, b was the swap space, c was the whole disk (reserved for use by system tools) and d through h were assigned to things like /usr, /tmp, etc. A lot of this was because in "the old days" disks were small (an RK07 was a whopping 27MB!) and by putting everything in its own partition, a runaway process that filled the partition wouldn't bring the system to a complete standstill due to "out of space" errors. These days, it is only mandatory to have two partitions, root and swap (swap does I/O directly and not through a filesystem, which is why it needs to be separate). A more common layout is three partitions - root, swap, and "everything else"). These will generally be named something like ada0s1a, where ada is the name of the physical device (Linux generally calls everything "sd" while FreeBSD is more specific - both systems have advantages and disadvantages), 0 is the unit number (first disk drive), s1 is the first slice (MBR partition), and a is the first FreeBSD partition in that slice.

GPT lets you create as many or as few partitions as you like. They'll be named something like ada0p7. ada is still the disk type and 0 is still the unit number, but now we number partitions starting at p1 or higher (if this is a UEFI system, the low partition numbers will probably be used by UEFI for its own purposes).


> What file system do I use?


I think you said this is a laptop. If that's the case, you don't need any of the features ZFS brings, so you should probably use UFS for your root partition and any other partitions that will be dedicated to FreeBSD. If you plan on exchanging data with the other operating system (Linux reading data from a FreeBSD partition or vice versa), you'll want a partition that is well-supported by both operating systems for both reading and writing. Plain old FAT msdosfs(5) will work for this. ext2fs(5) might work better. In either case, if you are using MBR format you should probably use a separate MBR partition (called a slice by FreeBSD as mentioned above). That way Linux won't have to mount something inside the FreeBSD slice in read-write mode, which increases the chance for an "oops" moment clobbering something else by accident). If your system uses GPT, this can just be a separate GPT partition as both Linux and FreeBSD understand those.


> One thing I read is to use lilo instead of grub.  Any other information is appreciated.


There are folks here who dual boot, I'm not one of them. Hopefully one of them will reply shortly.


----------



## fscorrea (Apr 4, 2017)

I've been using FreeBSD for almost an year now, and Linux dual-booting all this time. First along with Arch Linux, then replaced it for Ubuntu 16.04 last october.



bsmith said:


> I normally do my partitioning with gparted live but read that it won't work with BSD


You'll need unpartitioned space on which FreeBSD will be installed. I suppose you don't have free space for no reason so you'll shrink some of your Debian partitions. GParted will do this just fine (I used it myself). Now you do have some free space. Suppose Debian is partitioned like this:

/dev/sda1 (/)
/dev/sda2 (/home)
/dev/sda3 (swap)

And that the disk is full. Then something has to be shrinked. Let's say you shrink each of them to half its original size, then allign them to the left. That could be troublesome as moving and resizing partitions should be done with caution. You can easily Google about this matter. After that, you'll end up with something like:

/dev/sda1 (/)
/dev/sda2 (/home)
/dev/sda3 (swap)
Unallocated Free Space

From this point onward GParted will be of no use. Download FreeBSD image from the website and burn it to a pendrive. Boot from USB so to run the bsdinstaller. Proceed to the partitioning step. Four options will be presented. Choose "Manual". Now it depends whether you have GPT or MBR. If you have GPT I probably forgot a /boot partition in the aforementioned scheme. I do have MBR so that's what I can help you with _a priori_. Once you select "MBR" you'll have your current partitioning on screen:

ada0 MBR ---> you can think of that as the Linux sda equivalent
ada0s1 ext4 ---> that's first slice on ada0 disk, therefore ada0s1. It's basically what Debian called /dev/sda1
ada0s2 ext4 ---> likewise, for /dev/sda2
ada0s3 linux-swap ---> "former" /dev/sda3
You'll also have an amount of free space under ada0. use the arrow keys to select it, then "create". "Type" will be "freebsd", as indicated. "Size" can be the whole free space unless you have plans for a triple-boot anytime soon. Leave the "mountpoint" empty and "OK".

There you go: ada0s4 was created, with a "BSD" label before it. Select it and you'll notice you can partition the slice itself. That's the "tricky" part I suppose, but you just have to remember that the BSD slice can be further partitioned whereas the other can not (or, at very least, should not).

For your first partition "under" ada0s4, let's have the root. Change the size accordingly and type "/" as the mountpoint. The partition type is "freebsd-ufs". Once you're done you'll have an ada0s4a. That is:

ada0 disk
fourth slice, which is also a BSD label
partition 'a' where you'll mount the root
Repeat the process but choose "/home" as the mountpoint. I think you know what I mean and, this time, you'll have added ada0s4b. Its type is "freebsd-ufs" as well. As for the size, leave some room for the swap (hint: you can just forget about it then manually set up Debian swap partition as swap editing /etc/fstab). This last partition has a "freebsd-swap" type and its mountpoint should be left blank. It maybe skips a letter (e.g. being ada0s4d instead of ada0s4c) or at least it does in my computer, but makes no difference. Once you have all these created, go to "finish" then "commit". Proceed with the installation normally.

Now there is a little problem: you'll need a second USB stick with a copy of GRUB installed on it. The point is, you'll have the BSD bootloader overwriting GRUB. You can try skipping it and having GRUB probe FreeBSD without this step but I couldn't do it. Therefore, you'll need to select "yes" at the very end, when the installer asks if you want to open a shell to perform further modifications before reboot. Once in the shell, enter these two commands:

```
boot0cfg -B ada0
gpart bootcode -b /boot/mbr ada0
```
Then reboot. You'll see BSD bootloader, but won't have your Debian. In order to fix this, boot from the USB stick having the GRUB copy. Beware the copy will switch disks labeling and you'll have to Google about booting from GRUB prompt. Once you've done it, there's a last piece of work to do: modify GRUB configuration files so to add freebsd as an option and recognize it. Debian is fond of `os-prober` but that alone won't do the job. You must edit the files yourself, then grub will probe "an unknown linux at /dev/whatever". Provided that:

This "unknown linux at /dev/something" is probed;
You edited correctly the files so to add a freebsd entry at the menu and its parameters for chainloading are also correct;
grub was reinstalled to /dev/sda (`# grub-install /dev/sda`) and reconfigured (`# grub-mkconfig -o /boot/grub/grub.cfg`)
There you have it: a Linux/BSD dual-boot.

I know it sounds confusing but it's not really that hard. Even if you have a GPT scheme, consider using this as a starting point. I'm sure it's just as possible.

Good luck.


----------



## scottro (Apr 4, 2017)

It's usually fairly straightforward, but I haven't used efi, so if you're using it, I dunno.
I've not had to use bootcfg, but on my multiboot setup I had Fedora's grub. 
I cover it on my page at http://srobb.net/grub2.html

Just look for FreeBSD on the page.


----------



## bsmith (Apr 4, 2017)

Thanks for all the great responses and all the helpful information.  You've certainly provided me with more than enough to get going.  I have  a 1TB hd and I have a huge home so it's easy to use as much as I want since I don't download any big files or store anything big on it.  I am waiting for my new computer because my other "new" computer had to be sent back and they wound up giving me an identical new one with Debian pre-installed. (Not that I need the help)  I really, really like FreeBSD and I don't know why more people don't use it.  I have heard there's a steep learning curve but I am more than willing to read all the information I can.  And judging from these great responses I'm sure this board will prove to be a valuable asset.

Thanks again


----------



## Deleted member 9563 (Apr 5, 2017)

bsmith said:


> I have a new Dell Inspiron 15 3000 with Debian Linux. I've done some research with mixed results. I currently have Debian installed but I'd like to dual boot. I normally do my partitioning with gparted live but read that it won't work with BSD. I have and old IBM Thinkpad that I installed FreeBSD on but my wifi wasn't compatible. I really like FreeBSD but I also like Debian.



I've fooled a lot with dual booting a long time ago but personally don't think it is of any use nowadays. Waiting for a modern OS to shutdown and then starting another one is a huge waste of time. Life is too short. Use two computers. In this case to make that possible just stick a $10 compatible USB dongle in your Thinkpad and you're good to go.



Maxnix said:


> I think that who wrote that gparted doesn't work with the BSDs meant that there is not a port of it for them. This doesn't mean that you can't partition a hard drive with gparted and then use the freed space to install FreeBSD (or whatever you want).



Exactly. The OS on the CD is irrelevant to the effectiveness of the tool.


----------



## bsmith (Apr 5, 2017)

The thing is that the thinkpad is a 2005.  It's clunky and it's slow.  My new computer is a really good, fast laptop with touchscreen and other features.  And like I said it has a 1TB hd so just one OS is a waste of space.  I've wanted to mess with a number of distros so I can 
learn even more.  Before I had planned on installing arch alongside Debian but that was before I tried BSD.  Plus I can always create a bunch of extended partitions.  And I could never get wifi to work with a wifi dongle for the thinkpad.  Free BSD is well documented but to me personally it is geared towards people that already have a certain level of knowledge.  But even so I was able to get it working with a full DE and all the features I want without having to ask questions.  And I really like a challenge.  Plus the only other computers I have are notebooks.  One with Kubuntu and the other is a chrome book.  I installed Kubuntu because I wanted to have something that would work out of the box so I always have something to fall back on.  I know this will be challenging but like I said I like challenges because it's the best way to learn.   And I don't mind dual booting.  One thing I have is plenty of time.

I appreciate your advice but I'd like to try dual booting.  If I can't get it working or I don't like it I can always look at other options

Thanks for the advice.


----------



## fscorrea (Apr 7, 2017)

Like I said,m I'm satisfied, and working, IT'd be nice if I could help others to do the same but not so simple


----------



## bookwormep (Apr 8, 2017)

Post #4 above is very well outlined and detail explained. I would only offer an alternative if Grub, or GRUB2 is established on the Debian partitions. That is a Debian file: /etc/grub.d/40_custom. You can use a chainloader command and add a menuentry to the Grub listing.


```
menuentry "FreeBSD" {
set root='(hd0,3)'
chainloader +1
}
```

Note: The '(hd0,3)' is your hard drive hd0 leave that as it is; but, '3' is your unallocated free space at partition position 3 on that hard drive. [Assumes that sda1 is Debian root partition, and sda2 may be an extended partition, then sda5 is probably linux-swap; and that unallocated free-space is at position 3.]

Then, run:

```
# chmod 755 /etc/grub.d/40_custom
# update-grub
```

You can install FreeBSD with the bsdinstaller and likely use "Auto" option when it detects the unallocated free-space for you to install a fresh FreeBSD. Check the sizes, should match.

Hope this helps


----------



## fscorrea (Apr 8, 2017)

Personally, I think dual/triple/n-tuple boot is still preferable than, for example, virtualization. Ideally one would have two (or more) computers, of course, but that's not always a possible solution.

It's about personal taste, but I'm not fond of notebooks. In fact, I regret not being able to fully use FreeBSD features due to hardware restrictions. I'd try something I don't like that much on a Thinkpad, yes (like RHL, CentOS or Fedora). But for FreeBSD I came right to the dual booting "solution".

Since I'm on a home PC, I tend to spend a considerable amount of time using e.g. Ubuntu, then back to FreeBSD and vice-versa. I use a NTFS partition for sharing some data and (so far) it's working just fine. That avoids too many reboots.



bookwormep said:


> I would only offer an alternative if Grub, or GRUB2 is established on the Debian partitions


Thanks for pointing this out, I forgot to say: Every mention I did to "GRUB" refers to GRUB*2*.




bookwormep said:


> ```
> menuentry "FreeBSD" {
> set root='(hda0,3)'
> chainloader +1
> ...


That should do the trick. Note that your Debian entries will boot from hda0 as well. Regarding external GRUB backup installs, it has failed to me more than once because it thinks your USB Stick is hda0. In order to fix it, boot from a GRUB prompt replacing hda0 for hda1 (or whatever number your BIOS decides on) and leaving the rest as is. Once inside Debian, do as bookwormep told and it should be fine.


----------



## emensee (Mar 21, 2019)

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 partiton close to FreeBSD install should be listed. This partition in the below example is (hd0,gpt6). Change it to suit your installation.


```
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.


----------



## bookwormep (Mar 23, 2019)

Updated to be used with FreeBSD-12.0-RELEASE and dual-booting Debian-10 Buster and Grub2:
/etc/grub.d/40_custom

```
menuentry "FreeBSD-12.0" {
set root='(hd0,3)'
kfreebsd /boot/loader
}
```

Like post#10 (in this thread) edit made: 23 March 2019


----------



## Zar Marco (Mar 28, 2019)

Sorry if I write in this thread, but I thinked that I had never motive for open new trhred. On my laptop I've installed arch-gentoo-void with btrfs partition and efi partition. Yesterday I've installed freebsd with auto partitioning so I've freebsd efi partition, root bsd with ufs2 and bsd swap. Can I use grub on arch for boot of freebsd? My grub on arch is with uuid


----------



## balanga (Mar 28, 2019)

I'd prefer grub.cfg to be present on a ufs partition so I can edit it in FreeBSD without having to boot up Linux just to change something. What would I need to do to activate grub using this partition? Not really sure where the grub loader lives...

This looks helpful, but I'm not sure how I would change the grubloader on a GPT disk...presumably installing FreeBSD's grub would overwrite the existing grubloader and allow it to load grub.cfg from a ufs partition.


----------



## Vull (Mar 28, 2019)

Zar Marco said:


> Sorry if I write in this thread, but I thinked that I had never motive for open new trhred. On my laptop I've installed arch-gentoo-void with btrfs partition and efi partition. Yesterday I've installed freebsd with auto partitioning so I've freebsd efi partition, root bsd with ufs2 and bsd swap. Can I use grub on arch for boot of freebsd? My grub on arch is with uuid


It would be best to use grub on arch, because grub2 on FreeBSD is deprecated and no longer recommended for use.

Are you still able to boot Arch now, or can you only boot FreeBSD? If you can boot the Arch installation on your hard drive, perhaps by using a USB drive, then you can configure the Arch version of grub to boot both systems.


----------



## Zar Marco (Mar 28, 2019)

Yes, I can entry on my arch system, this is my grub.cfg 

```
zar_marco@legionbook:~ % cat grub.txt
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod btrfs
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
else
  search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
fi
    font="/@arch/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=it_IT
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
insmod part_gpt
insmod btrfs
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
else
  search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
fi
insmod gfxmenu
loadfont ($root)/@arch/boot/grub/themes/StylishDark/unifont-regular-16.pf2
insmod jpeg
insmod png
set theme=($root)/@arch/boot/grub/themes/StylishDark/theme.txt
export theme
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod btrfs
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
        else
          search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
        fi
        echo    'Caricamento Linux linux...'
        linux   /@arch/boot/vmlinuz-linux root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 rw rootflags=subvol=@arch  resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa
        echo    'Caricamento ramdisk iniziale...'
        initrd  /@arch/boot/initramfs-linux.img
}
submenu 'Opzioni avanzate per Arch Linux' $menuentry_id_option 'gnulinux-advanced-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
        menuentry 'Arch Linux, con Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_gpt
                insmod btrfs
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
                else
                  search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
                fi
                echo    'Caricamento Linux linux...'
                linux   /@arch/boot/vmlinuz-linux root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 rw rootflags=subvol=@arch  resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa
                echo    'Caricamento ramdisk iniziale...'
                initrd  /@arch/boot/initramfs-linux.img
        }
        menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_gpt
                insmod btrfs
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
                else
                  search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
                fi
                echo    'Caricamento Linux linux...'
                linux   /@arch/boot/vmlinuz-linux root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 rw rootflags=subvol=@arch  resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa
                echo    'Caricamento ramdisk iniziale...'
                initrd  /@arch/boot/initramfs-linux-fallback.img
        }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# 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 'Gentoo GNU/Linux dracut' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
        load_video
        if [ "x$grub_platform" = xefi ]; then
                set gfxpayload=keep
        fi
        insmod gzio
        insmod part_gpt
        insmod btrfs
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
        else
          search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
        fi
        echo    'Caricamento Linux x86_64-5.0.4-gentoo...'
        linux   /@gentoo/boot/vmlinuz-5.0.4-gentoo root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro rootflags=subvol=@gentoo  resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa
        echo    'Caricamento ramdisk iniziale...'
        initrd  /@gentoo/boot/intel-ucode.img /@gentoo/boot/initramfs-5.0.4-gentoo.img
}

submenu 'Opzioni avanzate per Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
menuentry 'Gentoo GNU/Linux dracut 4.20.12' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
        load_video
        if [ "x$grub_platform" = xefi ]; then
                set gfxpayload=keep
        fi
        insmod gzio
        insmod part_gpt
        insmod btrfs
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
        else
          search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
        fi
        echo    'Caricamento Linux x86_64-4.20.12-gentoo...'
        linux   /@gentoo/boot/vmlinuz-4.20.12-gentoo root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro rootflags=subvol=@gentoo  resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa
        echo    'Caricamento ramdisk iniziale...'
        initrd  /@gentoo/boot/intel-ucode.img /@gentoo/boot/initramfs-4.20.12-gentoo.img
}

menuentry 'Gentoo GNU/Linux dracut series 5.0.2' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
        load_video
        if [ "x$grub_platform" = xefi ]; then
                set gfxpayload=keep
        fi
        insmod gzio
        insmod part_gpt
        insmod btrfs
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
        else
          search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
        fi
        echo    'Caricamento Linux x86_64-5.0.2-gentoo...'
        linux   /@gentoo/boot/vmlinuz-5.0.2-gentoo root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro rootflags=subvol=@gentoo  resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa
        echo    'Caricamento ramdisk iniziale...'
        initrd  /@gentoo/boot/intel-ucode.img /@gentoo/boot/initramfs-5.0.2-gentoo.img
}

    menuentry 'Gentoo GNU/Linux, kernel 4.20.6-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
                load_video
                if [ "x$grub_platform" = xefi ]; then
                        set gfxpayload=keep
                fi
                insmod gzio
                insmod part_gpt
                insmod btrfs
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
                else
                  search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
                fi
                echo    'Caricamento Linux x86_64-4.20.6-gentoo...'
                linux   /@gentoo/boot/vmlinuz-4.20.6-gentoo root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro rootflags=subvol=@gentoo  resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa
                echo    'Caricamento ramdisk iniziale...'
                initrd  /@gentoo/boot/intel-ucode.img /@gentoo/boot/initramfs-4.20.6-gentoo.img
        }

        menuentry 'Gentoo GNU/Linux, con Linux x86_64-4.20.0-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-4.20.0-gentoo-advanced-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
                load_video
                if [ "x$grub_platform" = xefi ]; then
                        set gfxpayload=keep
                fi
                insmod gzio
                insmod part_gpt
                insmod btrfs
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
                else
                  search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
                fi
                echo    'Caricamento Linux x86_64-4.20.0-gentoo...'
                linux   /@gentoo/boot/kernel-genkernel-x86_64-4.20.0-gentoo root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro rootflags=subvol=@gentoo  resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa
                echo    'Caricamento ramdisk iniziale...'
                initrd  /@gentoo/boot/intel-ucode.img /@gentoo/boot/initramfs-genkernel-x86_64-4.20.0-gentoo
        }
        menuentry 'Gentoo GNU/Linux, con Linux x86_64-4.20.0-gentoo (modalità ripristino)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-4.20.0-gentoo-recovery-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
                load_video
                if [ "x$grub_platform" = xefi ]; then
                        set gfxpayload=keep
                fi
                insmod gzio
                insmod part_gpt
                insmod btrfs
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
                else
                  search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
                fi
                echo    'Caricamento Linux x86_64-4.20.0-gentoo...'
                linux   /@gentoo/boot/kernel-genkernel-x86_64-4.20.0-gentoo root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro single rootflags=subvol=@gentoo
                echo    'Caricamento ramdisk iniziale...'
                initrd  /@gentoo/boot/intel-ucode.img /@gentoo/boot/initramfs-genkernel-x86_64-4.20.0-gentoo
        }
        menuentry 'Gentoo GNU/Linux, con Linux x86_64-4.19.10-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-4.19.10-gentoo-advanced-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
                load_video
                if [ "x$grub_platform" = xefi ]; then
                        set gfxpayload=keep
                fi
                insmod gzio
                insmod part_gpt
                insmod btrfs
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
                else
                  search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
                fi
                echo    'Caricamento Linux x86_64-4.19.10-gentoo...'
                linux   /@gentoo/boot/kernel-genkernel-x86_64-4.19.10-gentoo root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro rootflags=subvol=@gentoo  resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa
                echo    'Caricamento ramdisk iniziale...'
                initrd  /@gentoo/boot/intel-ucode.img /@gentoo/boot/initramfs-genkernel-x86_64-4.19.10-gentoo
        }
        menuentry 'Gentoo GNU/Linux, con Linux x86_64-4.19.10-gentoo (modalità ripristino)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-4.19.10-gentoo-recovery-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
                load_video
                if [ "x$grub_platform" = xefi ]; then
                        set gfxpayload=keep
                fi
                insmod gzio
                insmod part_gpt
                insmod btrfs
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
                else
                  search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
                fi
                echo    'Caricamento Linux x86_64-4.19.10-gentoo...'
                linux   /@gentoo/boot/kernel-genkernel-x86_64-4.19.10-gentoo root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro single rootflags=subvol=@gentoo
                echo    'Caricamento ramdisk iniziale...'
                initrd  /@gentoo/boot/intel-ucode.img /@gentoo/boot/initramfs-genkernel-x86_64-4.19.10-gentoo
        }

        menuentry 'Gentoo GNU/Linux, con Linux 4.20.0-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.20.0-gentoo-advanced-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
                load_video
                insmod gzio
                insmod part_gpt
                insmod btrfs
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
                else
                  search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
                fi
                echo    'Caricamento Linux 4.20.0-gentoo...'
                linux   /@gentoo/boot/vmlinuz-4.20.0-gentoo root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro rootflags=subvol=@gentoo  resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa
                echo    'Caricamento ramdisk iniziale...'
                initrd  /@gentoo/boot/intel-ucode.img /@gentoo/boot/initramfs-genkernel-x86_64-4.20.0-gentoo
        }
        menuentry 'Gentoo GNU/Linux, con Linux 4.20.0-gentoo (modalità ripristino)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.20.0-gentoo-recovery-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
                load_video
                insmod gzio
                insmod part_gpt
                insmod btrfs
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
                else
                  search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
                fi
                echo    'Caricamento Linux 4.20.0-gentoo...'
                linux   /@gentoo/boot/vmlinuz-4.20.0-gentoo root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro single rootflags=subvol=@gentoo
                echo    'Caricamento ramdisk iniziale...'
                initrd  /@gentoo/boot/intel-ucode.img /@gentoo/boot/initramfs-genkernel-x86_64-4.20.0-gentoo
        }
        menuentry 'Gentoo GNU/Linux, con Linux 4.19.10-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.10-gentoo-advanced-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
                load_video
                insmod gzio
                insmod part_gpt
                insmod btrfs
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
                else
                  search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
                fi
                echo    'Caricamento Linux 4.19.10-gentoo...'
                linux   /@gentoo/boot/vmlinuz-4.19.10-gentoo root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro rootflags=subvol=@gentoo  resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa
                echo    'Caricamento ramdisk iniziale...'
                initrd  /@gentoo/boot/intel-ucode.img /@gentoo/boot/initramfs-genkernel-x86_64-4.19.10-gentoo
        }
        menuentry 'Gentoo GNU/Linux, con Linux 4.19.10-gentoo (modalità ripristino)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.10-gentoo-recovery-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
                load_video
                insmod gzio
                insmod part_gpt
                insmod btrfs
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
                else
                  search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
                fi
                echo    'Caricamento Linux 4.19.10-gentoo...'
                linux   /@gentoo/boot/vmlinuz-4.19.10-gentoo root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro single rootflags=subvol=@gentoo
                echo    'Caricamento ramdisk iniziale...'
                initrd  /@gentoo/boot/intel-ucode.img /@gentoo/boot/initramfs-genkernel-x86_64-4.19.10-gentoo
        }
}
menuentry 'Void GNU/Linux' --class void --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod btrfs
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
        else
          search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
        fi
        echo    'Loading Linux 5.0.4_1 ...'
        linux   /@void/boot/vmlinuz-5.0.4_1 root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro rootflags=subvol=@void resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa loglevel=4 slub_debug=P page_poison=1
        echo    'Loading initial ramdisk ...'
        initrd  /@void/boot/initramfs-5.0.4_1.img
}
submenu 'Advanced options for Void GNU/Linux' $menuentry_id_option 'gnulinux-advanced-7706867b-b5b4-4ff6-838a-d0b190c14f82' {

    menuentry 'Void GNU/Linux series 4.19' --class void --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
           load_video
           set gfxpayload=keep
           insmod gzio
           insmod part_gpt
           insmod btrfs
           if [ x$feature_platform_search_hint = xy ]; then
             search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
           else
             search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
           fi
           echo   'Loading Linux 4.19.30_1 ...'
           linux        /@void/boot/vmlinuz-4.19.30_1 root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro rootflags=subvol=@void resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa loglevel=4 slub_debug=P page_poison=1
           echo 'Loading initial ramdisk ...'
           initrd       /@void/boot/initramfs-4.19.30_1.img
}

    menuentry 'Void GNU/Linux series 5.0' --class void --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
           load_video
           set gfxpayload=keep
           insmod gzio
           insmod part_gpt
           insmod btrfs
           if [ x$feature_platform_search_hint = xy ]; then
             search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
           else
             search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
           fi
           echo   'Loading Linux 5.0.3_1 ...'
           linux        /@void/boot/vmlinuz-5.0.3_1 root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro rootflags=subvol=@void resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa loglevel=4 slub_debug=P page_poison=1
           echo 'Loading initial ramdisk ...'
           initrd       /@void/boot/initramfs-5.0.3_1.img
}
}
menuentry 'Gentoo GNU/Linux SystemD' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7706867b-b5b4-4ff6-838a-d0b190c14f82' {
        load_video
        if [ "x$grub_platform" = xefi ]; then
                set gfxpayload=keep
        fi
        insmod gzio
        insmod part_gpt
        insmod btrfs
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
        else
          search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
        fi
        echo    'Caricamento Linux x86_64-4.20.6-gentoo...'
        linux   /@gentoo-systemd/boot/vmlinuz-4.20.6-gentoo root=UUID=7706867b-b5b4-4ff6-838a-d0b190c14f82 ro rootflags=subvol=@gentoo-systemd  resume=/dev/disk/by-uuid/f4be723e-8333-4d50-9797-2b4ef3dc3caa
        echo    'Caricamento ramdisk iniziale...'
        initrd  /@gentoo-systemd/boot/initramfs-4.20.6-gentoo.img
}

menuentry 'FreeBSD' --class freebsd --class bsd --class os {
        insmod ufs2
                insmod bsd
        set root=(hd0,gpt6)
     kfreebsd /boot/kernel/kernel
                 kfreebsd_loadenv /boot/device.hints
}
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

### BEGIN /etc/grub.d/42_grub-customizer_menu_color_helper ###
### END /etc/grub.d/42_grub-customizer_menu_color_helper ###
```
I've just try to add an entry, but don't boot
this is my disk with freeBSD 

```
/dev/nvme0n1p1      2048   1585151   1583104  773M EFI System
/dev/nvme0n1p2   2099200  18876415  16777216    8G Linux swap
/dev/nvme0n1p3  18876416 731908095 713031680  340G Linux filesystem
/dev/nvme0n1p4 731908096 732317695    409600  200M EFI System
/dev/nvme0n1p5 943261696 976773134  33511439   16G Linux swap
/dev/nvme0n1p6 732317696 935331839 203014144 96,8G FreeBSD UFS
/dev/nvme0n1p7 935331840 943261695   7929856  3,8G FreeBSD swap
```

p1 is arch efi, p4 bsd efi,


----------



## Vull (Mar 28, 2019)

My understanding is that we should not edit grub.cfg. Instead we should edit /etc/grub.d/40_custom and then run the command `update-grub` or `sudo update-grub` to regenerate both the /boot/grub/grub.cfg file and the boot loader configuration. I would try adding this entry to your /etc/grub.d/40_custom file:

```
menuentry "FreeBSD" {
      insmod ufs2
      root=(hd0,gpt6)
      chainloader /boot/loader.efi
    }
```
Then run `sudo update-grub`. There are other ways of doing it, but this way has worked for me using the Debian or Linux Mint versions of grub2 to boot FreeBSD 11.2 in the past. If I'm not mistaken it should work the  same way on Arch Linux.


----------



## Zar Marco (Mar 29, 2019)

unfortunately does not work. If I try to booting I have error "/boot/loader.efi not found"


----------



## emensee (Mar 29, 2019)

That's the error I was getting Zar, have you tried the way I wrote in my post above?


----------



## Zar Marco (Mar 29, 2019)

Yes, but the system said me kernel not found


----------



## Vull (Mar 29, 2019)

Zar Marco said:


> Yes, but the system said me kernel not found


1. Has your system ever booted FreeBSD successfully after you first installed FreeBSD?

2. What version of FreeBSD did you install?

3. When you run `update-grub` it doesn't normally recognize FreeBSD, so instead it should show a message like "Unknown LInux distribution found at ..." Are you seeing this message? If yes, then what does it say exactly?

4. You have 2 Linux swap partitions. The 16 GB Linux swap partition comes between an EFI partition and your FreeBSD ufs partition. Do you know why this happened? I wouldn't normally expect to see anything between the EFI partition and the FreeBSD ufs partition.

If I was in your situation, I would consider reinstalling FreeBSD. I would also consider moving your 16 GB Linux swap partition from /dev/nvme0n1p5 to /dev/nvme0n1p4 so that your FreeBSD EFI partition and your FreeBSD ufs partition would not have any other partitions between them.

EDITED to add: You might want to try booting FreeBSD from your BIOS/firmware boot menu before reinstalling. You should be able to get a firmware boot menu when the system is powering up by pressing a function key. Another question is, what is the manufacturer and model number of this computer?


----------



## Zar Marco (Mar 30, 2019)

Hi, if I use freebsd entry on bios, I can boot without problem. If I use os-prober when I launch grub-update, I see unknown Linux distribution, but after this entry there is no on grub.cfg.
I have two linux swap because when I upgraded my ram I had add another swap for hibernation. 

I've installed FreeBSD 12


----------



## Vull (Mar 30, 2019)

Hi Zar Marco, I think you might need some additional lines to get it work with your nvme drive, but have not had time to work out what the syntax is. Looking at the grub.cfg file you posted above, I wonder if maybe you need something like:
	
	



```
if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  7706867b-b5b4-4ff6-838a-d0b190c14f82
        else
          search --no-floppy --fs-uuid --set=root 7706867b-b5b4-4ff6-838a-d0b190c14f82
        fi
```
instead of 
	
	



```
root=(hd0,gpt6)
```
This linuxquestions.org link was somewhat informative but hard to understand. I've never used any NVME drives before and have no way to test different syntaxes on a drive like yours. You might try this menuentry:
	
	



```
menuentry "FreeBSD" {
         insmod ufs2
         search --no-floppy --file /boot/loader.efi
         chainloader /boot/loader.efi
       }
```
It will give an error message, and won't boot the system, but the error message usually gives a good hint at what the correct syntax for your partition should be.


----------



## colemakker (Aug 11, 2019)

emensee said:


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


Thanks, finally got FreeBSD/Debian dual-booting working on EFI thanks to you (I'd been working on it since yesterday).
Like Zar Marco I have two ESPs, one from Debian, one from FreeBSD (I had to make two, I believe because of an error... I set the Debian ESP to bootable from a separate Debian install with GParted ("boot" in flags) and made the FreeBSD unbootable, and the menuentry in Debian's /etc/grub.d/40_custom points to the FreeBSD ESP).

I also managed to update the "set root" line to a version that uses the UUID of the ESP so if I install other drives in the system and the drive changes from being the first drive in the system, "hd0", it'll still work:

```
menuentry "FreeBSD 12" {
    search --fs-uuid --set=root 1388-EA4E
    chainloader (${root})/efi/boot/BOOTx64.efi
    boot
}
```


----------



## Saverik (Aug 26, 2019)

Hi , I can suggest you to use Refind to boot all your OS.
Installed in  Archlinux...


----------

