# How to install FreeBSD without UEFI?



## Ioozer (Jan 27, 2021)

I discovered a bug of my BIOS. It can't tolerate more than one EFI partition on the system, regardless if the EFI partitions are on different disks or not. I also discovered that it still allow legacy booting alongside to UEFI, even though this option was hidden very deep and very difficult to see.

This give me some hope of running FreeBSD alongside Linux.

However, the installer always created some sort of EFI partition. How could I avoid it?


----------



## SirDice (Jan 27, 2021)

Ioozer said:


> However, the installer always created some sort of EFI partition.


Not that I'm aware of. Last time I installed FreeBSD using all default options (UFS and pressing enter everywhere) it installed a traditional BIOS boot with GPT. Note that GPT has nothing to do with UEFI or not, it's just a way to partition the disk. UEFI boot is only possible if there's an efi partition. The freebsd-boot partition is how you BIOS/CSM boot a GPT partitioned disk. If you have a efi and freebsd-boot partitions you can actually boot the system both ways. 

If you choose ZFS then there's an option in one of the screens to select the partitioning scheme and the boot, i.e. GPT+UEFI or GPT+BIOS.


----------



## Ioozer (Jan 27, 2021)

SirDice said:


> Not that I'm aware of. Last time I installed FreeBSD using all default options (UFS and pressing enter everywhere) it installed a traditional BIOS boot with GPT. Note that GPT has nothing to do with UEFI or not, it's just a way to partition the disk. UEFI boot is only possible if there's an efi partition. The freebsd-boot partition is how you BIOS/CSM boot a GPT partitioned disk.


Yeah. I know this. The installed FreeBSD system could boot either via UEFI or Legacy.

The problem is my main OS is Linux. If I removed the Linux disk and only the FreeBSD disk left, everything is fine.

But I can't just do this. When my Linux disk inserted alongside the FreeBSD disk, the system can't boot.

The only thing I saw is a black screen with these text appeared according to this order on the right most bottom of the screen: 9C, 99, A2 then stuck.

Removing the FreeBSD disk I could boot to Linux again.


----------



## SirDice (Jan 27, 2021)

Just remove the efi partition on the FreeBSD disk if you have both efi and freebsd-boot partitions. I'm assuming the Linux disk has an efi partition too and this is what's confusing the system. You should be able to UEFI boot FreeBSD from the efi partition on the Linux disk. But you might need to copy FreeBSD's BOOTx64.efi file to the Linux efi partition. If I understood things correctly you can name it something like FreeBSD.efi, UEFI just looks for a file called BOOTx64.efi by default. Name the Linux version of the file to Linux.efi and you should be able to chose between the two. But this might also require some fiddling with efibootmgr(8) to set the UEFI variables correctly and get it to select the correct EFI boot file for each OS.


----------



## Ioozer (Jan 27, 2021)

SirDice said:


> Just remove the efi partition on the FreeBSD disk if you have both efi and freebsd-boot partitions. I'm assuming the Linux has an efi partition too and this is what's confusing the system.


Thanks I will try.


----------



## Speedy (Jan 27, 2021)

What SirDice said. You need one ESP partition per computer, not per OS. UEFI standard requires anything named EFI\BOOT\BOOTX64.EFI must be found and booted by firmware without any need to set it up, provided it is a valid EFI executable. Since this is FAT filesystem it is not case sensitive. You can add your own boot images with efibootmgr. However, a word of caution, I read someone complaining his/her motherboard firmware allowed only one entry. I hope this was some sort of user error, but if it is true and you have such a motherboard then you need to use a boot manager as rEFInd and let it manage multiple boot images.


----------



## Ioozer (Jan 28, 2021)

I was wrong. If we boot the FreeBSD memstick with Legacy then it will make a Legacy system without EFI partition. When the font is big the memstick is booted with Legacy. When the font is small it's booted with UEFI. I always booted it wrongly with UEFI.


----------



## SirDice (Jan 28, 2021)

Make a copy of the BOOTx64.efi file in the efi partition on the FreeBSD disk, then remove that whole efi partition. When you add the Linux disk back it should boot correctly as there's now only one efi partition. Then copy that backed up BOOTx64.efi to the efi partition on the Linux disk and rename it something like FreeBSD.efi. You then need to play around with efibootmgr(8) to add the FreeBSD install as a boot option. You should be able to use the efibootmgr(8) on Linux too. The Linux and FreeBSD versions look a little different but will work for both since these UEFI variables are not OS dependent.


----------

