Re: New loader_lua.efi causes kernels to hang at boot

From: Warner Losh <imp_at_bsdimp.com>
Date: Mon, 30 Aug 2021 05:28:01 UTC
On Sun, Aug 29, 2021 at 7:28 PM Dustin Marquess <dmarquess@gmail.com> wrote:

> I am upgrading a -CURRENT box from a build that's exactly 2 weeks old to
> one I built about 2 hours ago. After installkernel I updated the bootloader
> the same way I normally do:
>
> # mount_msdosfs /dev/da8p1 /mnt
> # cp /mnt/EFI/BOOT/BOOTX64.efi /mnt/EFI/BOOT/BOOTX64.bak
> # cp loader_lua.efi /mnt/EFI/BOOT/BOOTX64.efi
> # umount /mnt
>
> After rebooting, however, the kernel hangs right after:
>
> real memory  = 137438953472 (131072 MB)
> avail memory = 133651951616 (127460 MB)
> ACPI APIC Table: <LENOVO SV-INT  >
>
> It never makes it to this line:
>
> FreeBSD/SMP: Multiprocessor System Detected: 32 CPUs
> FreeBSD/SMP: 2 package(s) x 8 core(s) x 2 hardware threads
>
> So I rebooted a selected kernel.old at the boot menu and.. same thing.
> That's strange!
>
> So I booted off a USB stick, mounted the EFI partition and copied
> BOOTX64.bak back to BOOTX64.efi and now the machine booted normally.
>
> So for some reason the newer loader_lua.efi is causing both the new kernel
> AND the old kernel to hang, but the older loader_lua.efi seems to work with
> both no problem.
>
> Any ideas?
>

Can you bisect where this starts to happen?

Have you set EFI_STAGING_SIZE in your src.conf or similar file?

The following commits have been made to stand that likely affect this:

commit b54eec8366605d9c2303277cf2ab4b605289910a
Author: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: Fri Aug 27 19:49:01 2021 +0300

    efi loader: disallow user to configure staging area size less than
default

commit b850806921a735f3f307bc4b2634c7e9008f5a9c
Author: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: Fri Aug 27 19:48:53 2021 +0300

    Restore the definition of EFI_STAGING_SIZE

commit 6032b6ba9596927aba15a8004ade521a593a7d58
Author: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: Wed Aug 25 22:26:52 2021 +0300

    amd64 UEFI loader: enable automatic disable of staging area copying

commit 0d13f5343fafbf3067ffc33a507ffca0375c4417
Author:     Maxim Sobolev <sobomax@FreeBSD.org>CommitDate: Fri Aug 20
14:08:01 2021 -0700

    Only trigger read-ahead if two adjacent blocks have been requested.

You can rebuild "stand" independently of the system, so it should be
relatively
straightforward to build a new loader_lua.efi that steps back across these
(and the
other ones that I'm pretty sure are super-low risk for this use case).

You can also use efibootmgr to setup a temporary boot variable to ease
testing,
or just boot a known good one off a USB stick.

Warner