Bug 271794 - boot1.efi hangs on a system with gjournaled partitions
Summary: boot1.efi hangs on a system with gjournaled partitions
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: Unspecified
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-geom (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-02 22:54 UTC by longwitz
Modified: 2023-12-04 14:58 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description longwitz 2023-06-02 22:54:13 UTC
My ThinkPad L560 running FreeBSD 12.3-STABLE r371380 did not boot abruptly.
The output of boot1.efi was:

>> FreeBSD EFI boot block
   Loader path: /boot/loader.efi

   Initializing modules: ZFS UFS
   Load Path: \EFI\BOOT\BOOTX64.EFI
   Load Device: PciRoot(0x0)/Pci(0x17,0x0)/Sata(0x0,0x0,0x0)/HD(1,GPT,31EB33B1-A814-11EB-9474-FC4596A9D2D8,0x28,0xC8000)
   BootCurrent: 001a
   BootOrder: 0001 0010 0011 0012 0013 001b 0017 0018 0019 001a[*] 001c
   Probing 11 block devices...not supported
not supported
not supported
not supported
not supported
better
not supported
better
better
better
better
 done
   ZFS found no pools
   UFS found 5 partitions

Nothing more, laptop hangs. I could not boot from disk anymore.
I use gmirror/gjournal, and gpart show gives

=>       40  500118112  mirror/gmnbsd  GPT  (238G)
         40     819200              1  efi  (400M)
     819240   16777216              2  freebsd-swap  (8.0G)
   17596456   16777216              3  freebsd-swap  (8.0G)
   34373672   16777216              4  freebsd-swap  (8.0G)
   51150888   16777216              5  freebsd-swap  (8.0G)
   67928104   16777216              6  freebsd-swap  (8.0G)
   84705320    4194304              7  freebsd-ufs  (2.0G)
   88899624   25165824              8  freebsd-ufs  (12G)
  114065448   67108864              9  freebsd-ufs  (32G)
  181174312  318943840             10  freebsd-ufs  (152G)

Partitions p3-p6 are the gjournals for the ufs partitions p7-p10.
The first "better" in the output of boot1.efi shows the problem:
boot1 mistankenly thinks the gjournal partition p5 is an ufs partition
and therfore tries to start loader.efi from this partition.

boot1 fails because the check for ufs is done with a simple compare to
FS_UFS_MAGIC and in a gjournal partition this data can be found. Of cource
this is a rarely event, but I had a hit. It would be much safer when
boot1.efi does a check for the partition type freebsd-ufs in the GPT, so
done in gptboot.
Comment 1 Tomoaki AOKI 2023-12-04 14:58:24 UTC
Does using loader.efi instead of boot1.efi work?

If not, patch uploaded on Bug 207940 "stand/efi/boot1: Add boot partition selection" allows you to choose which partition to boot from.

Unfortunately, recording chosen boot partition is not implemented.
If you try, choose one from latest 2 patches, one by Naomichi Nonaka, another by me.
Mine is just a variant of Naomichi's one, and the difference is just "how partitions/ZFS pools to be shown?".