# Dual boot FreeBSD in a multi-OS system



## BeOurGuest (Mar 13, 2020)

I have decided to install FreeBSD onto actual working hardware (not just on a virtual machine). This will be my daily driver PC.

My computer pre-dates UEFI (motherboard BioStar N68S3B), which means GRUB will be my boot manager. My video card is an Nvidia GeForce GT 430 of which I connect through my HDMI port for both video and sound (on Linux I use the 390.xxx drivers).  I use a generic wireless mouse and keyboard (USB). Finally, while my computer is directly connected to my router, my printer which is a Brothers MFC-L2740DW, prints over the network (DHCP).

My current hard drive layout is as follows

sda1 - SWAP
sda2 - Arch Linux *==* *Boot Flag*
sda3 - Debian Sid
sda4 - HERE is where FreeBSD is planned to be installed.

My primary concern is trying to get FreeBSD to boot nicely in my system.  I presume I am not going to install FreeBSD's boot loader.

It has been a long time since I decided to give FreeBSD a serious try (*outside* a virtual machine). Real hardware, as most know is always something new.  Please think of me as a newbie who likely knows next to nothing (or who has amnesia and recalls nothing).  That said, anything you can tell me that will benefit my experience and ease me into using FreeBSD is very much appreciated.


----------



## micski (Aug 4, 2020)

How did your project turn out?


----------



## bookwormep (Aug 4, 2020)

Here is an old thread discussion on FreeBSD and dual-boot:
https://forums.freebsd.org/threads/freebsd-and-linux-dual-boot.60407/#post-421746


----------



## bookwormep (Aug 5, 2020)

Beware of the grub (grub2) security vulnerability recently disclosed. Try and use the newest patched version for your installed system (or, at least upgrade as soon as possible). Here is some details:
https://9to5linux.com/debian-linux-10-5-buster-released-with-boothole-patches-62-security-updates


----------



## a6h (Aug 5, 2020)

No reply from OP, I assume his problem is solved. Therefore I write a general step by step guide, suitable for everyone for using on an old/MBR imaginary system:
System: 128 GB HDD
Dual Boot MBR: FreeBSD/GNU-Linux(Debian)

Boot with FreeBSD USB/CD
Partitioning: 
Manual
Select drive (e.g. sda0) > Delete
Select drive > Create > `MBR`
Select drive > Create:
Type: `freebsd`
Size: 64GB

Select slice (e.g. sda0s1) > Create
Type: `freebsd-ufs`
Size: 60GB
Mountpoint: `/`

Select slice (e.g. sda0s1) > Create
Type: `freebsd-swap`
Size: 4GB


Finish > Installing > everything is OK > boot > ... > poweroff
Boot with Linux USB/CD
Partition Disks:
Manual
Select drive (e.g. sda) > Select free space > Create 
60GB
Primary
Beginning
Ext4 | Mount point `/`
Done!

Select drive (e.g. sda) > Select free space > Create 
4GB
Primary
Beginning
Swap
Done!


Installing ...
Install GRUB boot loader > YES
Select manual
Enter: `/dev/sda`

Finish installing. Reboot. GRUB will show up. Linux will start
Open a terminal > change to root:  `sudo su -`
Edit /etc/grub.d/40_custom
`vi /etc/grub.d/40_custom`

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

`grub-mkconfig -o /boot/grub/grub.cfg`
Edit /etc/default/grub to set FreeBSD as Default boot item
`vi /etc/grub.d/40_custom`
GRUB_DEFAULT=2
`update-grub`
Reboot
Now you have a dual boot system (Linux/FreeBSD) and FreeBSD is set as default boot item. If select or le it be, it boots into FreeBSD, it skips boot0 stage and land on boot2/loader/... aka 9sec count down and boot into FreeBSD. Or you can select Linux from the GRUB menu and boot in Linux.


----------

