Skip to content

kexec: fallback for boot loader spec when kernel and initramfs not found in grub.cfg #165

@ncopa

Description

@ncopa

While working on a template for Rocky Linux I discovered that Rocky's grub.cfg has a grub module called blscfg that apparently parses a BootLoaderSpec. This means that the expected grub entries for linux and initrd are included in the grub.cfg.

I think think it would make sense to find the kernel path, initrd path and boot options from BootLoaderSpec entries if they are not found in grub.cfg. It does not look to complicated to implement either.

[root@machine3 ~]# cat /boot/loader/entries/f26140c996554f3cac7cad0310a8105e-0-rescue.conf
title Rocky Linux (0-rescue-f26140c996554f3cac7cad0310a8105e) 10.1 (Red Quartz)
version 0-rescue-f26140c996554f3cac7cad0310a8105e
linux /vmlinuz-0-rescue-f26140c996554f3cac7cad0310a8105e
initrd /initramfs-0-rescue-f26140c996554f3cac7cad0310a8105e.img
options console=ttyS0,115200n8 no_timer_check crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M root=UUID=c21bd66d-9b25-435c-92d1-6c9d6e1fe0e7 
grub_users $grub_users
grub_arg --unrestricted
grub_class rocky
[root@machine3 ~]# cat /boot/loader/entries/f26140c996554f3cac7cad0310a8105e-6.12.0-124.8.1.el10_1.x86_64.conf 
title Rocky Linux (6.12.0-124.8.1.el10_1.x86_64) 10.1 (Red Quartz)
version 6.12.0-124.8.1.el10_1.x86_64
linux /vmlinuz-6.12.0-124.8.1.el10_1.x86_64
initrd /initramfs-6.12.0-124.8.1.el10_1.x86_64.img
options console=ttyS0,115200n8 no_timer_check crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M root=UUID=c21bd66d-9b25-435c-92d1-6c9d6e1fe0e7 
grub_users $grub_users
grub_arg --unrestricted
grub_class rocky

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions