Review D58990: freebsd-update: automatically update EFI and BIOS bootloaders on install
"Ronald Pagani Jr (ronald.pagani.jr)" <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.hackers |
|---|---|
| Message-ID | <CA+aKf4mPP693DRSJ0eiSa3QHduBjmOSm_zv6ETHthGELA1K_Nw@mail.gmail.com> |
I've submitted a patch to automatically update the EFI bootloader on the ESP during freebsd-update install: https://reviews.freebsd.org/D58990 The problem: freebsd-update updates /boot/loader.efi on the root filesystem, but the UEFI firmware boots from loader.efi on the EFI System Partition — a separate FAT32 partition that freebsd-update never touches. After a major version upgrade the ESP loader can be left several versions stale. Since 14.1 removed the lua_path==nil compatibility shim from core.lua, this mismatch produces a hard boot failure. If the user also ran zpool upgrade, the system is completely unbootable without external media. The patch hooks efi_bootloader_update.sh into install_run() in freebsd-update.sh. It auto-detects the ESP via gpart, fingerprints /EFI/BOOT/BOOTx64.efi before touching it (multi-OS safe), creates /EFI/FreeBSD/loader.efi if absent, updates NVRAM, and handles BIOS GPT bootcode as well. Opt-out via UpdateBootloader=no in freebsd-update.conf. Tested on FreeBSD 14.0-RELEASE-p11 amd64 (UEFI, ZFS, NVMe). 197 unit/integration/error tests available at: https://github.com/RZA-SF/freebsd-patch-for-bug279829 This is complementary to Warner Losh's D45890 (loader version-check warnings). Feedback welcome. Best, Ron