Bug 1900829 - Arguments from running system are used if --args is not specified
Summary: Arguments from running system are used if --args is not specified
Keywords:
Status: POST
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: grubby
Version: 8.3
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: 8.0
Assignee: Bootloader engineering team
QA Contact: Release Test Team
Jana Heves
URL:
Whiteboard:
Depends On:
Blocks: 2127453 1879091 1903942
TreeView+ depends on / blocked
 
Reported: 2020-11-23 19:42 UTC by Jan Stodola
Modified: 2023-02-10 10:34 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
.The behavior of `grubby` diverges from its documentation When you add a new kernel using the `grubby` tool and do not specify any arguments, `grubby` passes the default arguments to the new entry. This behavior occurs even without passing the `--copy-default` argument. Using `--args` and `--copy-default` options ensures those arguments are appended to the default arguments as stated in the `grubby` documentation. However, when you add additional arguments, such as `$tuned_params`, the `grubby` tool does not pass these arguments unless the `--copy-default` option is invoked. In this situation, two workarounds are available: * Either set the `root=` argument and leave `--args` empty: + .... # grubby --add-kernel /boot/my_kernel --initrd /boot/my_initrd --args "root=/dev/mapper/rhel-root" --title "entry_with_root_set" .... * Or set the `root=` argument and the specified arguments, but not the default ones: + .... # grubby --add-kernel /boot/my_kernel --initrd /boot/my_initrd --args "root=/dev/mapper/rhel-root some_args and_some_more" --title "entry_with_root_set_and_other_args_too" ....
Clone Of:
: 2127453 (view as bug list)
Environment:
Last Closed:
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)

Description Jan Stodola 2020-11-23 19:42:01 UTC
Description of problem:
When adding a new kernel and the --args option is not specified, the kernel arguments from the running kernel are used (except of the root= argument):

[root@localhost ~]# cd /boot/
[root@localhost boot]# touch my_kernel my_initrd
[root@localhost boot]# grubby --add-kernel=/boot/my_kernel --initrd=/boot/my_initrd --title=no_args
[root@localhost 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/2d33c9bc03a345b4990f71804c74e899-my_kernel.0~custom.conf

[root@localhost boot]# grubby --info=/boot/my_kernel
index=2
kernel="/boot/my_kernel"
args="bla"
initrd="/boot/my_initrd"
title="some_args"
id="2d33c9bc03a345b4990f71804c74e899-my_kernel.0~custom"
index=3
kernel="/boot/my_kernel"
args="ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet"
root="/dev/mapper/rhel-root"
initrd="/boot/my_initrd"
title="no_args"
id="2d33c9bc03a345b4990f71804c74e899-my_kernel"

[root@localhost boot]# cat /proc/cmdline 
BOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-246.el8.dt4.x86_64 root=/dev/mapper/rhel-root ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet

[root@localhost boot]# rpm -q grubby
grubby-8.40-41.el8.x86_64
[root@localhost boot]#


Compare with RHEL-7:

[root@dhcp76 ~]# cd /boot/
[root@dhcp76 boot]# touch my_kernel my_initrd
[root@dhcp76 boot]# grubby --add-kernel=/boot/my_kernel --initrd=/boot/my_initrd --title=no_args
[root@dhcp76 boot]# grubby --add-kernel=/boot/my_kernel --initrd=/boot/my_initrd --args=bla --title=some_args
[root@dhcp76 boot]# grubby --info=/boot/my_kernel
index=0
kernel=/boot/my_kernel
args="bla"
initrd=/boot/my_initrd
title=some_args
index=1
kernel=/boot/my_kernel
initrd=/boot/my_initrd
title=no_args
[root@dhcp76 boot]# rpm -q grubby
grubby-8.28-26.el7.x86_64
[root@dhcp76 boot]#


Version-Release number of selected component (if applicable):
grubby-8.40-41.el8

How reproducible:
always

Steps to Reproduce:
1. see above

Actual results:
args="ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet"

Expected results:
empty/no args, like in the RHEL-7 case.

Comment 1 Jan Stodola 2020-11-23 19:47:17 UTC
And it also doesn't help using an empty string for --args:

[root@localhost boot]# grubby --add-kernel=/boot/my_kernel --initrd=/boot/my_initrd --args="" --title=empty_args
An entry for kernel my_kernel already exists, adding /boot/loader/entries/2d33c9bc03a345b4990f71804c74e899-my_kernel.4~custom.conf
[root@localhost boot]# grubby --info=/boot/my_kernel
index=2
kernel="/boot/my_kernel"
args="ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet"
root="/dev/mapper/rhel-root"
initrd="/boot/my_initrd"
title="empty_args"
id="2d33c9bc03a345b4990f71804c74e899-my_kernel.4~custom"
...

Comment 7 Petr Janda 2022-09-09 13:53:41 UTC
From man page of grubby-8.40-42.el8

--args=kernel-args
        When  a  new  kernel  is  added, this specifies the command line
        arguments which should be passed to the kernel by default  (note
        they  are  merged  with  the  arguments  of the default entry if
        --copy-default is used).  When  --update-kernel  is  used,  this
        specifies  new  arguments to add to the argument list. Multiple,
        space separated arguments may be used. If  an  argument  already
        exists  the  new value replaces the old values. The root= kernel
        argument gets special handling if  the  configuration  file  has
        special handling for specifying the root filesystem.

which leads me in opinion that reporter is right and args shouldn't be copied by default (otherwise the option --copy-default doesn't make any sense)

I would also note that when installing a new kernel (yum update| yum install some_new_kernel_package) users expects to have arguments copied to a new kernel.


Note You need to log in before you can comment on or make changes to this bug.