FreeBSD does not boot after installing on external USB Hard Disk

mkru

Member

Reaction score: 2
Messages: 25

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.
freebsd_setup.png

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

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,013
Messages: 38,466

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

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?
 
OP
M

mkru

Member

Reaction score: 2
Messages: 25

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

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,013
Messages: 38,466

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.
 
OP
M

mkru

Member

Reaction score: 2
Messages: 25

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:
bios1.jpg

boot options:
bios2.jpg


Laptop
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,013
Messages: 38,466

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.
 
OP
M

mkru

Member

Reaction score: 2
Messages: 25

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

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,013
Messages: 38,466

Is there any instruction that would explain me what is meant by _fix_?
See the manual page for more information.
Code:
# 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.

And how do I make sure it is EFI booted?
Check the machdep.bootmethod sysctl, it should show UEFI:
Code:
% sysctl machdep.bootmethod
machdep.bootmethod: UEFI
If it says BIOS then efibootmgr(8) will refuse to do anything.
 
OP
M

mkru

Member

Reaction score: 2
Messages: 25

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
da1p1.jpg
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,013
Messages: 38,466

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.
 
OP
M

mkru

Member

Reaction score: 2
Messages: 25

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

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,013
Messages: 38,466

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
 
OP
M

mkru

Member

Reaction score: 2
Messages: 25

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:
efibootmgr.png

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:
Screenshot from 2020-12-01 14-08-45.png


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

mkru

Member

Reaction score: 2
Messages: 25

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