Bug 2127453
| Summary: | Default arguments are used if --args is not specified | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Marta Lewandowska <mlewando> |
| Component: | grubby | Assignee: | Bootloader engineering team <bootloader-eng-team> |
| Status: | CLOSED ERRATA | QA Contact: | Release Test Team <release-test-team-automation> |
| Severity: | medium | Docs Contact: | Jana Heves <jsvarova> |
| Priority: | high | ||
| Version: | 9.1 | CC: | bootloader-eng-team, gfialova, jstodola, jsvarova, kperrier, mlewando, pjanda, rdulhani, release-test-team-automation |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | 9.2 | Flags: | pm-rhel:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | grubby-8.40-63.el9 | Doc Type: | Bug Fix |
| Doc Text: |
.`grubby` now passes arguments to a new kernel correctly
When you add a new kernel using the `grubby` tool and do not specify any arguments, or leave the arguments blank, `grubby` will not pass any arguments to the new kernel and `root` will not be set. Using the `--args` and `--copy-default` options ensures new arguments are appended to the default arguments.
|
Story Points: | --- |
| Clone Of: | 1900829 | Environment: | |
| Last Closed: | 2023-05-09 08:26:25 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | 1900829 | ||
| Bug Blocks: | 1879091, 1903942 | ||
Thanks, applied fix to Fedora. Reproduced on RHEL-9.2 with grubby 8.40-61: # rpm -qa grubby\* grubby-8.40-61.el9.x86_64 [root@kvm-08-guest31 ~]# cd /boot/ [root@kvm-08-guest31 boot]# touch my_kernel my_initrd [root@kvm-08-guest31 boot]# grubby --add-kernel=/boot/my_kernel --initrd=/boot/my_initrd --title=no_args [root@kvm-08-guest31 boot]# grubby --add-kernel=/boot/my_kernel --initrd=/boot/my_initrd --args=bla --title=some_args An entry for kernel my_kernel already exists, adding /boot/loader/entries/5c9135a4657146f3bcd4a2844700f9bd-my_kernel.0~custom.conf [root@kvm-08-guest31 boot]# grubby --info=/boot/my_kernel index=2 kernel="/boot/my_kernel" args="bla" initrd="/boot/my_initrd" title="some_args" id="5c9135a4657146f3bcd4a2844700f9bd-my_kernel.0~custom" index=3 kernel="/boot/my_kernel" args="$kernelopts" initrd="/boot/my_initrd" title="no_args" id="5c9135a4657146f3bcd4a2844700f9bd-my_kernel" Verified on RHEL-9.2 with grubby 8.40-62: # rpm -qa grubby\* grubby-8.40-62.el9.aarch64 [root@hpe-apollo-cn99xx-15-vm-20 ~]# cd /boot [root@hpe-apollo-cn99xx-15-vm-20 boot]# touch my_kernel my_initrd [root@hpe-apollo-cn99xx-15-vm-20 boot]# grubby --add-kernel=/boot/my_kernel --initrd=/boot/my_initrd --title=no_args [root@hpe-apollo-cn99xx-15-vm-20 boot]# grubby --add-kernel=/boot/my_kernel --initrd=/boot/my_initrd --args=bla --title=some_args An entry for kernel my_kernel already exists, adding /boot/loader/entries/c08f08492d714fc087dcb5accc2746fc-my_kernel.0~custom.conf [root@hpe-apollo-cn99xx-15-vm-20 boot]# grubby --info=/boot/my_kernel index=2 kernel="/boot/my_kernel" args="bla" root="/dev/mapper/rhel_hpe--apollo--cn99xx--15--vm--20-root" initrd="/boot/my_initrd" title="some_args" id="c08f08492d714fc087dcb5accc2746fc-my_kernel.0~custom" index=3 kernel="/boot/my_kernel" args="" root="/dev/mapper/rhel_hpe--apollo--cn99xx--15--vm--20-root" initrd="/boot/my_initrd" title="no_args" id="c08f08492d714fc087dcb5accc2746fc-my_kernel" root is set, default arguments are not copied. grubby-8.40-62.el9 adds an unexpected root=... boot argument when the user specifies --args=... See: [root@localhost boot]# grubby --add-kernel=/boot/vmlinuz --initrd=/boot/initrd.img --args="my_arg" --title="Test" [root@localhost boot]# cat /boot/loader/entries/dc227bca83644c7aad89fa7e31bb3e4e-vmlinuz.conf title Test version vmlinuz linux /vmlinuz initrd /initrd.img options root=/dev/mapper/rhel-root my_arg id rhel-0-vmlinuz grub_users $grub_users grub_arg --unrestricted grub_class kernel [root@localhost boot]# The expected behavior is that only "my_arg" would be present on the kernel command line, root=/dev/mapper/rhel-root should not be there. I'm moving this bug back to ASSIGNED. This is a change of behavior and has an impact on our automated testing. I thought the root= was desired! But since it is not, here it is again with grubby-8.40-63.el9: [root@ibm-p9z-23-lp3 boot]# grubby --add-kernel my_kernel --initrd my_initrd --title no_args [root@ibm-p9z-23-lp3 boot]# grubby --add-kernel my_kernel --initrd my_initrd --args args --title some_args args An entry for kernel my_kernel already exists, adding /boot/loader/entries/a7c94d39d09c4db1a076bdfc5ca994e7-my_kernel.0~custom.conf [root@ibm-p9z-23-lp3 boot]# grubby --info my_kernel index=2 kernel="/boot/my_kernel" args="args" initrd="/boot/my_initrd" title="some_args" id="a7c94d39d09c4db1a076bdfc5ca994e7-my_kernel.0~custom" index=3 kernel="/boot/my_kernel" args="" initrd="/boot/my_initrd" title="no_args" id="a7c94d39d09c4db1a076bdfc5ca994e7-my_kernel" The results from comment 17 look good, thank you Marta. You're welcome, Honzo. :) Setting back to Verified: Tested based on c#17 & 18 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (grubby bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2023:2584 |
diff --git a/grubby-bls b/grubby-bls index fd76f63..f09156b 100755 --- a/grubby-bls +++ b/grubby-bls @@ -827,13 +827,14 @@ fi remove_var_prefix "$(get_prefix)" if [[ -n $kernel ]]; then - opts="${bls_options[$default_index]}" - if [[ $copy_default != "true" ]]; then - opts=$(echo $opts | sed -e 's/ .*//') + if [[ $copy_default = "true" ]]; then + opts="${bls_options[$default_index]}" + if [[ -n $args ]]; then + opts="${opts} ${args}" + fi + else + opts="${args}" fi - if [[ -n $args ]]; then - opts="${opts} ${args}" - fi add_bls_fragment "${kernel}" "${title}" "${opts}" "${initrd}" \ "${extra_initrd}"