Solved My current FreeBSD installation does not take care at all of the /boot/loader.conf's commented lines.

Hello.

This is my /boot/loader.conf:

Code:
loader_logo="daemon"
#vmm_load="YES"
nmdm_load="YES"
if_tap_load="YES"
if_bridge_load="YES"
bridgestp_load="YES"
fusefs_load="YES"
tmpfs_load="YES"
verbose_loading="YES"
#pptdevs="0/2/0 2/0/0 2/0/1 2/0/2 2/0/3"
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
cryptodev_load="YES"
zfs_load="YES"
kern.racct.enable=1
aio_load="YES"
vboxdrv_load="YES"
kern.cam.scsi_delay=10000

I REALLY want to know why, if I have commented the two lines related to bhyve, #vmm_load="YES" and #pptdevs="0/2/0 2/0/0 2/0/1 2/0/2 2/0/3" I'm still able to launch a bhyve vm passing thru the gpus whose PCI addresses are inside the pptdevs argument. It seems that my system does not care at all to read the comment that I have added inside the /boot/loader.conf file. Or there is some different reason that I would like to understand. This is the proof. Despite the comment on the line line #vmm_load="YES", I still see that the vmm module is still loaded :

Code:
# kldstat | grep vmm
10    1 0xffffffff82794000   5848b8 vmm-intel.ko

as well as the ppt "driver", it is still attached despite I have commented the line #pptdevs="0/2/0 2/0/0 2/0/1 2/0/2 2/0/3"

Code:
pciconf -l

ppt4@pci0:0:2:0:        class=0x038000 rev=0x02 hdr=0x00 vendor=0x8086 device=0x3e98 subvendor=0x1458 subdevice=0xd000
ppt0@pci0:2:0:0:        class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1e04 subvendor=0x19da subdevice=0x2503
ppt1@pci0:2:0:1:        class=0x040300 rev=0xa1 hdr=0x00 vendor=0x10de device=0x10f7 subvendor=0x19da subdevice=0x2503
ppt2@pci0:2:0:2:        class=0x0c0330 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1ad6 subvendor=0x19da subdevice=0x2503
ppt3@pci0:2:0:3:        class=0x0c8000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1ad7 subvendor=0x19da subdevice=0x2503

I presume that every line I want to comment on this file,it will be ignored. WHY ?
 
Last edited by a moderator:
At what point is this? Is it a particular issue or extensible? I'm surprised no one has offered feedback, could it be a daily cron thing?
 
This is my /boot/loader.conf :
...

I REALLY want to know why,if I have commented the two lines related to bhyve,#vmm_load="YES" and "#pptdevs="0/2/0 2/0/0 2/0/1 2/0/2 2/0/3" I'm still able to launch a bhyve vm passing thru the gpus whose PCI addresses are inside the pptdevs argument. It seems that my system does not care at all to read the comment that I have added inside the /boot/loader.conf file. Or there is some different reason,that I would like to understand. This is the proof. Despite the comment on the line line "#vmm_load="YES",I still see that the vmm module is still loaded :

...

I presume that every line I want to comment on this file,it will be ignored. WHY ?
Could it be that you edited a ZFS systems /boot/loader.conf, but you are booting the ZFS system from a UFS system with following entries in its /boot/loader.conf:
Thanks. I would like also that zroot/ROOT/13.1-RELEASE-p5_2023-01-12_235731 will boot automatically without adding :

Code:
currdev="zfs:zroot/ROOT/13.1-RELEASE-p5_2023-01-12_235731"
vfs.root.mountfrom="zfs:zroot/ROOT/13.1-RELEASE-p5_2023-01-12_235731"

to the /boot/loader.conf file which belongs to the UFS disk. Yes,because the ZFS disk can't boot directly. To boot it I should use the UFS disk,adding those lines on the /boot/loader.conf file.

The above currdev, mountfrom variables and all other variables in the (assumed) UFS systems /boot/loader.conf are passed as boot environments and the UFS kernel is booted, then the ZFS root mounted. Check your UFS systems /boot/loader.conf for vmm_load and pptdevs and if present comment them out.

You say the ZFS system is not booting. If this is a UEFI system check efibootmgr if there is a boot entry for the ZFS system. When in doubt post output.

If there are multiple FreeBSD boot entries "BootOrder" will show which is booted first. It might be the UFS system and not the ZFS system.

Consider using a efi boot manager like rEFInd.
 
I presume that every line I want to comment on this file,it will be ignored. WHY ?
Because commenting an option means this option doesn't exist in your configuration and the default should be used. Uncomment and try setting to "NO" to see what happens.
 
Could it be that you edited a ZFS systems /boot/loader.conf, but you are booting the ZFS system from a UFS system with following entries in its /boot/loader.conf:


The above currdev, mountfrom variables and all other variables in the (assumed) UFS systems /boot/loader.conf are passed as boot environments and the UFS kernel is booted, then the ZFS root mounted. Check your UFS systems /boot/loader.conf for vmm_load and pptdevs and if present comment them out.

You say the ZFS system is not booting. If this is a UEFI system check efibootmgr if there is a boot entry for the ZFS system. When in doubt post output.

If there are multiple FreeBSD boot entries "BootOrder" will show which is booted first. It might be the UFS system and not the ZFS system.

Consider using a efi boot manager like rEFInd.

Code:
root@marietto:/usr/home/marietto # efibootmgr

Boot to FW : false
BootCurrent: 0006
Timeout    : 2 seconds
BootOrder  : 0006, 000F, 0097, 009C, 009E, 0008, 00A7, 00A9, 0005, 0089, 0002, 0001, 0009, 0000
+Boot0006* UEFI OS
 Boot000F* Windows Boot Manager
 Boot0097* UEFI OS
 Boot009C* ubuntu
 Boot009E* UEFI OS
 Boot0008* ubuntu
 Boot00A7* UEFI OS
 Boot00A9* UEFI OS
 Boot0005* UEFI OS
 Boot0089  UEFI OS
 Boot0002* grub
 Boot0001* Windows Boot Manager
 Boot0009* debian
 Boot0000* FreeBSD

what's the command to give to try to boot from another "FreeBSD" entry ? At the moment I choose from the BIOS the disk to boot first,but if I choose the ZFS disk it does not boot. Simply it boot the disk that's located below it.
 
At the moment I choose from the BIOS the disk to boot first,but if I choose the ZFS disk it does not boot. Simply it boot the disk that's located below it.
Instead changing the disk boot order in BIOS/UEFI, use the UEFI boot manager. There should be one, accessible by a function key. On my laptop it's F12. On your system it might be another key, see the motherboards manual. Eventually it's necessary to enable the boot manager in BIOS/UEFI.

I can't tell for sure (can't verify, on my laptop there is only one disk), but I suspect the UEFI boot manager overrules the BIOS boot disk order, and apparently since there is only one "FreeBSD" boot manager entry, which might boot the UFS disk, setting another entry for the ZFS disk could resolve the issue.

Please post
efibootmgr -v
gpart show -p <ZFS disk>
pgart show -p <UFS disk>
 
I think you should clean up your EFI boot menu. There are 7 "UEFI OS", 2 "Ubuntu" and 2 Windows selections. I'm not surprised you're getting confused.

what's the command to give to try to boot from another "FreeBSD" entry ?
Maybe read efibootmgr(8) and actually look at the examples at the end?
 
As an example ziomario i have a dual boot ubuntu-freebsd.
I only have one zfs-boot-environment.
I have two jails, one for compiling the kernel & one for compiling the ports.
I have only one ports-tree/ports-options/ports-set.
Note : When you over-complicate your system you tend to shoot yourself in the foot.
 
Instead changing the disk boot order in BIOS/UEFI, use the UEFI boot manager. There should be one, accessible by a function key. On my laptop it's F12. On your system it might be another key, see the motherboards manual. Eventually it's necessary to enable the boot manager in BIOS/UEFI.

I can't tell for sure (can't verify, on my laptop there is only one disk), but I suspect the UEFI boot manager overrules the BIOS boot disk order, and apparently since there is only one "FreeBSD" boot manager entry, which might boot the UFS disk, setting another entry for the ZFS disk could resolve the issue.

Please post
efibootmgr -v
gpart show -p <ZFS disk>
pgart show -p <UFS disk>

Code:
mario@marietto:/usr/home/marietto # sudo efibootmgr -v

Boot to FW : false
BootCurrent: 0006
Timeout    : 2 seconds
BootOrder  : 0006, 009E, 0008, 00A7, 009C, 0005, 000F, 0097, 00AD, 0000, 00AC, 0089, 0001, 0009, 000
2
+Boot0006* UEFI OS HD(1,GPT,1767d8e9-f3cf-11ec-8c52-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX6
4.EFI)
                      ada2p1:/EFI/BOOT/BOOTX64.EFI (null)
 Boot009E* UEFI OS HD(1,GPT,29c111e2-9a4f-11ec-88b7-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX6
4.EFI)
                      da4p1:/EFI/BOOT/BOOTX64.EFI (null)
 Boot0008* ubuntu HD(1,GPT,4502a2b7-2e6d-4435-92a8-67a9f823e9d2,0x800,0x1ab000)/File(\EFI\UBUNTU\SHI
MX64.EFI)
                     nvd0p1:/EFI/UBUNTU/SHIMX64.EFI (null)
 Boot00A7* UEFI OS HD(1,GPT,d9f72a5a-221f-11ec-a9b8-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX6
4.EFI)
                      da5p1:/EFI/BOOT/BOOTX64.EFI (null)
 Boot009C* ubuntu HD(2,GPT,539ed631-9942-46c4-af50-e25171fb0f26,0x800,0x1f4000)/File(\EFI\UBUNTU\SHI
MX64.EFI)
                     ada1p2:/EFI/UBUNTU/SHIMX64.EFI (null)
 Boot0005* UEFI OS HD(1,GPT,c4e43424-ae72-11ec-9419-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX6
4.EFI)
                      ada0p1:/EFI/BOOT/BOOTX64.EFI /boot/efi//EFI/BOOT/BOOTX64.EFI
 Boot000F* Windows Boot Manager HD(2,GPT,539ed631-9942-46c4-af50-e25171fb0f26,0x800,0x1f4000)/File(\
EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)
                                   ada1p2:/EFI/MICROSOFT/BOOT/BOOTMGFW.EFI (null)
 Boot0097* UEFI OS HD(1,GPT,1767d8e9-f3cf-11ec-8c52-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX6
4.EFI)
                      ada2p1:/EFI/BOOT/BOOTX64.EFI (null)
 Boot00AD* UEFI OS HD(1,GPT,b99f97fd-9780-11ed-bafa-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX6
4.EFI)
                      da1p1:/EFI/BOOT/BOOTX64.EFI (null)
 Boot0000* FreeBSD HD(1,GPT,cc7c5068-9c4b-11ed-8297-e0d55ee21f22,0x28,0x82000)/File(\EFI\FREEBSD\LOA
DER.EFI)
                      da0p1:/EFI/FREEBSD/LOADER.EFI (null)
 Boot00AC* UEFI OS HD(1,GPT,cc7c5068-9c4b-11ed-8297-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX6
4.EFI)
                      da0p1:/EFI/BOOT/BOOTX64.EFI (null)
 Boot0089  UEFI OS HD(1,GPT,c4e43424-ae72-11ec-9419-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX6
4.EFI)
                      ada0p1:/EFI/BOOT/BOOTX64.EFI /boot/efi//EFI/BOOT/BOOTX64.EFI
 Boot0001* Windows Boot Manager HD(1,GPT,4502a2b7-2e6d-4435-92a8-67a9f823e9d2,0x800,0x1ab000)/File(\
EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)
                                   nvd0p1:/EFI/MICROSOFT/BOOT/BOOTMGFW.EFI (null)
 Boot0009* debian VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
                 HD(1,GPT,a1207e93-b973-432d-8196-ddfe3a6d0488,0x800,0x100000)/File(\EFI\DEBIAN\SHIM
X64.EFI)
 Boot0002* grub VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
               HD(1,GPT,04eacbe0-edf6-4f55-8c8e-0505c10a0915,0x800,0x100000)/File(\EFI\grub\shimx64.
efi)


Unreferenced Variables:
 Boot0055  TOSHIBA External USB 3.00 BBS(HD,,0x0)
                                    PciRoot(0x0)/Pci(0x14,0x0)/USB(0x12,0x0)
                                    VenHw(2d6447ef-3bc9-41a0-ac19-4d51d01b4ce6,320030003100330030003
5003000360030003000350039003700360046000000)
 Boot000D  WDC WD3200AAJS-00L7A0 BBS(HD,,0x0)
                                PciRoot(0x0)/Pci(0x17,0x0)/Sata(0x3,0xffff,0x0)
                                VenHw(2d6447ef-3bc9-41a0-ac19-4d51d01b4ce6,2000200020002000570020002
d0044004300570056004100580032003900350033003700390030000000)

mario@marietto:/usr/home/marietto # sudo gpart show -p /dev/ada0

=>       40  976773095    ada0  GPT  (466G)
         40     532480  ada0p1  efi  (260M)
     532520       1024  ada0p2  freebsd-boot  (512K)
     533544        984          - free -  (492K)
     534528    4194304  ada0p3  freebsd-swap  (2.0G)
    4728832  972044288  ada0p4  freebsd-zfs  (464G)
  976773120         15          - free -  (7.5K)

mario@marietto:/usr/home/marietto # sudo gpart show -p /dev/ada2

=>       40  625142375    ada2  GPT  (298G)
         40     532480  ada2p1  efi  (260M)
     532520  616030208  ada2p2  freebsd-ufs  (294G)
  616562728    8388608  ada2p3  freebsd-swap  (4.0G)
  624951336     191079          - free -  (93M)
 
I've pruned some entries and now I have :

Code:
mario@marietto:/usr/home/marietto # sudo efibootmgr -v

Boot to FW : false
BootCurrent: 0006
Timeout    : 2 seconds
BootOrder  : 0006, 0008, 009C, 0005, 0097, 00AD, 00AC, 0001

+Boot0006* UEFI OS HD(1,GPT,1767d8e9-f3cf-11ec-8c52-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX64.EFI)
                      ada2p1:/EFI/BOOT/BOOTX64.EFI (null)

 Boot0008* ubuntu HD(1,GPT,4502a2b7-2e6d-4435-92a8-67a9f823e9d2,0x800,0x1ab000)/File(\EFI\UBUNTU\SHIMX64.EFI)
                     nvd0p1:/EFI/UBUNTU/SHIMX64.EFI (null)

 Boot009C* ubuntu HD(2,GPT,539ed631-9942-46c4-af50-e25171fb0f26,0x800,0x1f4000)/File(\EFI\UBUNTU\SHIMX64.EFI)
                     ada1p2:/EFI/UBUNTU/SHIMX64.EFI (null)

 Boot0005* UEFI OS HD(1,GPT,c4e43424-ae72-11ec-9419-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX64.EFI)
                      ada0p1:/EFI/BOOT/BOOTX64.EFI /boot/efi//EFI/BOOT/BOOTX64.EFI

 Boot0097* UEFI OS HD(1,GPT,1767d8e9-f3cf-11ec-8c52-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX64.EFI)
                      ada2p1:/EFI/BOOT/BOOTX64.EFI (null)

 Boot00AD* UEFI OS HD(1,GPT,b99f97fd-9780-11ed-bafa-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX64.EFI)
                      da1p1:/EFI/BOOT/BOOTX64.EFI (null)

 Boot00AC* UEFI OS HD(1,GPT,cc7c5068-9c4b-11ed-8297-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX64.EFI)
                      da0p1:/EFI/BOOT/BOOTX64.EFI (null)

 Boot0001* Windows Boot Manager HD(1,GPT,4502a2b7-2e6d-4435-92a8-67a9f823e9d2,0x800,0x1ab000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)
                                   nvd0p1:/EFI/MICROSOFT/BOOT/BOOTMGFW.EFI (null)

Unreferenced Variables:

mario@marietto:/usr/home/marietto # gpart show

=>        34  1953525101  nvd0  GPT  (932G)
          34        2014        - free -  (1.0M)
        2048     1748992     1  efi  (854M)
     1751040   921985024     2  ms-basic-data  (440G)
   923736064       32768     3  ms-reserved  (16M)
   923768832   191490048        - free -  (91G)
  1115258880   833185547     4  ms-basic-data  (397G)
  1948444427         245        - free -  (123K)
  1948444672     1318912     5  ms-recovery  (644M)
  1949763584        2048        - free -  (1.0M)
  1949765632     1310720     6  ms-recovery  (640M)
  1951076352        2048        - free -  (1.0M)
  1951078400     1265657     7  ms-basic-data  (618M)
  1952344057           7        - free -  (3.5K)
  1952344064     1179641     8  ms-basic-data  (576M)
  1953523705        1430        - free -  (715K)

=>       40  976773095  ada0  GPT  (466G)
         40     532480     1  efi  (260M)
     532520       1024     2  freebsd-boot  (512K)
     533544        984        - free -  (492K)
     534528    4194304     3  freebsd-swap  (2.0G)
    4728832  972044288     4  freebsd-zfs  (464G)
  976773120         15        - free -  (7.5K)

=>       34  976773101  ada1  GPT  (466G)
         34       2014        - free -  (1.0M)
       2048    2048000     2  ms-basic-data  (1.0G)
    2050048  967004160     1  linux-data  (461G)
  969054208    7718927        - free -  (3.7G)

=>       40  625142375  ada2  GPT  (298G)
         40     532480     1  efi  (260M)
     532520  616030208     2  freebsd-ufs  (294G)
  616562728    8388608     3  freebsd-swap  (4.0G)
  624951336     191079        - free -  (93M)

=>       40  625142368  da0  GPT  (298G)
         40     532480    1  efi  (260M)
     532520  616030208    2  freebsd-ufs  (294G)
  616562728    8388608    3  freebsd-swap  (4.0G)
  624951336     191072       - free -  (93M)

=>       40  488397088  da1  GPT  (233G)
         40     532480    1  efi  (260M)
     532520  479715328    2  freebsd-ufs  (229G)
  480247848    8149280    3  freebsd-swap  (3.9G)

=>        40  1953525095  da2  GPT  (932G)
          40      532480    1  efi  (260M)
      532520        1024    2  freebsd-boot  (512K)
      533544         984       - free -  (492K)
      534528     4194304    3  freebsd-swap  (2.0G)
     4728832  1948794880    4  freebsd-zfs  (929G)
  1953523712        1423       - free -  (712K)

=>         34  23437705149  da3  GPT  (11T)
           34         2014       - free -  (1.0M)
         2048  23437701120    1  ms-basic-data  (11T)
  23437703168         2015       - free -  (1.0M)

=>        40  3907029095  da4  GPT  (1.8T)
          40      532480    1  efi  (260M)
      532520  3898073080    2  freebsd-ufs  (1.8T)
  3898605600     8388608    3  freebsd-swap  (4.0G)
  3906994208       34927       - free -  (17M)

=>        40  3907029094  da5  GPT  (1.8T)
          40      532480    1  efi  (260M)
      532520  3898073080    2  freebsd-ufs  (1.8T)
  3898605600     8388608    3  freebsd-swap  (4.0G)
  3906994208       34926       - free -  (17M)
 
I see that a boot entry that points to the disk I want,ada0,is missing. Maybe I can create it with this command :

Code:
# ls /boot

beastie.4th             entropy                 loader.4th              logo-beastie.4th        pxeboot
boot                    firmware                loader.conf             logo-beastiebw.4th      screen.4th
boot1.efi               fonts                   loader.conf.d           logo-fbsdbw.4th         shortcuts.4th
brand-fbsd.4th          frames.4th              loader.efi              logo-orb.4th            support.4th
brand.4th               gptboot                 loader.rc               logo-orbbw.4th          uboot
cdboot                  gptboot.efi             loader_4th              lua                     userboot.so
check-password.4th      gptzfsboot              loader_4th.efi          mbr                     userboot_4th.so
color.4th               images                  loader_4th.old          menu-commands.4th       userboot_lua.so
defaults                isoboot                 loader_lua              menu.4th                version.4th
delay.4th               kernel                  loader_lua.efi          menu.rc                 zfs
device.hints            kernel.old              loader_lua.old          menusets.4th            zfsboot
dtb                     kernel.old1             loader_simp             modules                 zfsloader
efi                     kernels-old             loader_simp.efi         modules-ufs
efi.4th                 loader                  loader_simp.old         pmbr

mount -t msdosfs /dev/ada0p1 /mnt/ada0p1
mount_msdosfs: /dev/ada0p1: Device busy

sudo efibootmgr -c -d /dev/ada0 -p 1 -L "FreeBSD zfs" -l '/boot/loader.efi'

efibootmgr: Cannot translate unix loader path '\boot\loader.efi' to UEFI: No such file or directory

'

or maybe :

Code:
# sudo efibootmgr -c -d /dev/ada0 -p 1 -L "FreeBSD zfs" -l '\EFI\BOOT\BOOTX64.EFI'

efibootmgr: Cannot translate unix loader path '\EFI\BOOT\BOOTX64.EFI' to UEFI: No such file or directory

what's the difference between using EFI\BOOT\BOOTX64.EFI or EFI\BOOT\LOADER.EFI ? what's the better choice between the two options ? thanks.
 
I see that a boot entry that points to the disk I want,ada0,is missing.

It's not missing, it's right there, as the forth system to boot. But the entry is named incomprehensible (UEFI OS):
BootOrder : 0006, 0008, 009C, 0005, 0097, 00AD, 00AC, 0001
...
Boot0005* UEFI OS HD(1,GPT,c4e43424-ae72-11ec-9419-e0d55ee21f22,0x28,0x82000)/File(\EFI\BOOT\BOOTX64.EFI)
.....................................ada0p1:/EFI/BOOT/BOOTX64.EFI /boot/efi//EFI/BOOT/BOOTX64.EFI
You should be able to boot from that boot entry choosing it from the machines UEFI boot manager. In case you are unfamiliar with the UEFI boot manager, it is called by pressing one of the function keys shortly after the machine is powered up or rebooted. On my laptop it's F12, on your machine it may differ, see the motherboards manual.

Nevertheless, I suggest to delete that entry and create a new one with a unique name.

sudo efibootmgr -c -d /dev/ada0 -p 1 -L "FreeBSD zfs" -l '/boot/loader.efi'
Taking the output of ls /boot you are obviously booted in a FreeBSD system. The -d option doesn't exist in FreeBSDs efibootmgr(8), you are mixing it up with the one found in Linux.

Also the -l option path to loader.efi is wrong. It must be the one in the FAT32 formated "efi" partition of ada0p1, not the one in the FreeBSD partition.

If you would have had a look at the manual, you would have seen an example there.
Code:
Examples
     ...
     The efibootmgr program can be used to create new EFI boot variables.  The
     following command may be used to create a new boot method, using the EFI
     partition mounted under /mnt, mark the method active, using the given
     loader and label the method "FreeBSD-11":

           efibootmgr -a -c -l /mnt/EFI/freebsd/loader.efi -L FreeBSD-11

There are different ways to set the -l option. It can be a mount point or a partition name and path where the loader.efi is located. I prefere the latter, since the official 13.1-RELEASE FreeBSD installer does the same. Example
Code:
 # efibootmgr -a -c -L FreeBSDzfs -l ada0p1:/efi/freebsd/loader.conf

This is a screenshot of a 13.1-RELEASE VM efibootmgr -v output. The boot entry was automatically created by bsdinstall(8) bootconfig. Notice the line with loader.efi:

efibootmgr.png
 
----> Also the -l option path to loader.efi is wrong. It must be the one in the FAT32 formated "efi" partition of ada0p1, not the one in the FreeBSD partition.

nope. In the boot partition there isn't any loader.efi file. The only file present is BOOTx64.efi :

Code:
# mount -t msdos /dev/ada0p1 /mnt/ada0p1
# cd /mnt/ada0p1
# ls
efi

# cd efi
# ls
boot

# cd boot
# ls
BOOTx64.efi

so,maybe this works:

Code:
# efibootmgr -a -c -L FreeBSD-ZFS -l /mnt/ada0p1/efi/boot/BOOTx64.efi

otherwise I should mount the ada0p4 partition,where is the loader.efi file,but it's ZFS,not UFS. So,I presume that I should do :

Code:
# zpool import -f -R /mnt/zroot zroot

# zfs list

NAME                                                                 USED  AVAIL     REFER  MOUNTPOINT
zroot                                                                342G   104G       96K  /mnt/zroot/zroot
zroot/ROOT                                                           273G   104G       96K  none
zroot/ROOT/13.1-RELEASE-p5_2023-01-12_235731                         199M   104G      137G  /mnt/zroot
zroot/ROOT/13.1-RELEASE-p5_2023-01-20_181957                         273G   104G      242G  /mnt/zroot
zroot/ROOT/13.1-RELEASE-p5_2023-01-20_181957@2023-01-20-18:19:57-0  30.2G      -      140G  -
zroot/tmp                                                           39.8M   104G     39.8M  /mnt/zroot/tmp
zroot/usr                                                           66.5G   104G      120K  /mnt/zroot/usr
zroot/usr/home                                                      54.0G   104G     54.0G  /mnt/zroot/usr/home
zroot/usr/ports                                                     9.29G   104G     9.29G  /mnt/zroot/usr/ports
zroot/usr/src                                                       3.26G   104G     3.26G  /mnt/zroot/usr/src
zroot/var                                                           2.46G   104G      136K  /mnt/zroot/var
zroot/var/audit                                                       96K   104G       96K  /mnt/zroot/var/audit
zroot/var/crash                                                     1.11G   104G     1.11G  /mnt/zroot/var/crash
zroot/var/log                                                       4.28M   104G     4.28M  /mnt/zroot/var/log
zroot/var/mail                                                      1.33G   104G     1.33G  /mnt/zroot/var/mail
zroot/var/tmp                                                       18.1M   104G     18.1M  /mnt/zroot/var/tmp

# zfs mount zroot/ROOT/13.1-RELEASE-p5_2023-01-20_181957

/mnt/zroot/boot # ls

beastie.4th             frames.4th              loader_4th.efi          menu.rc
boot                    gptboot                 loader_4th.old          menusets.4th
boot1.efi               gptboot.efi             loader_lua              modules
brand-fbsd.4th          gptzfsboot              loader_lua.efi          modules-ufs
brand.4th               images                  loader_lua.old          pmbr
cdboot                  isoboot                 loader_simp             pxeboot
check-password.4th      kernel                  loader_simp.efi         screen.4th
color.4th               kernel.old              loader_simp.old         shortcuts.4th
defaults                kernel.old1             logo-beastie.4th        support.4th
delay.4th               kernels-old             logo-beastiebw.4th      uboot
device.hints            loader                  logo-fbsdbw.4th         userboot.so
dtb                     loader.4th              logo-orb.4th            userboot_4th.so
efi                     loader.conf             logo-orbbw.4th          userboot_lua.so
efi.4th                 loader.conf.d           lua                     version.4th
entropy                 loader.efi              mbr                     zfs
firmware                loader.rc               menu-commands.4th       zfsboot
fonts                   loader_4th              menu.4th                zfsloader

and finally :

Code:
 efibootmgr -a -c -l /mnt/zroot/boot/loader.efi -L FreeBSD-ZFS

what's the correct one,in your opinion ?
 
this does not work :

Code:
# efibootmgr -a -c -l /mnt/zroot/boot/loader.efi -L FreeBSD-ZFS
 
efibootmgr: Cannot translate unix loader path '\mnt\zroot\boot\loader.efi' to UEFI: No such file or directory

this even does not work :

Code:
# efibootmgr -a -c -L FreeBSD-ZFS -l /mnt/ada0p1/efi/boot/BOOTx64.efi

Boot to FW : false
BootCurrent: 00ac
Timeout    : 2 seconds
BootOrder  : 0000, 00AC, 00AD, 0008, 009C, 0006, 00AE, 00AF, 0001
 Boot0000* FreeBSD-ZFS
+Boot00AC* UEFI OS
 Boot00AD* UEFI OS
 Boot0008* ubuntu
 Boot009C* ubuntu
 Boot0006* UEFI OS
 Boot00AE* UEFI OS
 Boot00AF* UEFI OS
 Boot0001* Windows Boot Manager

this is the error message that I see when I have rebooted the PC :

WhatsApp Image 2023-01-28 at 23.32.42.jpeg
 
maybe doing like this,it will work :

Code:
# zpool import -f -R /mnt/zroot zroot
# cd /mnt/zroot
# zfs mount zroot/ROOT/13.1-RELEASE-p5_2023-01-20_181957
# ls

_ZFS_    compat    entropy    lib    media    opt    root    sys    var
bin    data    etc    lib64    mnt    proc    sbin    tmp    vms
boot    dev    home    libexec    net    rescue    share    usr    zroot

# cd boot
# ls

beastie.4th        frames.4th        loader_4th.efi        menu.rc
boot            gptboot            loader_4th.old        menusets.4th
boot1.efi        gptboot.efi        loader_lua        modules
brand-fbsd.4th        gptzfsboot        loader_lua.efi        modules-ufs
brand.4th        images            loader_lua.old        pmbr
cdboot            isoboot            loader_simp        pxeboot
check-password.4th    kernel            loader_simp.efi        screen.4th
color.4th        kernel.old        loader_simp.old        shortcuts.4th
defaults        kernel.old1        logo-beastie.4th    support.4th
delay.4th        kernels-old        logo-beastiebw.4th    uboot
device.hints        loader            logo-fbsdbw.4th        userboot.so
dtb            loader.4th        logo-orb.4th        userboot_4th.so
efi            loader.conf        logo-orbbw.4th        userboot_lua.so
efi.4th            loader.conf.d        lua            version.4th
entropy            loader.efi        mbr            zfs
firmware        loader.rc        menu-commands.4th    zfsboot
fonts            loader_4th        menu.4th        zfsloader

# cd efi
# mkdir efi
# cd efi
# mkdir freebsd
# cp /boot/loader.efi /boot/efi/efi/freebsd/loader.efi

so :

Code:
# efibootmgr -a -c -l /boot/efi/efi/freebsd/loader.efi -L FreeBSD-13.1-ZFS

# efibootmgr -v

Boot to FW : false
BootCurrent: 0006
Timeout    : 2 seconds
BootOrder  : 0002, 0006, 00AC, 00AD, 0008, 009C, 0000, 00AE, 00AF, 00B0, 0001

 Boot0002* FreeBSD-13.1-ZFS HD(1,GPT,1767d8e9-f3cf-11ec-8c52-e0d55ee21f22,0x28,0x82000)/File(\efi\freebsd\loader.efi)
                               ada2p1:/efi/freebsd/loader.efi /boot/efi//efi/freebsd/loader.efi
 
The previous attempt does not work. Maybe this :

Code:
mario@marietto:/mnt/zroot # cd /boot

mario@marietto:/boot # cd efi

mario@marietto:/boot/efi # cd efi

mario@marietto:/boot/efi/efi # ls
boot

mario@marietto:/boot/efi/efi # mkdir freebsd

mario@marietto:/boot/efi/efi # ls
boot    freebsd

mario@marietto:/boot/efi/efi # cd freebsd

mario@marietto:/boot/efi/efi/freebsd # cp /boot/loader.efi /boot/efi/efi/freebsd/loader.efi

mario@marietto:/boot/efi/efi/freebsd # efibootmgr -a -c -l /boot/efi/efi/freebsd/loader.efi -L FreeBSD-13.1-ZFS

Boot to FW : false
BootCurrent: 0002
Timeout    : 2 seconds
BootOrder  : 0000, 0006, 00AC, 00AD, 0008, 009C, 00B0, 0001
 Boot0000* FreeBSD-13.1-ZFS
 Boot0006* UEFI OS
 Boot00AC* UEFI OS
 Boot00AD* UEFI OS
 Boot0008* ubuntu
 Boot009C* ubuntu
 Boot00B0* Windows Boot Manager
 Boot0001* Windows Boot Manager

mario@marietto:/boot/efi/efi/freebsd # efibootmgr -v

Boot to FW : false
BootCurrent: 0002
Timeout    : 2 seconds
BootOrder  : 0000, 0006, 00AC, 00AD, 0008, 009C, 00B0, 0001
 Boot0000* FreeBSD-13.1-ZFS HD(1,GPT,c4e43424-ae72-11ec-9419-e0d55ee21f22,0x28,0x82000)/File(\efi\freebsd\loader.efi)
                               ada0p1:/efi/freebsd/loader.efi /boot/efi//efi/freebsd/loader.efi
 
Promemoria and final solution :

Code:
mario@marietto:/ # sudo zpool import -f -R /mnt/zroot zroot

mario@marietto:/ # sudo cd /mnt/zroot

mario@marietto:/mnt/zroot # sudo zfs mount zroot/ROOT/13.1-RELEASE-p5_2023-01-12_235731

mario@marietto:/mnt/zroot # sudo mkdir -p /boot/efi/efi/freebsd

mario@marietto:/boot # sudo cp /boot/loader.efi /boot/efi/efi/freebsd/

mario@marietto:/boot # sudo efibootmgr -a -c -l /boot/efi/efi/freebsd/loader.efi -L FreeBSD-13.1-ZFS
 
Thank You Mario, for this Lucid piece of information


# sudo zpool import -f -R /mnt/zroot zroot

# sudo cd /mnt/zroot

# sudo zfs mount zroot/ROOT/13.1-RELEASE-p5_2023-01-12_235731

# sudo mkdir -p /boot/efi/efi/freebsd

# sudo cp /boot/loader.efi /boot/efi/efi/freebsd/

# sudo efibootmgr -a -c -l /boot/efi/efi/freebsd/loader.efi -L FreeBSD-13.1-ZFS
 
Back
Top