Solved UEFI boot anomaly after update to 12.2

VladiBG

Aspiring Daemon

Reaction score: 386
Messages: 925

Where did you read that it's required to update the BOOTx64.efi inside your EFI partition? This is NOT your boot partition.

You can copy the first stage boot1.efi under /efi/boot/boot1.efi and manually boot from this efi file if your BIOS support boot from efi file. This will search for the freebsd-ufs or freebsd-zfs partition then load /boot/loader.efi

Code:
root@bsd-laptop:/mnt # tree
.
`-- efi
    |-- HackBGRT
    |   |-- bootia32.efi
    |   |-- bootx64.efi
    |   |-- config.txt
    |   `-- splash.bmp
    |-- Memtest
    |   |-- BENCHMAR
    |   |-- BLACKLIS.CFG
    |   |-- BOOTIA32.EFI
    |   |-- BOOTX64.EFI
    |   |-- MT86.PNG
    |   |-- MemTest86.log
    |   `-- UNIFONT.BIN
    |-- boot
    |   |-- BOOTx64.efi
    |   |-- boot1.efi
    |   `-- startup.nsh
    `-- microsoft
        `-- boot
            `-- memtest.efi
 

guidok

Member

Reaction score: 9
Messages: 35

Okay, now I'm confused.

Where did you read that it's required to update the BOOTx64.efi inside your EFI partition?

After upgrading from 12.1 to 12.2 using freebsd-update -r 12.2-RELEASE upgrade I ran zpool status. It told me some supported features are not enabled on the pool and suggested I ran zfs upgrade, which I did. That command in turn suggested I ran something akin to gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0 (assuming da0 is my boot disk, which it is not, it is nvd0) That is where I stopped, as that last command didn't feel exactly right. Looking at some of the recent posts on this forum, it indeed seemed to cause problems for some users.

So now I am trying to determine what to do. I don't know much about the boot procedure. But it seems logical to me that, once additional features are enabled on the pool, the loader might need be updated. After all, it is the loader that accesses the pool to load the kernel, right? So how do I upgrade the boot loader(s)?

This is NOT your boot partition
Pardon my ignorance. I'm a recovering FreeBSD user (from before 2005), after having used Macs exclusively for 15 years where I never had to deal with stuff like this.

This is what I did to determine, what I believed to be, my boot partition:

1. uefi() said the ESP Identifier for GPT partitions is C12A7328-F81F-11D2-BA4B-00A0C93EC93B
2. gpart list showed that UUID (as rawtype) to be part of Provider 1, with name nvd0p1. It also happens to have a label called: efiboot0
3. That partition is what I mounted using mount -t msdos /dev/nvd0p1 /mnt
4. And it is on that partition I intended to update BOOTx64.efi

Intended (past tense), cause as I've said before, now I'm confused and left wondering whether:

1. I need to upgrade my boot loader?
2. and if so, how to?

Additional info:

Code:
% gpart show
=>        40  1000215136  nvd0  GPT  (477G)
          40      409600     1  efi  (200M)
      409640        2008        - free -  (1.0M)
      411648     8388608     2  freebsd-swap  (4.0G)
     8800256   991414272     3  freebsd-zfs  (473G)
  1000214528         648        - free -  (324K)



Code:
% gpart list
Geom name: nvd0
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 1000215175
first: 40
entries: 128
scheme: GPT
Providers:
1. Name: nvd0p1
   Mediasize: 209715200 (200M)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 20480
   Mode: r1w1e1
   efimedia: HD(1,GPT,1a491a9b-12e4-11ea-acaf-8c164531b398,0x28,0x64000)
   rawuuid: 1a491a9b-12e4-11ea-acaf-8c164531b398
   rawtype: c12a7328-f81f-11d2-ba4b-00a0c93ec93b
   label: efiboot0
   length: 209715200
   offset: 20480
   type: efi
   index: 1
   end: 409639
   start: 40
2. Name: nvd0p2
   Mediasize: 4294967296 (4.0G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 210763776
   Mode: r1w1e1
   efimedia: HD(2,GPT,1a5484e6-12e4-11ea-acaf-8c164531b398,0x64800,0x800000)
   rawuuid: 1a5484e6-12e4-11ea-acaf-8c164531b398
   rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
   label: swap0
   length: 4294967296
   offset: 210763776
   type: freebsd-swap
   index: 2
   end: 8800255
   start: 411648
3. Name: nvd0p3
   Mediasize: 507604107264 (473G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 210763776
   Mode: r1w1e1
   efimedia: HD(3,GPT,1a58963b-12e4-11ea-acaf-8c164531b398,0x864800,0x3b17c800)
   rawuuid: 1a58963b-12e4-11ea-acaf-8c164531b398
   rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
   label: zfs0
   length: 507604107264
   offset: 4505731072
   type: freebsd-zfs
   index: 3
   end: 1000214527
   start: 8800256
Consumers:
1. Name: nvd0
   Mediasize: 512110190592 (477G)
   Sectorsize: 512
   Mode: r3w3e6
 

VladiBG

Aspiring Daemon

Reaction score: 386
Messages: 925

I see where the confusion came from. /boot/gptboot and /boot/gptzfsboot are for BIOS boot (freebsd-boot partition) not used for UEFI boot.

 

roper

Member

Reaction score: 13
Messages: 51

I see where the confusion came from. /boot/gptboot and /boot/gptzfsboot are for BIOS boot (freebsd-boot partition) not used for UEFI boot.

Today I upgraded a box which is using UEFI boot from 12.1 to 12.2 and a moment ago upgraded the zroot pool using zpool upgrade to enable the new feature flags. I had thought that I would need to update the bootcode in a similar fashion as I've done on other machines that use the GPT freebsd-boot partitions. My understanding after reading this thread is that UEFI should find the new bootcode, if any, without the necessity of that intervention. Is this correct?
 

VladiBG

Aspiring Daemon

Reaction score: 386
Messages: 925

You don't need to update your boo1.efi (BOOTx64.efi) inside your EFI partition. If you want to read about what is changed for the zfs_module you can do it here:
 

roper

Member

Reaction score: 13
Messages: 51

Today I upgraded a box which is using UEFI boot from 12.1 to 12.2 and a moment ago upgraded the zroot pool using zpool upgrade to enable the new feature flags. I had thought that I would need to update the bootcode in a similar fashion as I've done on other machines that use the GPT freebsd-boot partitions. My understanding after reading this thread is that UEFI should find the new bootcode, if any, without the necessity of that intervention. Is this correct?
In trying to answer my own question I've read from the handbook https://www.freebsd.org/doc/handbook/zfs-zpool.html that indicates

For systems using EFI to boot, execute the following command:
Code:
# gpart bootcode -p /boot/boot1.efifat -i 1 ada1


Which in my case may translate to
Code:
# gpart bootcode -p /boot/boot1.efifat -i 1 nvd0


Which shouldn't hurt even if it isn't strictly necessary. I think I'll create some 12.2 installation media before I reboot again. Please pardon my ignorance. UEFI is still new to me and old brain doesn't accept new input as readily as it once did.
 

Emrion

Well-Known Member

Reaction score: 140
Messages: 493

I would say:
gpart bootcode -p /boot/boot1.efifat -i1 nvd0

But don't do that for a version upgrade as already advised. I didn't do that and didn't encounter any problem even after zpool upgrade.

As already seen in this thread, if you want to upgrade your efi partition, you have to copy /boot/loader.efi into nvd0p1 as /EFI/BOOT/BOOTx64.efi.
 

roper

Member

Reaction score: 13
Messages: 51

I would say:
gpart bootcode -p /boot/boot1.efifat -i1 nvd0

But don't do that for a version upgrade as already advised. I didn't do that and didn't encounter any problem even after zpool upgrade.

As already seen in this thread, if you want to upgrade your efi partition, you have to copy /boot/loader.efi into nvd0p1 as /EFI/BOOT/BOOTx64.efi.
I'm still putting this box together so I went ahead and did both. I rebooted successfully without updating the bootcode, then updated it and rebooted again. It went fine.
 
OP
Argentum

Argentum

Active Member

Reaction score: 57
Messages: 174

Do you have any further ideas? Want my machine to become bootable again without changing the motherboard.
So, eventually I replaced the HP motherboard and my system boots like before. It was a stable and good motherboard, but the UEFI boot did not want to work with FreeBSD.
 
Top