Fix BLS entries not corrected before grub2-mkconfig on RHEL 8#2970
Closed
andrewlukoshko wants to merge 1 commit intoOSInside:mainfrom
Closed
Fix BLS entries not corrected before grub2-mkconfig on RHEL 8#2970andrewlukoshko wants to merge 1 commit intoOSInside:mainfrom
andrewlukoshko wants to merge 1 commit intoOSInside:mainfrom
Conversation
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-...
Member
|
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... |
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... |
Contributor
Author
|
@Conan-Kudo yes, EPEL8 version can't build ppc64le image for EL8. And for s390x too because it doesn't support |
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
blscfgcommand 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:
Previously, kiwi corrected these BLS entries only after running grub2-mkconfig. On RHEL 9+ this works fine because grub.cfg just contains
blscfgand 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:
instead of: