Asking for Sanity Check before Bootloader Update

Started by tangofan, Today at 09:14:16 PM

Previous topic - Next topic
After successfully upgrading from OPNsense 26.1.11_10 to 26.7.1_1, I am looking into running the microcode plugin for my Intel Celeron J6412 CPU again. (I had been running it in the past, but uninstalled it some time ago.)

If I understand things correctly, I should first install a new bootloader, due to a bug in the older version. However since I've never done anything like this, I'd appreciate a sanity check, before I do this. After reading this post and Patrick M. Hausen's response to it right afterwards, I compiled a similar list of system outputs, which hopefully is enough to discern the state of my partitions:

admin@opnsense:~ % sysctl machdep.bootmethod
machdep.bootmethod: UEFI


admin@opnsense:~ % uname -a
FreeBSD opnsense.<mydomain>.net 15.1-RELEASE-p1 FreeBSD 15.1-RELEASE-p1 stable/26.7-n283674-12334a596709 SMP amd64


admin@opnsense:~ % cat /etc/fstab
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/gpt/efiboot0               /boot/efi       msdosfs rw              2       2
/dev/ada0p3             none    swap    sw              0       0
fdesc /dev/fd fdescfs rw 0 0
proc /proc procfs rw 0 0


admin@opnsense:~ % gpart show
=>        40  2000409184  ada0  GPT  (954G)
          40      532480     1  efi  (260M)
      532520        1024     2  freebsd-boot  (512K)
      533544         984        - free -  (492K)
      534528    16777216     3  freebsd-swap  (8.0G)
    17311744  1983096832     4  freebsd-zfs  (946G)
  2000408576         648        - free -  (324K)


admin@opnsense:~ % gpart show -l
=>        40  2000409184  ada0  GPT  (954G)
          40      532480     1  efiboot0  (260M)
      532520        1024     2  gptboot0  (512K)
      533544         984        - free -  (492K)
      534528    16777216     3  swap0  (8.0G)
    17311744  1983096832     4  zfs0  (946G)
  2000408576         648        - free -  (324K)


admin@opnsense:~ % ls -l /boot/efi/efi
total 32
drwxr-xr-x  1 root wheel 16384 Jul 14  2024 boot
drwxr-xr-x  1 root wheel 16384 Jul 14  2024 freebsd
admin@opnsense:~ % ls -l /boot/efi/efi/boot
total 896
-rwxr-xr-x  1 root wheel 906240 Jul 14  2024 bootx64.efi
admin@opnsense:~ % ls -l /boot/efi/efi/freebsd
total 896
-rwxr-xr-x  1 root wheel 906240 Jul 14  2024 loader.efi


If I understand Patrick's response correctly, all I need to do (since the EFI partition is already mounted and I'm okay with leaving it that way) is to run
mkdir -p /boot/efi/efi/boot /boot/efi/efi/freebsd
cp /boot/loader.efi /boot/efi/efi/boot/bootx64.efi
cp /boot/loader.efi /boot/efi/efi/freebsd/loader.efi

to update the EFI bootloader (though the first line is actually superfluous in my case, since the directories already exist) and then run
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 ada0
to update the BIOS bootloader (with "nda0" in the original post changed to "ada0" for my setup).

Am I understanding things correctly? Thanks so much in advance for any help and advice with this.

Quote from: tangofan on Today at 09:14:16 PMIf I understand Patrick's response correctly, all I need to do (since the EFI partition is already mounted and I'm okay with leaving it that way) is to run
Code Select Expand
mkdir -p /boot/efi/efi/boot /boot/efi/efi/freebsd
cp /boot/loader.efi /boot/efi/efi/boot/bootx64.efi
cp /boot/loader.efi /boot/efi/efi/freebsd/loader.efi

to update the EFI bootloader (though the first line is actually superfluous in my case, since the directories already exist)

Correctamundo on both accounts.

Quote from: tangofan on Today at 09:14:16 PMand then run
Code Select Expand
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 ada0to update the BIOS bootloader (with "nda0" in the original post changed to "ada0" for my setup).

You only need this if you want to be prepared in case you ever transfer your drive with the complete installation on it to an older system that still uses legacy boot instead of UEFI. If that is not a scenario you deem worth considering, you can ignore the legacy boot partition entirely.

HTH,
Patrick
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Quote from: Patrick M. Hausen on Today at 09:21:42 PMCorrectamundo on both accounts.
Patrick, thanks a bunch for the quick response and the confirmation. I'll implement this at the next "family-approved maintenance window" for the router.

Quote from: Patrick M. Hausen on Today at 09:21:42 PM
Quote from: tangofan on Today at 09:14:16 PMupdate the BIOS bootloader

You only need this if you want to be prepared in case you ever transfer your drive with the complete installation on it to an older system that still uses legacy boot instead of UEFI. If that is not a scenario you deem worth considering, you can ignore the legacy boot partition entirely.
Updating the BIOS bootloader sounds like something that doesn't have any downside and is easy to do, so I might as well do it, though I likely will never need it.

It won't cause any downtime. You do not strictly need to reboot the system, you know?
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)