Goal

Dual boot FreeBSD 12.0-CURRENT r315864 and Ubuntu Linux (Zesty Zapus) 17.04 Final Beta in GRUB 2 on Lenovo Yoga 3 14 with UEFI.


Steps

It could be optimized.

  1. Create USB sticks with FreeBSD, Ubuntu and GParted.
  2. Set BIOS to try a UEFI boot first instead of Legacy.
  3. Boot GParted and create a new GPT partition table on the hard drive.
  4. Boot the Ubuntu Live USB and let it install itself. It should create an ESP and EXT4 partitions (Ubuntu will not create an ESP partition if you didn't set to try UEFI boot in BIOS).
  5. Boot GParted and resize the Ubuntu EXT4 partition to make some space for the FreeBSD installation. Do not format this space - it makes things easier for FreeBSD during auto detecting free partitions.
  6. Boot the FreeBSD USB and choose an option for automatic UFS partitioning (I've not tried it yet with ZFS). Choose Partition instead of Entire Disk and the installer will figure out the rest for you. Write down the name of the partition with the EFI label (mine was called ada0p4).

  7. Boot Ubuntu from your hard drive and add the following lines to /boot/grub/custom.cfg (the file has to be called like that):

    • menuentry "FreeBSD" {
      insmod part_gpt
      insmod fat
      insmod chain
      set root=(hd0,gptX)
      chainloader /efi/boot/BOOTx64.efi
      }

    Change X to the partition number of your FreeBSD EFI partition (e.g. my partition was ada0p4 so set root=(hd0,gpt4) worked for me).

  8. Done. You might need to hit the Escape key once when the screen turns Ubuntu-like purple for the first time after turning on the machine to access GRUB 2 as Ubuntu hides it by default. Alternatively, you might add the following lines to /boot/grub/custom.cfg:

    • set default="3"
      set timeout=5
      set timeout_style=menu
    It shows the standard GRUB 2 menu for 5 seconds before it boots the third option (counting from 0) which is most probably your FreeBSD partition.


References

See also


CategoryHowTo

Laptops/Lenovo_Yoga_3_14/DualBoot (last edited 2018-07-31T01:39:06+0000 by MateuszPiotrowski)