Deth

Fitness and everything else

Here's How I Broke Then Fixed FreeBSD's EFI boot

I have been wanting to update my UEFI partition for booting FreeBSD for quite a while now. It was working, so don’t fix something that’s not broken, is how I normally go, but I finally wanted to update it in preparation for FreeBSD 14. Sometime since I originally did it, they changed the process for writing it. I did it wrong and botched the bootloader. I got it up and running again, then forgot to rename the loader.efi when I copied it.

I went into Windows (painful) and downloaded the DVD .ISO for and burned it to get into the live system. Naturally, I wasn’t able to find my memory stick, which is a bootable FreeBSD image. I need to order a new one. They are such a crapshoot these days, though. The past few that I’ve bought have been unreliable or didn’t last very long. Luckily, I had a blank DVD, and I got the DVD method to work, so it worked out in the end. Once I got to a live system, all I had to do was this:

mount_msdosfs /dev/ada2p1 /mnt
cp /boot/loader.efi /mnt/efi/boot/bootx64.uefi

It needs to be named bootx64.efi for the machine to recognize it. That was the mistake I made before. I just copied it with the original name.

While I was there, I labeled it to make things simpler for me. It will be nice to not have to play the guessing game should I ever upgrade my SSD or get a new one.

 efibootmgr -l /mnt/efi/boot/bootx64.efi -L FreeBSD

Now I got it working and verified that it’s booting from UEFI.

sysctl machdep.bootmethod
machdep.bootmethod: UEFI