Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
efistub UKI not updating boot order
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
flipy
Apprentice
Apprentice


Joined: 15 Jul 2004
Posts: 236

PostPosted: Fri Nov 22, 2024 7:49 am    Post subject: efistub UKI not updating boot order Reply with quote

Hello,
I recently moved to a efistub UKI kernel install, following the official documentation [1] [2].
The problem that I have is that the boot order is not updated to the latest installed kernel, only next boot gets updated but then not persisted. And outdated and removed packages do not get deleted from the boot list.

I am using the following USE flags as instructed by the documentation.
Code:
sys-apps/systemd-utils boot kernel-install
sys-kernel/installkernel systemd uki dracut efistub


This is on a machine with
Code:
ACCEPT_KEYWORDS="~amd64"
.

And necessary packages to get efistub and UKI working with their enabled USE flags.
Code:
[I] sys-kernel/installkernel
     Available versions:  48-r1 {dracut efistub grub refind systemd systemd-boot ugrd uki ukify}
     Installed versions:  48-r1(08:41:16 08/26/24)(dracut efistub systemd uki -grub -refind -systemd-boot -ugrd -ukify)

[I] sys-kernel/gentoo-kernel
     Available versions: 
     (5.10.228) 5.10.228^tu
     (5.10.229) (~)5.10.229^tu
     (5.10.230) (~)5.10.230^tu
     (5.15.169) 5.15.169^tu
     (5.15.170) (~)5.15.170^tu
     (5.15.171) (~)5.15.171^tu
     (5.15.172) (~)5.15.172^tu
     (5.15.173) (~)5.15.173^tu
     (6.1.114) 6.1.114^tu
     (6.1.115) (~)6.1.115^tu
     (6.1.116) (~)6.1.116^tu
     (6.1.117) (~)6.1.117^tu
     (6.1.118) (~)6.1.118^tu
     (6.6.58) 6.6.58-r1^tu
     (6.6.59) (~)6.6.59^tu
     (6.6.60) (~)6.6.60^tu
     (6.6.61) (~)6.6.61^tu
     (6.6.62) (~)6.6.62^tu
     (6.11.5) (~)6.11.5-r1^tu
     (6.11.6) (~)6.11.6^tu
     (6.11.7) (~)6.11.7^tu
     (6.11.8) (~)6.11.8^tu
     (6.11.9) (~)6.11.9^tu
       {debug experimental generic-uki hardened +initramfs modules-compress modules-sign savedconfig secureboot +strip test}
     Installed versions:  6.11.9(6.11.9)^t(22:40:03 11/19/24)(debug initramfs strip -experimental -generic-uki -hardened -modules-compress -modules-sign -savedconfig -secureboot -test)

[I] sys-apps/systemd-utils
     Available versions:  254.13^t (~)254.16^t 254.17^t (~)254.18^t (~)254.19^t (~)255.10^t (~)255.11^t (~)255.12^t (~)255.13^t {+acl boot kernel-install +kmod secureboot selinux split-usr sysusers test +tmpfiles +udev ukify ABI_MIPS="n32 n64 o32" ABI_S390="32 64" ABI_X86="32 64 x32" PYTHON_SINGLE_TARGET="python3_10 python3_11 python3_12 python3_13"}
     Installed versions:  255.13^t(18:45:41 11/12/24)(acl boot kernel-install kmod split-usr tmpfiles udev -secureboot -selinux -sysusers -test -ukify ABI_MIPS="-n32 -n64 -o32" ABI_S390="-32 -64" ABI_X86="32 64 -x32" PYTHON_SINGLE_TARGET="python3_12 -python3_10 -python3_11 -python3_13")



kernel-bootcfg-boot-successful service is enabled at default run level.

What could be the reason to not update the boot list and boot order?

[1] https://wiki.gentoo.org/wiki/Unified_kernel_image
[2] https://wiki.gentoo.org/wiki/EFI_stub
Back to top
View user's profile Send private message
Nowa
Developer
Developer


Joined: 25 Jun 2014
Posts: 444
Location: Nijmegen

PostPosted: Fri Nov 22, 2024 10:25 am    Post subject: Reply with quote

Please share the output of:

Code:
emerge --config gentoo-kernel


And:

Code:
systemctl status kernel-bootcfg-boot-successful


Quote:
What could be the reason to not update the boot list and boot order?


What motherboard is this? It could be that manipulating the boot entries and/or boot order is not supported/allowed from the OS by the UEFI.
_________________
OS: Gentoo 6.10.12-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
flipy
Apprentice
Apprentice


Joined: 15 Jul 2004
Posts: 236

PostPosted: Sat Nov 23, 2024 3:56 pm    Post subject: Reply with quote

Nowa wrote:
Please share the output of:

Code:
emerge --config gentoo-kernel




https://bpa.st/SKZA

Nowa wrote:
And:

Code:
systemctl status kernel-bootcfg-boot-successful


This is on an OpenRC system.
List of services enabled and their run level.
Code:

gentoo ~ # rc-update show
       NetworkManager |      default                           
               binfmt | boot                                   
            bluetooth |      default                           
             bootmisc | boot                                   
              cgroups |                                 sysinit
              chronyd |      default                           
               cronie |      default                           
                cupsd |      default                           
                 dbus |      default                           
                devfs |                                 sysinit
      display-manager |      default                           
                dmesg |                                 sysinit
                 fsck | boot                                   
             hostname | boot                                   
              hwclock | boot                                   
 kernel-bootcfg-boot-successful |      default                           
              keymaps | boot                                   
            killprocs |                        shutdown       
    kmod-static-nodes |                                 sysinit
           lm_sensors |      default                           
                local |      default nonetwork                 
           localmount | boot                                   
             loopback | boot                                   
              modules | boot                                   
             mount-ro |                        shutdown       
                 mtab | boot                                   
             netmount |      default                           
               procfs | boot                                   
                 root | boot                                   
         save-keymaps | boot                                   
    save-termencoding | boot                                   
            savecache |                        shutdown       
              seedrng | boot                                   
                 sshd |      default                           
                 swap | boot                                   
               sysctl | boot                                   
                sysfs |                                 sysinit
             sysklogd |      default                           
 systemd-tmpfiles-setup | boot                                   
 systemd-tmpfiles-setup-dev |                                 sysinit
         termencoding | boot                                   
                 udev |                                 sysinit
         udev-trigger |                                 sysinit


Nowa wrote:

What motherboard is this? It could be that manipulating the boot entries and/or boot order is not supported/allowed from the OS by the UEFI.


System is
Code:
Linux gentoo 6.11.9-gentoo-dist #1 SMP PREEMPT_DYNAMIC Tue Nov 19 22:38:49 CET 2024 x86_64 AMD Ryzen 9 5900X 12-Core Processor AuthenticAMD GNU/Linux
and motherboard is
Code:
# dmidecode 3.6
Getting SMBIOS data from sysfs.
SMBIOS 3.3.0 present.

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
        Manufacturer: Gigabyte Technology Co., Ltd.
        Product Name: X570 AORUS PRO
        Version: Default string
        Serial Number: Default string
        Asset Tag: Default string
        Features:
                Board is a hosting board
                Board is replaceable
        Location In Chassis: Default string
        Chassis Handle: 0x0003
        Type: Motherboard
        Contained Object Handles: 0


I can use efibootmgr to update EFI entries (running emerge --config gentoo-kernel created a new entry in the EFI list and set it to BootNext, but it does not get persisted and falls back to the previous boot order).
Code:
BootCurrent: 0010
Timeout: 1 seconds
BootOrder: 0010,000B,0002,0001,0009,0008
Boot0000* Gentoo Linux 6.11.9-gentoo-dist (UKI) HD(1,GPT,2a0d1368-1f48-5247-9a7c-4662d1aa06ac,0x1000,0x1f4000)/\EFI\Linux\gentoo-6.11.9-gentoo-dist.efi
Boot0001* Windows Boot Manager  HD(1,GPT,2a0d1368-1f48-5247-9a7c-4662d1aa06ac,0x1000,0x1f4000)/\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI0000424f
Boot0002* Windows Boot Manager  HD(1,GPT,609e7794-0e7e-4c27-a009-a45f14bc011a,0x800,0x32000)/\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI0000424f
Boot0003* WDC WD30EZRX-00MMMB0  BBS(HD,,0x0)0000424f
Boot0004* Samsung SSD 860 EVO 1TB       BBS(HD,,0x0)0000424f
Boot0005* Samsung SSD 980 PRO 1TB       BBS(HD,,0x0)0000424f
Boot0006* Sabrent       BBS(HD,,0x0)0000424f
Boot0008* Windows Boot Manager  HD(1,GPT,609e7794-0e7e-4c27-a009-a45f14bc011a,0x800,0x32000)/\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b0039006400650061003800
3600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007
d00000065000100000010000000040000007fff0400
Boot0009* Windows Boot Manager  HD(1,GPT,609e7794-0e7e-4c27-a009-a45f14bc011a,0x800,0x32000)/\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI0000424f
Boot000B* Windows Boot Manager  HD(1,GPT,2a0d1368-1f48-5247-9a7c-4662d1aa06ac,0x1000,0x1f4000)/\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI0000424f
Boot0010* Gentoo Linux 6.11.9-gentoo-dist (UKI) HD(1,GPT,2a0d1368-1f48-5247-9a7c-4662d1aa06ac,0x1000,0x1f4000)/\EFI\LINUX\GENTOO-6.11.9-GENTOO-DIST.EFI


Moderator note: Fixed a long line which breaks layout. -- Banana
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 506

PostPosted: Sat Nov 23, 2024 4:42 pm    Post subject: Reply with quote

Do you have two ESPs on the same hard disk?

Which of the boot entries from "efibootmgr" does not persist?
And Boot0000 and Boot0010 seem to be identical (beside case sensitivity).
Back to top
View user's profile Send private message
Nowa
Developer
Developer


Joined: 25 Jun 2014
Posts: 444
Location: Nijmegen

PostPosted: Sat Nov 23, 2024 8:02 pm    Post subject: Reply with quote

Quote:
This is on an OpenRC system.


I never tested this on an openrc system, so it may very well be that there is some bug in this service file. Could you share the openrc logs?
_________________
OS: Gentoo 6.10.12-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
flipy
Apprentice
Apprentice


Joined: 15 Jul 2004
Posts: 236

PostPosted: Mon Dec 02, 2024 12:04 pm    Post subject: Reply with quote

sMueggli wrote:
Do you have two ESPs on the same hard disk?


I only have one, but I do have more disks with ESP on them.
Code:
NAME        FSTYPE      FSVER    LABEL       UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                               
└─sda1      LVM2_member LVM2 001             V2S5Yo-0PFO-pJVC-SjPF-MPj0-PfiD-1iG5xp               
sdb                                                                                               
└─sdb1      btrfs                            4554a6bc-2e28-4206-b5fc-549ce90c69cc                 
nvme1n1                                                                                           
├─nvme1n1p1 vfat        FAT32                7C0E-FF3F                                             
├─nvme1n1p2                                                                                       
├─nvme1n1p3 ntfs                             44D2102ED21026A8                                     
├─nvme1n1p4 ntfs                             EA3E40843E404BAF                                     
└─nvme1n1p5 btrfs                Gentoo      dc11aab8-9e67-4688-b04b-aa339e30167c                 
nvme0n1                                                                                           
├─nvme0n1p1 vfat        FAT32                D2F4-070A                               684.5M    31% /efi
├─nvme0n1p2 btrfs                endeavouros 3c0692e2-794b-44cd-866e-b1c5f6cbe242     29.4G    96% /home
│                                                                                                  /
└─nvme0n1p3 swap        1        swap        216a5f51-9e07-45da-9259-981cb02244ca                  [SWAP]


Primary disk is nvme0n1.

sMueggli wrote:

Which of the boot entries from "efibootmgr" does not persist?
And Boot0000 and Boot0010 seem to be identical (beside case sensitivity).


Any new EFI entry is not added to BootOrder at all.
There are two entries that were automatically created by installkernel due to calling emerge --config gentoo-kernel twice.

Nowa wrote:
Could you share the openrc logs?.


OpenRC log: http://0x0.st/X7Hq.log
Back to top
View user's profile Send private message
Nowa
Developer
Developer


Joined: 25 Jun 2014
Posts: 444
Location: Nijmegen

PostPosted: Mon Dec 02, 2024 12:42 pm    Post subject: Reply with quote

flipy wrote:

Nowa wrote:
Could you share the openrc logs?.


OpenRC log: http://0x0.st/X7Hq.log


In your log I can't see that the openrc service is updating the bootorder, but maybe it is simply not verbose enough.

Have you tried running the command from the openrc service file manually after running the 'emerge --config' and rebooting?

Code:
kernel-bootcfg --boot-successful --update-csv

_________________
OS: Gentoo 6.10.12-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
flipy
Apprentice
Apprentice


Joined: 15 Jul 2004
Posts: 236

PostPosted: Tue Dec 03, 2024 10:37 am    Post subject: Reply with quote

Nowa wrote:

Have you tried running the command from the openrc service file manually after running the 'emerge --config' and rebooting?

Code:
kernel-bootcfg --boot-successful --update-csv


EFI list after emerging gentoo-kernel.

Code:
BootNext: 0007
BootCurrent: 0010
Timeout: 1 seconds
BootOrder: 0010,000B,0002,0001,0009,0008,0007
Boot0001* Windows Boot Manager  HD(1,GPT,2a0d1368-1f48-5247-9a7c-4662d1aa06ac,0x1000,0x1f4000)/\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI0000424f
Boot0002* Windows Boot Manager  HD(1,GPT,609e7794-0e7e-4c27-a009-a45f14bc011a,0x800,0x32000)/\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI0000424f
Boot0003* WDC WD30EZRX-00MMMB0  BBS(HD,,0x0)0000424f
Boot0004* Samsung SSD 860 EVO 1TB       BBS(HD,,0x0)0000424f
Boot0005* Samsung SSD 980 PRO 1TB       BBS(HD,,0x0)0000424f
Boot0006* Sabrent       BBS(HD,,0x0)0000424f
Boot0007* Gentoo Linux 6.11.10-gentoo-dist (UKI)        HD(1,GPT,2a0d1368-1f48-5247-9a7c-4662d1aa06ac,0x1000,0x1f4000)/\EFI\Linux\gentoo-6.11.10-gentoo-dist.efi
Boot0008* Windows Boot Manager  HD(1,GPT,609e7794-0e7e-4c27-a009-a45f14bc011a,0x800,0x32000)/\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d00340065003
70030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000065000100000010000000040000007fff0400
Boot0009* Windows Boot Manager  HD(1,GPT,609e7794-0e7e-4c27-a009-a45f14bc011a,0x800,0x32000)/\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI0000424f
Boot000B* Windows Boot Manager  HD(1,GPT,2a0d1368-1f48-5247-9a7c-4662d1aa06ac,0x1000,0x1f4000)/\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI0000424f
Boot0010* Gentoo Linux 6.11.9-gentoo-dist (UKI) HD(1,GPT,2a0d1368-1f48-5247-9a7c-4662d1aa06ac,0x1000,0x1f4000)/\EFI\LINUX\GENTOO-6.11.9-GENTOO-DIST.EFI


EFI list after rebooting

Code:
BootCurrent: 0007
Timeout: 1 seconds
BootOrder: 0010,000B,0002,0001,0009,0008,0007
Boot0001* Windows Boot Manager  HD(1,GPT,2a0d1368-1f48-5247-9a7c-4662d1aa06ac,0x1000,0x1f4000)/\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI0000424f
Boot0002* Windows Boot Manager  HD(1,GPT,609e7794-0e7e-4c27-a009-a45f14bc011a,0x800,0x32000)/\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI0000424f
Boot0003* WDC WD30EZRX-00MMMB0  BBS(HD,,0x0)0000424f
Boot0004* Samsung SSD 860 EVO 1TB       BBS(HD,,0x0)0000424f
Boot0005* Samsung SSD 980 PRO 1TB       BBS(HD,,0x0)0000424f
Boot0006* Sabrent       BBS(HD,,0x0)0000424f
Boot0007* Gentoo Linux 6.11.10-gentoo-dist (UKI)        HD(1,GPT,2a0d1368-1f48-5247-9a7c-4662d1aa06ac,0x1000,0x1f4000)/\EFI\Linux\gentoo-6.11.10-gentoo-dist.efi
Boot0008* Windows Boot Manager  HD(1,GPT,609e7794-0e7e-4c27-a009-a45f14bc011a,0x800,0x32000)/\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d003
5006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000065000100000010000000040000007fff0400
Boot0009* Windows Boot Manager  HD(1,GPT,609e7794-0e7e-4c27-a009-a45f14bc011a,0x800,0x32000)/\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI0000424f
Boot000B* Windows Boot Manager  HD(1,GPT,2a0d1368-1f48-5247-9a7c-4662d1aa06ac,0x1000,0x1f4000)/\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI0000424f
Boot0010* Gentoo Linux 6.11.9-gentoo-dist (UKI) HD(1,GPT,2a0d1368-1f48-5247-9a7c-4662d1aa06ac,0x1000,0x1f4000)/\EFI\LINUX\GENTOO-6.11.9-GENTOO-DIST.EFI


kernel-bootcfg output
Code:
@host $ kernel-bootcfg -v --boot-successful --update-csv
INFO: No update needed, BootCurrent is already in BootOrder.


Indeed the boot entry is already in BootOrder, but it is not the primary option -- which you might want for a new kernel version.
Does it makes sense to force it to be the first entry with
Code:
kernel-bootcfg --boot-successful --update-csv --boot-order 0
?
Back to top
View user's profile Send private message
Nowa
Developer
Developer


Joined: 25 Jun 2014
Posts: 444
Location: Nijmegen

PostPosted: Tue Dec 03, 2024 10:43 am    Post subject: Reply with quote

Quote:
Does it makes sense to force it to be the first entry with


Yeah, I'd try either this, or deleting the entry entirely and starting from scratch to see if that makes it behave correctly.

This could be some quirk from your vendor's UEFI implementation. It is not uncommon for EFI stub booting to not work because of some deviation from the UEFI spec. Mine for example does not allow modification of the BootOrder from the OS, and also does not allow "duplicate" entries, which significantly complicates EFI stub booting.
_________________
OS: Gentoo 6.10.12-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 506

PostPosted: Wed Dec 04, 2024 5:36 pm    Post subject: Reply with quote

Maybe it is easier to create two static efi boot variables and just replace the efi binaries.
Back to top
View user's profile Send private message
Nowa
Developer
Developer


Joined: 25 Jun 2014
Posts: 444
Location: Nijmegen

PostPosted: Wed Dec 04, 2024 6:03 pm    Post subject: Reply with quote

sMueggli wrote:
Maybe it is easier to create two static efi boot variables and just replace the efi binaries.


Installkernel supports this but the 'static' EFI file should be named kernel.efi.
_________________
OS: Gentoo 6.10.12-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum