Skip to content

Fix BLS entries not corrected before grub2-mkconfig on RHEL 8#2970

Closed
andrewlukoshko wants to merge 1 commit intoOSInside:mainfrom
andrewlukoshko:fix-bls-grub-mkconfig-ordering
Closed

Fix BLS entries not corrected before grub2-mkconfig on RHEL 8#2970
andrewlukoshko wants to merge 1 commit intoOSInside:mainfrom
andrewlukoshko:fix-bls-grub-mkconfig-ordering

Conversation

@andrewlukoshko
Copy link
Contributor

On RHEL 8-based distributions, grub2-mkconfig uses the grub.d/10_linux_bls script which reads Boot Loader Specification (BLS) entries from /boot/loader/entries/ and inlines them as menuentry blocks directly in grub.cfg. This is different from RHEL 9+ where grub.d/10_linux uses the blscfg command to load BLS entries at boot time.

When kiwi builds a disk image, kernel packages are installed into a chroot (the image root). The BLS entries created by the kernel scriptlets at that point contain:

  • linux/initrd paths prefixed with the build host's image root path (e.g. /var/tmp/kiwi-build/build/image-root/boot/vmlinuz-...)
  • an options line from the build host's /proc/cmdline

Previously, kiwi corrected these BLS entries only after running grub2-mkconfig. On RHEL 9+ this works fine because grub.cfg just contains blscfg and reads the (now corrected) BLS entries at boot time. On RHEL 8, however, grub2-mkconfig had already inlined the uncorrected BLS entries into grub.cfg, resulting in wrong kernel paths and boot options that caused the image to fail to boot.

This commit adds calls to _fix_grub_loader_entries_boot_cmdline() and _fix_grub_loader_entries_linux_and_initrd_paths() before grub2-mkconfig, so that BLS entries are corrected before they get inlined into grub.cfg. The existing post-grub2-mkconfig calls are retained because grub2-mkconfig itself may re-create or modify BLS entries on some distributions.

Fixes boot failure on AlmaLinux 8 ppc64le GenericCloud images built with kiwi where grub.cfg contained build-root paths like:

  linux /var/tmp/kiwi-build/build/image-root/boot/vmlinuz-4.18.0-...

instead of:

  linux /vmlinuz-4.18.0-...

On RHEL 8-based distributions, grub2-mkconfig uses the
grub.d/10_linux_bls script which reads Boot Loader Specification
(BLS) entries from /boot/loader/entries/ and inlines them as
menuentry blocks directly in grub.cfg. This is different from
RHEL 9+ where grub.d/10_linux uses the `blscfg` command to load
BLS entries at boot time.

When kiwi builds a disk image, kernel packages are installed into
a chroot (the image root). The BLS entries created by the kernel
scriptlets at that point contain:

  - linux/initrd paths prefixed with the build host's image root
    path (e.g. /var/tmp/kiwi-build/build/image-root/boot/vmlinuz-...)
  - an options line from the build host's /proc/cmdline

Previously, kiwi corrected these BLS entries only *after* running
grub2-mkconfig. On RHEL 9+ this works fine because grub.cfg just
contains `blscfg` and reads the (now corrected) BLS entries at
boot time. On RHEL 8, however, grub2-mkconfig had already inlined
the *uncorrected* BLS entries into grub.cfg, resulting in wrong
kernel paths and boot options that caused the image to fail to boot.

This commit adds calls to _fix_grub_loader_entries_boot_cmdline()
and _fix_grub_loader_entries_linux_and_initrd_paths() before
grub2-mkconfig, so that BLS entries are corrected before they get
inlined into grub.cfg. The existing post-grub2-mkconfig calls are
retained because grub2-mkconfig itself may re-create or modify BLS
entries on some distributions.

Fixes boot failure on AlmaLinux 8 ppc64le GenericCloud images built
with kiwi where grub.cfg contained build-root paths like:
  linux /var/tmp/kiwi-build/build/image-root/boot/vmlinuz-4.18.0-...
instead of:
  linux /vmlinuz-4.18.0-...
@Conan-Kudo
Copy link
Member

Conan-Kudo commented Mar 12, 2026

On one hand, we don't support RHEL 8 with kiwi 10... Merging this would imply it is supported. But this is a simple enough fix...

@Conan-Kudo
Copy link
Member

Does this problem occur when you use kiwi v9 in EPEL 8? This patch doesn't apply there presumably because the bootloader code is quite different...

@andrewlukoshko
Copy link
Contributor Author

@Conan-Kudo yes, EPEL8 version can't build ppc64le image for EL8. And for s390x too because it doesn't support zipl.

@Conan-Kudo
Copy link
Member

Sorry, we're not going to be able to take this, since this is for a distribution outside of the kiwi v10 support window.

@Conan-Kudo Conan-Kudo closed this Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants