You are not logged in.

#1 2022-10-05 15:33:23

prashanthvsdvn
Member
Registered: 2022-10-05
Posts: 5

[SOLVED] Problems generating EFIstubs in my HP laptop

So I'm trying to migrate away from Grub to EFIstub in my HP laptop. I tried the following steps as suggested in the Wiki.
My Laptop is an HP 14 series.

sudo efibootmgr --disk /dev/sda --part 5 --create --label "AAAAAAAAArch Linux" --loader /vmlinuz-linux --unicode 'root=PARTUUID=6ac87227-7684-4c2d-94d0-e57a368ab1d6 rw initrd=\initramfs-linux.img initrd=\intel-ucode.img'

Running `efibootmgr` to verify shows the following output

BootCurrent: 0005
Timeout: 0 seconds
BootOrder: 0000,0001,3001,0005,2001,2002,2004
Boot0000* AAAAAAAAArch Linux    HD(5,GPT,6ac87227-7684-4c2d-94d0-e57a368ab1d6,0x1f7a3800,0x12c00000)/File(\vmlinuz-linux)72006f006f0074003d00500041005200540055005500490044003d00360061006300380037003200320037002d0037003600380034002d0034006300320064002d0039003400640030002d00650035003700610033003600380061006200310064003600200072007700200069006e0069007400720064003d005c0069006e0069007400720061006d00660073002d006c0069006e00750078002e0069006d006700200069006e0069007400720064003d005c0069006e00740065006c002d00750063006f00640065002e0069006d006700
Boot0001* Windows Boot Manager  HD(2,GPT,dd1eda0c-52bb-4381-ade9-39e003df403e,0x109000,0x32000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000074000100000010000000040000007fff0400
Boot0004* USB Hard Drive (UEFI) - SanDisk       PciRoot(0x0)/Pci(0x14,0x0)/USB(1,0)/HD(2,MBR,0x738ef4dd,0x3947c00,0x400)RC
Boot0005* arch  HD(2,GPT,dd1eda0c-52bb-4381-ade9-39e003df403e,0x109000,0x32000)/File(\EFI\arch\grubx64.efi)
Boot2001* EFI USB Device        RC
Boot2002* EFI DVD/CDROM RC
Boot3001* Internal Hard Disk or Solid State Disk        RC

However, upon restart I don't see the Boot Option that I had created.
Running `efibootmgr` after reboot shows the following.

BootCurrent: 0005
Timeout: 0 seconds
BootOrder: 0001,3001,0005,2001,2002,2004
Boot0001* Windows Boot Manager	HD(2,GPT,dd1eda0c-52bb-4381-ade9-39e003df403e,0x109000,0x32000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000074000100000010000000040000007fff0400
Boot0004* USB Hard Drive (UEFI) - SanDisk	PciRoot(0x0)/Pci(0x14,0x0)/USB(1,0)/HD(2,MBR,0x738ef4dd,0x3947c00,0x400)RC
Boot0005* arch	HD(2,GPT,dd1eda0c-52bb-4381-ade9-39e003df403e,0x109000,0x32000)/File(\EFI\arch\grubx64.efi)
Boot2001* EFI USB Device	RC
Boot2002* EFI DVD/CDROM	RC
Boot3001* Internal Hard Disk or Solid State Disk	RC

What am I missing? Is it a mistake from my side ? or the implementation of UEFI in HP firmware?

Last edited by prashanthvsdvn (2022-10-05 18:42:53)

Offline

#2 2022-10-05 15:53:22

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,076

Re: [SOLVED] Problems generating EFIstubs in my HP laptop

Issue with the EFI firmware. Check whether they have their own loader adding implementation... Other potential cause, you did set the GUID of the ESP on the Arch drive to C12A7328-F81F-11D2-BA4B-00A0C93EC93 ? https://wiki.archlinux.org/title/EFI_sy … oned_disks

Offline

#3 2022-10-05 16:03:03

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,350

Re: [SOLVED] Problems generating EFIstubs in my HP laptop

I have had issues with HP laptops where entries in nvram, created with efibootmgr, disappear on reboot.  I had this issue when switching an HP Envy laptop to systemd-boot recently, where the entry created by bootctl install disappeared from the boot entries.  In my case the solution was to create the entry, and then immediately after shutting down to boot to the UEFI  firmware (BIOS), and look under the 'boot' tab, and under the boot order section, there is an OS boot order section which had a Windows boot entry as well as the Linux Boot manager entry (It is dual boot)) - using the f5/6 order switcher, as well as the up/down arrow to select the entry I want to be at the top, and to be made permanent, and then hitting f10 to save and exit from that menu item, as well as f10 again once I was out into the top level of the firmware, was the only way I found that I could make the nvram entry 'stick' for future reboots. After that I then recreated the entry, and it then did remain in nvram through further reboots. It might be  worth trying that if it is in your BIOS options (or if the BIOS has an advanced section, the corresponding settings could be there instead of under the 'boot' options tab).

Last edited by mcloaked (2022-10-05 16:08:12)


Mike C

Offline

#4 2022-10-05 16:06:20

prashanthvsdvn
Member
Registered: 2022-10-05
Posts: 5

Re: [SOLVED] Problems generating EFIstubs in my HP laptop

V1del wrote:

Issue with the EFI firmware. Check whether they have their own loader adding implementation... Other potential cause, you did set the GUID of the ESP on the Arch drive to C12A7328-F81F-11D2-BA4B-00A0C93EC93 ? https://wiki.archlinux.org/title/EFI_sy … oned_disks

The GUID is set correctly. I had been using the same partition for dual booting both Windows as well as Arch (via grub). And any idea how or what to check for in the firmware?

Offline

#5 2022-10-05 16:11:48

prashanthvsdvn
Member
Registered: 2022-10-05
Posts: 5

Re: [SOLVED] Problems generating EFIstubs in my HP laptop

mcloaked wrote:

I have had issues with HP laptops where entries in nvram, created with efibootmgr, disappear on reboot.  I had this issue when switching an HP Envy laptop to systemd-boot recently, where the entry created by bootctl install disappeared from the boot entries.  In my case the solution was to create the entry, and then immediately after shutting down to boot to the UEFI  firmware (BIOS), and look under the 'boot' tab, and under the boot order section, there is an OS boot order section which had a Windows boot entry as well as the Linux Boot manager entry (It is dual boot)) - using the f5/6 order switcher, as well as the up/down arrow to select the entry I want to be at the top, and to be made permanent, and then hitting f10 to save and exit from that menu item, as well as f10 again once I was out into the top level of the firmware, was the only way I found that I could make the nvram entry 'stick' for future reboots. After that I then recreated the entry, and it then did remain in nvram through further reboots. It might be  worth trying that if it is in your BIOS options (or if the BIOS has an advanced section, the corresponding settings could be there instead of under the 'boot' options tab).

I checked the same section after creating the entry with efibootmgr. But I was only able to find the entry created with the Grub and the windows, not the one with efibootmgr.

Offline

#6 2022-10-05 16:20:03

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,350

Re: [SOLVED] Problems generating EFIstubs in my HP laptop

prashanthvsdvn wrote:
mcloaked wrote:

I have had issues with HP laptops where entries in nvram, created with efibootmgr, disappear on reboot.  I had this issue when switching an HP Envy laptop to systemd-boot recently, where the entry created by bootctl install disappeared from the boot entries.  In my case the solution was to create the entry, and then immediately after shutting down to boot to the UEFI  firmware (BIOS), and look under the 'boot' tab, and under the boot order section, there is an OS boot order section which had a Windows boot entry as well as the Linux Boot manager entry (It is dual boot)) - using the f5/6 order switcher, as well as the up/down arrow to select the entry I want to be at the top, and to be made permanent, and then hitting f10 to save and exit from that menu item, as well as f10 again once I was out into the top level of the firmware, was the only way I found that I could make the nvram entry 'stick' for future reboots. After that I then recreated the entry, and it then did remain in nvram through further reboots. It might be  worth trying that if it is in your BIOS options (or if the BIOS has an advanced section, the corresponding settings could be there instead of under the 'boot' options tab).

I checked the same section after creating the entry with efibootmgr. But I was only able to find the entry created with the Grub and the windows, not the one with efibootmgr.

I found that happened also, but using systemd-boot to reboot directly to firmware immediately after creating the new entry, in my case the Linux Boot Manager was there in that section.  Also in that section if your Windows entry is above the Grub entry, then you need to use either f5 or f6 to swap them over, and then make sure the Grub entry at the top is also highlighted as current, and then saved with f10 - and saving and exiting from the firmware with f10 again. It is possible you may then need to recreate the entry with efibootmgr and do the same process again until you can move your wanted entry to the top, correctly highlighted, and saved again with f10.  If Windows is the top entry then  that is what led to the new entry written by efibootmgr not being persistent in my case - a very annoying issue for sure.  Also it is possible that poweroff, and reboot cold may retain the entry if booting immediately into firmware - as opposed to rebooting without a cold shutdown - but you may need to try variations until it has your new entry still there when booting to the firmware with the new nvram entry. it is possible that different HP laptop firmwares may perform differently depending on firmware and laptop version.

Last edited by mcloaked (2022-10-05 16:21:34)


Mike C

Offline

#7 2022-10-05 18:06:31

prashanthvsdvn
Member
Registered: 2022-10-05
Posts: 5

Re: [SOLVED] Problems generating EFIstubs in my HP laptop

mcloaked wrote:

I found that happened also, but using systemd-boot to reboot directly to firmware immediately after creating the new entry, in my case the Linux Boot Manager was there in that section.  Also in that section if your Windows entry is above the Grub entry, then you need to use either f5 or f6 to swap them over, and then make sure the Grub entry at the top is also highlighted as current, and then saved with f10 - and saving and exiting from the firmware with f10 again. It is possible you may then need to recreate the entry with efibootmgr and do the same process again until you can move your wanted entry to the top, correctly highlighted, and saved again with f10.  If Windows is the top entry then  that is what led to the new entry written by efibootmgr not being persistent in my case - a very annoying issue for sure.  Also it is possible that poweroff, and reboot cold may retain the entry if booting immediately into firmware - as opposed to rebooting without a cold shutdown - but you may need to try variations until it has your new entry still there when booting to the firmware with the new nvram entry. it is possible that different HP laptop firmwares may perform differently depending on firmware and laptop version.

Ok, I figured out where I screwed up. Apparently, I had mounted my esp to /efi and my initramfs images live in /boot. Copying over the the initramfs images and the vmlinuz-linux to esp and running the efibootmgr, with updated path, creates the Boot Option as expected. And I was able to boot via grub as well as the EFIstub image, regardless of where they were in the Boot Order.

Last edited by prashanthvsdvn (2022-10-05 18:07:55)

Offline

#8 2022-10-05 18:27:47

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,350

Re: [SOLVED] Problems generating EFIstubs in my HP laptop

I also have my esp mounted at /efi and kernel and initrd files in  /boot where /boot is a partition of type EA00 (xbootldr)  on the same drive as the efi  .  That should in principle be fine, provided the /boot partition is type EA00. Often the pre-existing efi on a machine that was pre-installed with Windows is quite small, and if you have several different Linux kernels the efi might be too limited in capacity to hold the necessary files. But glad you found a solution by placing all the files in the /efi partition.

Last edited by mcloaked (2022-10-05 18:28:56)


Mike C

Offline

#9 2022-10-05 18:41:23

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,076

Re: [SOLVED] Problems generating EFIstubs in my HP laptop

That does explain things. Yes for direct EFIstubs to be bootable they need to reside on the ESP. Please mark as [SOLVED] by editing the title in your first post.

Offline

#10 2022-10-05 18:50:21

prashanthvsdvn
Member
Registered: 2022-10-05
Posts: 5

Re: [SOLVED] Problems generating EFIstubs in my HP laptop

mcloaked wrote:

I also have my esp mounted at /efi and kernel and initrd files in  /boot where /boot is a partition of type EA00 (xbootldr)  on the same drive as the efi  .  That should in principle be fine, provided the /boot partition is type EA00. Often the pre-existing efi on a machine that was pre-installed with Windows is quite small, and if you have several different Linux kernels the efi might be too limited in capacity to hold the necessary files. But glad you found a solution by placing all the files in the /efi partition.

Did you have to create a new partition for /boot? And how did you specify the 'initrd' path from esp which is at /efi? Since I am also using the esp partition that windows has created, there isn't much space there as well. And I don't want to copy the initramfs images everytime kernel gets updated.

Offline

#11 2022-10-05 18:53:34

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,076

Re: [SOLVED] Problems generating EFIstubs in my HP laptop

Just mount your esp to /boot. You can't avoid having to place the kernels there if you indeed intend to run a EFISTUB setup. What mcloaked is likely doing is using systemd-boot which can then use the xbootldr partition to load kernels. You either need another FAT partition for that or install/place UEFI drivers for the filesystem your kernels are on.

Offline

#12 2022-10-05 19:08:45

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,350

Re: [SOLVED] Problems generating EFIstubs in my HP laptop

V1del wrote:

Just mount your esp to /boot. You can't avoid having to place the kernels there if you indeed intend to run a EFISTUB setup. What mcloaked is likely doing is using systemd-boot which can then use the xbootldr partition to load kernels. You either need another FAT partition for that or install/place UEFI drivers for the filesystem your kernels are on.

Yes, that is correct - the original esp on my laptop is mounted at /efi in my case (vfat), and the /boot partition is xbootldr type with an ext4 filesystem on it - and indeed there are drivers available from the efifs package that allow systemd-boot to read the kernels and initrd files on the ext4 filesystem mounted at /boot. The /boot partition can be made big enough to hold whichever set of kernel files you wish.  Systemd-boot has its bootable efi file on the esp.

Last edited by mcloaked (2022-10-05 19:09:17)


Mike C

Offline

Board footer

Powered by FluxBB