Re: Review D58990: freebsd-update: automatically update EFI and BIOS bootloaders on install

From: Mark Millard <marklmi_at_yahoo.com>
Date: Thu, 20 Aug 2026 19:54:40 UTC
On 8/20/26 12:01, Mark Millard wrote:
> On 8/20/26 11:17, Ronald Pagani Jr (ronald.pagani.jr) wrote:
>> Mark,
>>
>> Would you be able to try this latest commit?
>>
>> https://github.com/RZA-SF/freebsd-patch-for-bug279829/blob/revision-2/
>> src/efi_bootloader_update.sh <https://github.com/RZA-SF/freebsd-patch-
>> for-bug279829/blob/revision-2/src/efi_bootloader_update.sh>
> 
> That, of course, executes more of the new script. None of the 3 example
> systems end up with output text to match the pattern in:
> 's/.*HD([0-9]*,GPT,\([^,]*\),.*/\1/Ip'
> 
> 
> I'll start with amd64:
> 
> . . .
> + command -v efibootmgr
> + local efibm_out
> + efibootmgr
> + efibm_out='Boot to FW : false
> BootCurrent: 0004
> Timeout    : 1 seconds
> BootOrder  : 0000, 0002, 0004, 0006, 0005, 0007, 0008
>  Boot0000* Windows Boot Manager
>  Boot0002* UEFI OS
> +Boot0004* UEFI OS
>  Boot0006* UEFI OS
>  Boot0005* UEFI OS
>  Boot0007* UEFI OS
>  Boot0008* UEFI OS'
> + local current_num
> + printf '%s\n' 'Boot to FW : false
> BootCurrent: 0004
> Timeout    : 1 seconds
> BootOrder  : 0000, 0002, 0004, 0006, 0005, 0007, 0008
>  Boot0000* Windows Boot Manager
>  Boot0002* UEFI OS
> +Boot0004* UEFI OS
>  Boot0006* UEFI OS
>  Boot0005* UEFI OS
>  Boot0007* UEFI OS
>  Boot0008* UEFI OS'
> + sed -n 's/^BootCurrent: *//p'
> + current_num=0004
> + [ -n 0004 ]
> + printf '%s\n' 'Boot to FW : false
> BootCurrent: 0004
> Timeout    : 1 seconds
> BootOrder  : 0000, 0002, 0004, 0006, 0005, 0007, 0008
>  Boot0000* Windows Boot Manager
>  Boot0002* UEFI OS
> +Boot0004* UEFI OS
>  Boot0006* UEFI OS
>  Boot0005* UEFI OS
>  Boot0007* UEFI OS
>  Boot0008* UEFI OS'
> + grep '^Boot0004[* ]'
> + sed -n 's/.*HD([0-9]*,GPT,\([^,]*\),.*/\1/Ip'
> + boot_partuuid=''
> + local 'root_disk_list='
> + efi_root_disks zfs
> + root_disk_list=''
> + root_disk_list=''
> + local 'candidate_disks='
> + [ -n '' ]
> + [ -n '' ]
> + local deduped_disks
> + printf %s ''
> + sort -u
> + grep -v '^$'
> + deduped_disks=''
> + deduped_disks=''
> + [ -z '' ]
> + _efi_warn 'efi_boot_esps: cannot determine boot/root disks'
> + _efi_log 'WARN:  efi_boot_esps: cannot determine boot/root disks'
> + echo 'freebsd-update: [bootloader] WARN:  efi_boot_esps: cannot
> determine boot/root disks'
> freebsd-update: [bootloader] WARN:  efi_boot_esps: cannot determine
> boot/root disks
> + return 1
> + esp_list=''
> + _efi_warn $'No EFI System Partitions found for this system\'s
> boot/root disks'
> + _efi_log $'WARN:  No EFI System Partitions found for this system\'s
> boot/root disks'
> + echo $'freebsd-update: [bootloader] WARN:  No EFI System Partitions
> found for this system\'s boot/root disks'
> freebsd-update: [bootloader] WARN:  No EFI System Partitions found for
> this system's boot/root disks
> + _efi_warn 'If using hardware RAID or an unusual topology, update the
> bootloader manually'
> + _efi_log 'WARN:  If using hardware RAID or an unusual topology, update
> the bootloader manually'
> + echo 'freebsd-update: [bootloader] WARN:  If using hardware RAID or an
> unusual topology, update the bootloader manually'
> freebsd-update: [bootloader] WARN:  If using hardware RAID or an unusual
> topology, update the bootloader manually
> . . .
> 
> I have no clue how common such might be.
> 
> 
> As for aarch64  . . .
> 
> As the RPi5 is more normal compared to the WinDevKit23,  I'll start with
> the RPI5.
> 
> . . .
> + command -v efibootmgr
> + local efibm_out
> + efibootmgr
> + efibm_out='Boot to FW : false
> BootCurrent: 0002
> Timeout    : 5 seconds
> BootOrder  : 0000, 0001, 0002, 0003
>  Boot0000* UiApp
>  Boot0001* UEFI SanDisk SE32G 4412AC09 SD Device
> +Boot0002* UEFI Timetec 35TTTN2242GE3P-1TB YS240913B1T0242 1
>  Boot0003  UEFI Shell'
> + local current_num
> + printf '%s\n' 'Boot to FW : false
> BootCurrent: 0002
> Timeout    : 5 seconds
> BootOrder  : 0000, 0001, 0002, 0003
>  Boot0000* UiApp
>  Boot0001* UEFI SanDisk SE32G 4412AC09 SD Device
> +Boot0002* UEFI Timetec 35TTTN2242GE3P-1TB YS240913B1T0242 1
>  Boot0003  UEFI Shell'
> + sed -n 's/^BootCurrent: *//p'
> + current_num=0002
> + [ -n 0002 ]
> + printf '%s\n' 'Boot to FW : false
> BootCurrent: 0002
> Timeout    : 5 seconds
> BootOrder  : 0000, 0001, 0002, 0003
>  Boot0000* UiApp
>  Boot0001* UEFI SanDisk SE32G 4412AC09 SD Device
> +Boot0002* UEFI Timetec 35TTTN2242GE3P-1TB YS240913B1T0242 1
>  Boot0003  UEFI Shell'
> + grep '^Boot0002[* ]'
> + sed -n 's/.*HD([0-9]*,GPT,\([^,]*\),.*/\1/Ip'
> + boot_partuuid=''
> + local 'root_disk_list='
> + efi_root_disks ufs
> + root_disk_list=''
> + root_disk_list=''
> + local 'candidate_disks='
> + [ -n '' ]
> + [ -n '' ]
> + local deduped_disks
> + printf %s ''
> + sort -u
> + grep -v '^$'
> + deduped_disks=''
> + deduped_disks=''
> + [ -z '' ]
> + _efi_warn 'efi_boot_esps: cannot determine boot/root disks'
> + _efi_log 'WARN:  efi_boot_esps: cannot determine boot/root disks'
> + echo 'freebsd-update: [bootloader] WARN:  efi_boot_esps: cannot
> determine boot/root disks'
> freebsd-update: [bootloader] WARN:  efi_boot_esps: cannot determine
> boot/root disks
> + return 1
> + esp_list=''
> + _efi_warn $'No EFI System Partitions found for this system\'s
> boot/root disks'
> + _efi_log $'WARN:  No EFI System Partitions found for this system\'s
> boot/root disks'
> + echo $'freebsd-update: [bootloader] WARN:  No EFI System Partitions
> found for this system\'s boot/root disks'
> freebsd-update: [bootloader] WARN:  No EFI System Partitions found for
> this system's boot/root disks
> + _efi_warn 'If using hardware RAID or an unusual topology, update the
> bootloader manually'
> + _efi_log 'WARN:  If using hardware RAID or an unusual topology, update
> the bootloader manually'
> + echo 'freebsd-update: [bootloader] WARN:  If using hardware RAID or an
> unusual topology, update the bootloader manually'
> freebsd-update: [bootloader] WARN:  If using hardware RAID or an unusual
> topology, update the bootloader manually
> . . .
> 
> I have no clue how common such might be.
> 
> 
> As for the WinDevKit23 in this area, it has only the one BootCurrent:
> 0000 line in the output:
> 
> . . .
> + command -v efibootmgr
> + local efibm_out
> + efibootmgr
> + efibm_out='BootCurrent: 0000'
> + local current_num
> + printf '%s\n' 'BootCurrent: 0000'
> + sed -n 's/^BootCurrent: *//p'
> + current_num=0000
> + [ -n 0000 ]
> + printf '%s\n' 'BootCurrent: 0000'
> + grep '^Boot0000[* ]'
> + sed -n 's/.*HD([0-9]*,GPT,\([^,]*\),.*/\1/Ip'
> + boot_partuuid=''
> + local 'root_disk_list='
> + efi_root_disks ufs
> + root_disk_list=''
> + root_disk_list=''
> + local 'candidate_disks='
> + [ -n '' ]
> + [ -n '' ]
> + local deduped_disks
> + printf %s ''
> + sort -u
> + grep -v '^$'
> + deduped_disks=''
> + deduped_disks=''
> + [ -z '' ]
> + _efi_warn 'efi_boot_esps: cannot determine boot/root disks'
> + _efi_log 'WARN:  efi_boot_esps: cannot determine boot/root disks'
> + echo 'freebsd-update: [bootloader] WARN:  efi_boot_esps: cannot
> determine boot/root disks'
> freebsd-update: [bootloader] WARN:  efi_boot_esps: cannot determine
> boot/root disks
> + return 1
> + esp_list=''
> + _efi_warn $'No EFI System Partitions found for this system\'s
> boot/root disks'
> + _efi_log $'WARN:  No EFI System Partitions found for this system\'s
> boot/root disks'
> + echo $'freebsd-update: [bootloader] WARN:  No EFI System Partitions
> found for this system\'s boot/root disks'
> freebsd-update: [bootloader] WARN:  No EFI System Partitions found for
> this system's boot/root disks
> + _efi_warn 'If using hardware RAID or an unusual topology, update the
> bootloader manually'
> + _efi_log 'WARN:  If using hardware RAID or an unusual topology, update
> the bootloader manually'
> + echo 'freebsd-update: [bootloader] WARN:  If using hardware RAID or an
> unusual topology, update the bootloader manually'
> freebsd-update: [bootloader] WARN:  If using hardware RAID or an unusual
> topology, update the bootloader manually
> . . .
> 
> I have no clue how common such might be.
> 
> 
>>
>> . . .
>>
> 
> 

I now have the U-Boot UEFI based RPi4B context set up: It is like the
WinDevKit23 in that it has only one line of output from efibootmgr:

. . .
+ efibootmgr
+ efibm_out='BootCurrent: 0000'
+ local current_num
+ printf '%s\n' 'BootCurrent: 0000'
+ sed -n 's/^BootCurrent: *//p'
+ current_num=0000
+ [ -n 0000 ]
+ printf '%s\n' 'BootCurrent: 0000'
+ grep '^Boot0000[* ]'
+ sed -n 's/.*HD([0-9]*,GPT,\([^,]*\),.*/\1/Ip'
+ boot_partuuid=''
+ local 'root_disk_list='
+ efi_root_disks ufs
+ root_disk_list=''
+ root_disk_list=''
+ local 'candidate_disks='
+ [ -n '' ]
+ [ -n '' ]
+ local deduped_disks
+ printf %s ''
+ sort -u
+ grep -v '^$'
+ deduped_disks=''
+ deduped_disks=''
+ [ -z '' ]
+ _efi_warn 'efi_boot_esps: cannot determine boot/root disks'
+ _efi_log 'WARN:  efi_boot_esps: cannot determine boot/root disks'
+ echo 'freebsd-update: [bootloader] WARN:  efi_boot_esps: cannot
determine boot/root disks'
freebsd-update: [bootloader] WARN:  efi_boot_esps: cannot determine
boot/root disks
+ return 1
+ esp_list=''
+ _efi_warn $'No EFI System Partitions found for this system\'s
boot/root disks'
+ _efi_log $'WARN:  No EFI System Partitions found for this system\'s
boot/root disks'
+ echo $'freebsd-update: [bootloader] WARN:  No EFI System Partitions
found for this system\'s boot/root disks'
freebsd-update: [bootloader] WARN:  No EFI System Partitions found for
this system's boot/root disks
+ _efi_warn 'If using hardware RAID or an unusual topology, update the
bootloader manually'
+ _efi_log 'WARN:  If using hardware RAID or an unusual topology, update
the bootloader manually'
+ echo 'freebsd-update: [bootloader] WARN:  If using hardware RAID or an
unusual topology, update the bootloader manually'
freebsd-update: [bootloader] WARN:  If using hardware RAID or an unusual
topology, update the bootloader manually
. . .


For reference for efibootmgr output on teh 4 systems:

amd64 (booted using its UEFI/ACPI):

 # efibootmgr
Boot to FW : false
BootCurrent: 0004
Timeout    : 1 seconds
BootOrder  : 0000, 0002, 0004, 0006, 0005, 0007, 0008
 Boot0000* Windows Boot Manager
 Boot0002* UEFI OS
+Boot0004* UEFI OS
 Boot0006* UEFI OS
 Boot0005* UEFI OS
 Boot0007* UEFI OS
 Boot0008* UEFI OS


WinDevKit23 (booted using its UEFI/ACPI):

# efibootmgr
BootCurrent: 0000


RPi5 (booted using UEFI/ACPI via a EDK2 draft):

# efibootmgr
Boot to FW : false
BootCurrent: 0002
Timeout    : 5 seconds
BootOrder  : 0000, 0001, 0002, 0003
 Boot0000* UiApp
 Boot0001* UEFI SanDisk SE32G 4412AC09 SD Device
+Boot0002* UEFI Timetec 35TTTN2242GE3P-1TB YS240913B1T0242 1
 Boot0003  UEFI Shell


RPi4B (booted using some vintage of the FreeBSD U-Boot UEFI):

# efibootmgr
BootCurrent: 0000


-- 
===
Mark Millard
marklmi at yahoo.com