FreeBSD dual boot with linux on legacy bios computer
1. Install FreeBSD using UFS filesystem
2. Install linux or altenatively install linux´s grub to mbr (master boot record)
3. Edit /etc/grub.d/40_custom file
sudo nano /etc/grub.d/40_custom
…. add entry (if FreeBSD is sda1)
menuentry "FreeBSD boot loader "{
set root="hd0,1"
kfreebsd /boot/loader
}
4. Update grub
sudo update-grub
FreeBSD is quite sensitive to hardware, so do not install it if you doubt the functionality of your hardware. For example, on an HP DV7 laptop, installing FreeBSD causes the boot to stop at the BIOS hardware check, which cannot be solved except by removing the hard drive and deleting the FreeBSD boot files from the hard drive. Another possible cause could be a memory leak, i.e. faulty memory chips.
Edit 6.7.2025: The memory module was defective in the DV7 laptop, and after replacing the memory module, the machine works fine on both Linux and the FreeBSD operating system. Note that some machines require a GPT partition table and a UFS partition for FreeBSD to dual boot. Linux then boots the operating systems via the bios_grub partition.
An another way to add FreeBSD to linux’s grub, is to use chainloader
Edit /etc/grub.d/40_custom file
sudo nano /etc/grub.d/40_custom
… add a line
menuentry "FreeBSD chainloader" {
insmod ufs2
set root=(hd0,1)
chainloader +1
}
Update grub after editing
sudo update-grub
Chainloader is a little slower than bare kfreebsd loader, but both of them are working and both of them can use at the same time.