Biosias / uefi-mkconfig

grub-mkconfig inspired script for automatically managing uefi entries for booting linux kernel directly without bootloader
Apache License 2.0
7 stars 3 forks source link

multiplied EFI boot items #9

Closed glorg closed 2 months ago

glorg commented 2 months ago

The script duplicates kernel entries if system has more than one bootable partition.

For example, in case of following partition and kernel image set:

boot
└── EFI
    └── Gentoo
        ├── amd-uc.img
        ├── vmlinuz-6.9.6-gentoo-x86_64.efi
        └── vmlinuz-6.9.7-gentoo-x86_64.efi

/boot2
└── EFI
    └── Gentoo
        └── vmlinuz-6.9.6-gentoo-x86_64.efi

/boot3
└── EFI
    └── Gentoo
        └── vmlinuz-6.9.6-gentoo-x86_64.efi

expected result is 4 EFI entries.

the script will output:

 * Creating UEFI entry "0100" for "/boot3/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi" found on "sdc1"...
 * No initramfs found for "/boot3/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi".
 * Creating UEFI entry "0101" for "/boot2/boot3/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi" found on "sdb1"...
 * No initramfs found for "/boot2/boot3/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi".
 * Creating UEFI entry "0102" for "/boot2/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi" found on "sdb1"...
 * No initramfs found for "/boot2/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi".
 * Creating UEFI entry "0103" for "/boot3/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi" found on "sda1"...
 * No initramfs found for "/boot3/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi".
 * Creating UEFI entry "0104" for "/boot2/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi" found on "sda1"...
 * No initramfs found for "/boot2/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi".
 * Creating UEFI entry "0105" for "/boot/EFI/Gentoo/vmlinuz-6.9.7-gentoo-x86_64.efi" found on "sda1"...
 * No initramfs found for "/boot/EFI/Gentoo/vmlinuz-6.9.7-gentoo-x86_64.efi".
 * Creating UEFI entry "010B" for "/boot/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi" found on "sda1"...
 * No initramfs found for "/boot/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi".

Thus, 7 entries. Note the image on last drive having 3 entries, and 2 on the 2nd drive. The reason is that variables

kernel_images_old
kernel_images_new
partition_efis_main

are not reset and in case the same kernel is present on several drives, the resulting number of items is multiplied.. Can be solved like this

ekexcello commented 2 months ago

Unfortunately, with the changed code the issue with multiplying boot items is still present.

For these images present on the system:

/boot/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi
/boot/EFI/Gentoo/vmlinuz-6.9.7-gentoo-x86_64.efi
/boot/EFI/Gentoo/vmlinuz-6.9.7-gentoo-x86_64-old.efi
/boot/EFI/Gentoo/vmlinuz-6.9.9-gentoo-x86_64.efi
/boot2/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi
/boot3/EFI/Gentoo/vmlinuz-6.9.6-gentoo-x86_64.efi

created boot items are:

BootCurrent: 0100
Timeout: 1 seconds
BootOrder: 01F8,01F9,01FA,01FB,01FC,01FD,01FE,01FF,0200,0108,0109,010A,0107,0106
Boot0106  Hard Drive    BBS(HD,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0200)
Boot0107  Network Card  BBS(Network,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0600)
Boot0108* UEFI: Built-in EFI Shell  VenMedia(5023b95c-db26-429b-a648-bd47664c8012)
Boot0109* UEFI: Built-in EFI Shell  VenMedia(5023b95c-db26-429b-a648-bd47664c8012)
Boot010A* UEFI: Built-in EFI Shell  VenMedia(5023b95c-db26-429b-a648-bd47664c8012)
Boot01F8* UMC 6.9.9-gentoo-x86_64 on sda    HD(1,GPT,37d92f78-8fb1-488f-bf4b-e08fd4447011,0x800,0x64000)/File(\EFI\Gentoo\vmlinuz-6.9.9-gentoo-x86_64.efi) root=/dev/md127 nmi_watchdog=0 xt_recent.ip_pkt_list_tot=1 xt_recent.ip_list_tot=16777216 hugepagesz=1GB hugepages=1 console=ttyS1,115200 initrd=\EFI\Gentoo\amd-uc.img
Boot01F9* UMC 6.9.7-gentoo-x86_64 on sda    HD(1,GPT,37d92f78-8fb1-488f-bf4b-e08fd4447011,0x800,0x64000)/File(\EFI\Gentoo\vmlinuz-6.9.7-gentoo-x86_64.efi) root=/dev/md127 nmi_watchdog=0 xt_recent.ip_pkt_list_tot=1 xt_recent.ip_list_tot=16777216 hugepagesz=1GB hugepages=1 console=ttyS1,115200 initrd=\EFI\Gentoo\amd-uc.img
Boot01FA* UMC 6.9.6-gentoo-x86_64 on sdc    HD(1,GPT,2dd00cab-d9b8-4b46-8ff8-b59ca5d324ec,0x800,0x64000)/File(\EFI\Gentoo\vmlinuz-6.9.6-gentoo-x86_64.efi) root=/dev/md127 nmi_watchdog=0 xt_recent.ip_pkt_list_tot=1 xt_recent.ip_list_tot=16777216 hugepagesz=1GB hugepages=1 console=ttyS1,115200 initrd=\EFI\Gentoo\amd-uc.img
Boot01FB* UMC 6.9.6-gentoo-x86_64 on sdb    HD(1,GPT,6581278c-d557-443d-8dae-9c827c010247,0x800,0x64000)/File(\EFI\Gentoo\vmlinuz-6.9.6-gentoo-x86_64.efi) root=/dev/md127 nmi_watchdog=0 xt_recent.ip_pkt_list_tot=1 xt_recent.ip_list_tot=16777216 hugepagesz=1GB hugepages=1 console=ttyS1,115200 initrd=\EFI\Gentoo\amd-uc.img
Boot01FC* UMC 6.9.6-gentoo-x86_64 on sda    HD(1,GPT,37d92f78-8fb1-488f-bf4b-e08fd4447011,0x800,0x64000)/File(\EFI\Gentoo\vmlinuz-6.9.6-gentoo-x86_64.efi) root=/dev/md127 nmi_watchdog=0 xt_recent.ip_pkt_list_tot=1 xt_recent.ip_list_tot=16777216 hugepagesz=1GB hugepages=1 console=ttyS1,115200 initrd=\EFI\Gentoo\amd-uc.img
Boot01FD* UMC 6.9.6-gentoo-x86_64 on sdc    HD(1,GPT,2dd00cab-d9b8-4b46-8ff8-b59ca5d324ec,0x800,0x64000)/File(\EFI\Gentoo\vmlinuz-6.9.6-gentoo-x86_64.efi) root=/dev/md127 nmi_watchdog=0 xt_recent.ip_pkt_list_tot=1 xt_recent.ip_list_tot=16777216 hugepagesz=1GB hugepages=1 console=ttyS1,115200 initrd=\EFI\Gentoo\amd-uc.img
Boot01FE* UMC 6.9.6-gentoo-x86_64 on sdb    HD(1,GPT,6581278c-d557-443d-8dae-9c827c010247,0x800,0x64000)/File(\EFI\Gentoo\vmlinuz-6.9.6-gentoo-x86_64.efi) root=/dev/md127 nmi_watchdog=0 xt_recent.ip_pkt_list_tot=1 xt_recent.ip_list_tot=16777216 hugepagesz=1GB hugepages=1 console=ttyS1,115200 initrd=\EFI\Gentoo\amd-uc.img
Boot01FF* UMC 6.9.6-gentoo-x86_64 on sda    HD(1,GPT,37d92f78-8fb1-488f-bf4b-e08fd4447011,0x800,0x64000)/File(\EFI\Gentoo\vmlinuz-6.9.6-gentoo-x86_64.efi) root=/dev/md127 nmi_watchdog=0 xt_recent.ip_pkt_list_tot=1 xt_recent.ip_list_tot=16777216 hugepagesz=1GB hugepages=1 console=ttyS1,115200 initrd=\EFI\Gentoo\amd-uc.img
Boot0200* UMC 6.9.7-gentoo-x86_64-old on sda    HD(1,GPT,37d92f78-8fb1-488f-bf4b-e08fd4447011,0x800,0x64000)/File(\EFI\Gentoo\vmlinuz-6.9.7-gentoo-x86_64-old.efi) root=/dev/md127 nmi_watchdog=0 xt_recent.ip_pkt_list_tot=1 xt_recent.ip_list_tot=16777216 hugepagesz=1GB hugepages=1 console=ttyS1,115200 initrd=\EFI\Gentoo\amd-uc.img
ekexcello commented 2 months ago

The issue seems to happen in case one and the same image (with the same name) is present on several partitions

Biosias commented 2 months ago

Is fixed in the next version