# FreeBSD does not boot after installing on external USB Hard Disk



## mkru (Dec 1, 2020)

I wanted to try FreeBSD. As my internal SSD NVMe disk is already occupied by Linux installation I have installed FreeBSD on an external USB SSD Hard Disk. 
The installation setup is shown in the picture.




The installation process went smooth without any problems.
After installation I have removed the USB stick.
However, FreeBSD from USB Hard Disk never boots. No matter what boot order in the BIOS I set.
Even if I disable booting from internal NVMe, the BIOS is booted instead of FreeBSD.
I have not set the GRUB to dual boot, as I do not want to dual boot. I want to choose the proper system to boot based on the BIOS boot order setting.
Does anyone know what might be wrong?


----------



## SirDice (Dec 1, 2020)

What boot options did you choose during the install? Did you install with GPT and CSM (Bios boot)? 



mkru said:


> Even if I disable booting from internal NVMe, the BIOS is booted instead of FreeBSD.


The BIOS typically isn't a partition on disk, so what exactly is booting here? What errors are you getting?


----------



## mkru (Dec 1, 2020)

During installation I have chosen default options everywhere.

By writing that BIOS is booted I mean that I see the BIOS menu after powering on.
I do not get any errors. It behaves like the USB Hard Disk was not bootable.


----------



## SirDice (Dec 1, 2020)

If a BIOS cannot find something to boot from it's going to complain about that. What BIOS menu are you talking about? I don't like pictures but in this case we're probably going to need to see the screen. Can you post a picture of that screen?

What laptop do you have? Make and model should be enough information. Maybe someone else has the same laptop and knows what is happening.


----------



## mkru (Dec 1, 2020)

Disk structure after installation:
da1         119GB   GPT
  da1p1   200MB   efi
  da1p2   115GB   freebsd-ufs         /
  da1p3   4.0GB    freebsd-swap    none

I do not see any complaints. The first thing I see is:



boot options:




Laptop


----------



## SirDice (Dec 1, 2020)

Right. Boot the installation media, make sure it's EFI booted. Then fix your boot using efibootmgr(8) from the shell. It's simply missing the EFI boot option and thus doesn't know how to boot from it.


----------



## mkru (Dec 1, 2020)

Is there any instruction that would explain me what is meant by _fix_?
And how do I make sure it is EFI booted?


----------



## SirDice (Dec 1, 2020)

mkru said:


> Is there any instruction that would explain me what is meant by _fix_?


See the manual page for more information. 

```
# efibootmgr -v
BootCurrent: 0000
Timeout    : 5 seconds
BootOrder  : 0000, 0002, 0001
+Boot0000* FreeBSD HD(1,GPT,73a59793-76c2-11ea-b926-00012e47b3ea,0x28,0x64000)/File(\efi\boot\BOOTx64.efi)
                      ada0p1:/efi/boot/BOOTx64.efi (null)
 Boot0002* Hard Drive  BBS(HD,,0x0)
 Boot0001  CD/DVD Drive  BBS(CDROM,,0x0)


Unreferenced Variables:
```
This shows what boot options there are and which is booted by default. You can add/remove/modify entries using the efibootmgr(8) tool. 



mkru said:


> And how do I make sure it is EFI booted?


Check the `machdep.bootmethod` sysctl, it should show UEFI:

```
% sysctl machdep.bootmethod
machdep.bootmethod: UEFI
```
If it says BIOS then efibootmgr(8) will refuse to do anything.


----------



## mkru (Dec 1, 2020)

I have read the man page and I guess I know what I have to do.
However, I need to mount partition with efi in live session.
When I`ls /dev` I can see `/dev/da1p1`, but when I try to mount with `mount /dev/da1p1 /mnt` I get `/dev/da1p1: No such file or directory`

`goem -t` output


----------



## SirDice (Dec 1, 2020)

mkru said:


> However, I need to mount partition with efi in live session.


Point it to the installer image, when you remove the install stick your disk nominations are going to shift any way. Your external disk will become ad0. Partitioning should be same on the installer and your disk, so this shouldn't matter much.

The machine I showed the output from was also "fixed" that way. After the initial install (with UEFI) it didn't want to boot either.


----------



## mkru (Dec 1, 2020)

I also can't mount efi partition from the installer. The message is the same /dev/da0s1  No such file or directory.


----------



## SirDice (Dec 1, 2020)

The efi partition needs to be mounted with msdosfs(5). FreeBSD's mount(8) command doesn't switch filesystems automagically and will just try to mount it as UFS; `mount -t msdosfs /dev/da1p1 /mnt`


----------



## mkru (Dec 1, 2020)

Then displaying a message _No such file or directory_ is a bit misleading.

Nevertheless, I have managed to mount, create efi variable, set bootnum active and I still can't boot FreeBSD.
`efibootmgr -v` output:



I am not sure if this is significant, but after mounting the path is _/efi/boot/_ not /EFI/BOOT . Ok FAT is not case-sensitive.

PARTUUID is correct:




I do not see in the BIOS an option to choose the boot option I have created.


----------



## mkru (Dec 2, 2020)

I have found the solution. I also had to change order in `UEFI Hard Disk Drive BBS Prorities` - config available in the BIOS.


----------

