RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1726514 - grubby is expanding variables in the BLS entries which it shouldn't do
Summary: grubby is expanding variables in the BLS entries which it shouldn't do
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: grubby
Version: 8.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.0
Assignee: Bootloader engineering team
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks: 1640832 1755139
TreeView+ depends on / blocked
 
Reported: 2019-07-03 05:28 UTC by Pei Zhang
Modified: 2022-10-12 06:57 UTC (History)
13 users (show)

Fixed In Version: grubby-8.40-38.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-28 16:59:27 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-26632 0 None None None 2022-10-12 06:57:49 UTC
Red Hat Product Errata RHBA-2020:1882 0 None None None 2020-04-28 16:59:32 UTC

Description Pei Zhang 2019-07-03 05:28:52 UTC
Description of problem:
Applying tuned - > Reboot - > Change kernel options - > Reboot - > Reboot, 

then "tuned.non_isolcpus=..." is duplicated show in "cat /proc/cmdline".

Version-Release number of selected component (if applicable):
4.18.0-109.rt20.50.el8.x86_64
tuned-2.12.0-1.el8.noarch

How reproducible:
100%

Steps to Reproduce:
1. Install a RHEL8 host

2. Apply tuned

# tuned-adm profile realtime-virtual-host

3. Reboot host to enable kernel change working

4. Update kernel options. eg: adding default_hugepagesz=1

# grubby --args="default_hugepagesz=1G" --update-kernel=`grubby --default-kernel`

5. Reboot host to enable kernel change working

7. Reboot host again, then check kernel cmd line, "tuned.non_isolcpus=..." info showed twice.

# cat /proc/cmdline 
BOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-109.rt20.50.el8.x86_64 root=/dev/mapper/rhel_dell--per430--10-root ro crashkernel=auto resume=/dev/mapper/rhel_dell--per430--10-swap rd.lvm.lv=rhel_dell-per430-10/root rd.lvm.lv=rhel_dell-per430-10/swap console=ttyS0,115200n81 skew_tick=1 isolcpus=1,3,5,7,9,11,13,15,17,19,12,14,16,18 intel_pstate=disable nosoftlockup nohz=on nohz_full=1,3,5,7,9,11,13,15,17,19,12,14,16,18 rcu_nocbs=1,3,5,7,9,11,13,15,17,19,12,14,16,18 default_hugepagesz=1G iommu=pt intel_iommu=on kvm-intel.vmentry_l1d_flush=never skew_tick=1 isolcpus=1,3,5,7,9,11,13,15,17,19,12,14,16,18 intel_pstate=disable nosoftlockup nohz=on nohz_full=1,3,5,7,9,11,13,15,17,19,12,14,16,18 rcu_nocbs=1,3,5,7,9,11,13,15,17,19,12,14,16,18


Actual results:
"tuned.non_isolcpus=..." should not show duplicated in /proc/cmdline, it may confuse user.

Expected results:
"tuned.non_isolcpus=..." should only show once in /proc/cmdline.

Additional info:
1. Applying tuned cpu-partitioning, realtime-virtual-host, realtime-virtual-guest all hit same issue.

Comment 1 Pei Zhang 2019-07-03 06:50:38 UTC
This is a regression bug:

tuned-2.12.0-1.el8.noarch    fail
tuned-2.10.0-15.el8.noarch   fail
tuned-2.10.0-12.el8.noarch   fail
tuned-2.10.0-11.el8.noarch   fail
tuned-2.10.0-10.el8.noarch   works well

Comment 2 Luiz Capitulino 2019-07-03 14:53:26 UTC
Pei,

I have a few questions:

1. Do you observe any issues because of the command-line duplication?
   For example, a spike or any error in the logs? I'm asking this because
   it may be that this is not harmful

2. If you find this is harmful, would you test this against tuned in RHEL7?

My thinking is: if this is harmful and it is present in RHEL7, then this is
urgent for RHEL7 and we need the BZ cloned there. If this is not harmful,
then we may skip fixing it in RHEL7 even if it's present there.

Thanks.

Comment 3 Pei Zhang 2019-07-03 15:05:29 UTC
(In reply to Luiz Capitulino from comment #2)
> Pei,
> 
> I have a few questions:
> 
> 1. Do you observe any issues because of the command-line duplication?
>    For example, a spike or any error in the logs? I'm asking this because
>    it may be that this is not harmful

Hi Luiz, 

In my latest rhel8 testing, the huge spike come back again, but I need more time to confirm which component(tuned or kernel-rt or others) cause huge spike. So I'll update once I have a certain conclusion and confirm if this duplication issue is harmless. 

> 
> 2. If you find this is harmful, would you test this against tuned in RHEL7?
> 
> My thinking is: if this is harmful and it is present in RHEL7, then this is
> urgent for RHEL7 and we need the BZ cloned there. If this is not harmful,
> then we may skip fixing it in RHEL7 even if it's present there.

I can confirm it works well in RHEL7. This issue only exists in RHEL8.

Thanks.

Best regards,

Pei

> 
> Thanks.

Comment 4 Pei Zhang 2019-07-03 15:10:36 UTC
(In reply to Pei Zhang from comment #3)
> (In reply to Luiz Capitulino from comment #2)
> > Pei,
> > 
> > I have a few questions:
> > 
> > 1. Do you observe any issues because of the command-line duplication?
> >    For example, a spike or any error in the logs? I'm asking this because
> >    it may be that this is not harmful
> 
> Hi Luiz, 
> 
> In my latest rhel8 testing, the huge spike come back again, but I need more
> time to confirm which component(tuned or kernel-rt or others) cause huge
> spike. So I'll update once I have a certain conclusion and confirm if this
> duplication issue is harmless. 

Just update the latest rhel8 1h cyclictest results. I'll try to find out which component cause this spike, results will be updated soon.

==Versions==
tuned-2.12.0-1.el8.noarch
libvirt-5.4.0-2.module+el8.1.0+3523+b348b848.x86_64
qemu-kvm-4.0.0-4.module+el8.1.0+3523+b348b848.x86_64
kernel-rt-4.18.0-109.rt20.50.el8.x86_64

==Results==
(2)Single VM with 8 rt vCPUs:
# Min Latencies: 00021 00024 00023 00026 00040 00036 00045 00055
# Avg Latencies: 00060 00060 00059 00060 00059 00075 00056 00057
# Max Latencies: 120881 120757 120750 120767 120773 120780 120813 120602

(3)Multiple VMs each with 1 rt vCPU:
- VM1
# Min Latencies: 00008
# Avg Latencies: 00064
# Max Latencies: 120688

- VM2
# Min Latencies: 00021
# Avg Latencies: 00060
# Max Latencies: 40522

- VM3
# Min Latencies: 00021
# Avg Latencies: 00058
# Max Latencies: 160658

- VM4
# Min Latencies: 00020
# Avg Latencies: 00058
# Max Latencies: 160836

(1)Single VM with 1 rt vCPU:
# Min Latencies: 00021
# Avg Latencies: 00063
# Max Latencies: 80950

Comment 10 Jaroslav Škarvada 2019-11-14 18:20:10 UTC
This is grubby fault, it seems it expands variables in the BLS entries which it shouldn't do. Reproducer on cleanly provisioned RHEL-8 machine:

# MID=`cat /etc/machine-id`
# KVER=`uname -r`
# BENTRY=/boot/loader/entries/$MID-$KVER.conf
# cat $BENTRY | grep options
options $kernelopts $tuned_params

^^^ notice there are variables $kernelopts and $tuned_params, which are normally expanded by grub from the grub environment, e.g.:

# grep kernelopts /boot/grub2/grubenv
kernelopts=root=UUID=78f056cb-1868-4fad-9ca1-67a25313709a ro console=tty0 console=ttyS0,115200 crashkernel=auto net.ifnames=0 rhgb quiet 

^^^ this is what will be expanded by grub for $kernelopts

Let's set tuned_params to something:
# grub2-editenv /boot/grub2/grubenv set 'tuned_params=quiet'

Then run grubby:
# grubby --args="default_hugepagesz=1G" --update-kernel=`grubby --default-kernel`

And re-check kernel options in the BLS entry:
# cat $BENTRY | grep options
options root=UUID=78f056cb-1868-4fad-9ca1-67a25313709a ro console=tty0 console=ttyS0,115200 crashkernel=auto net.ifnames=0 rhgb quiet quiet default_hugepagesz=1G

^^^ notice $kernelopts and $tuned_params got expanded and their content were written literally to the BLS entry. This shouldn't happen and it's the source of duplication described in the comment 0.

Comment 11 Jaroslav Škarvada 2019-11-15 12:41:27 UTC
(In reply to Jaroslav Škarvada from comment #10)
> This is grubby fault, it seems it expands variables in the BLS entries which
> it shouldn't do. Reproducer on cleanly provisioned RHEL-8 machine:
> 
> # MID=`cat /etc/machine-id`
> # KVER=`uname -r`
> # BENTRY=/boot/loader/entries/$MID-$KVER.conf
> # cat $BENTRY | grep options
> options $kernelopts $tuned_params
> 
> ^^^ notice there are variables $kernelopts and $tuned_params, which are
> normally expanded by grub from the grub environment, e.g.:
> 
> # grep kernelopts /boot/grub2/grubenv
> kernelopts=root=UUID=78f056cb-1868-4fad-9ca1-67a25313709a ro console=tty0
> console=ttyS0,115200 crashkernel=auto net.ifnames=0 rhgb quiet 
> 
> ^^^ this is what will be expanded by grub for $kernelopts
> 
> Let's set tuned_params to something:
> # grub2-editenv /boot/grub2/grubenv set 'tuned_params=quiet'
> 
> Then run grubby:
> # grubby --args="default_hugepagesz=1G" --update-kernel=`grubby
> --default-kernel`
> 
> And re-check kernel options in the BLS entry:
> # cat $BENTRY | grep options
> options root=UUID=78f056cb-1868-4fad-9ca1-67a25313709a ro console=tty0
> console=ttyS0,115200 crashkernel=auto net.ifnames=0 rhgb quiet quiet
> default_hugepagesz=1G
> 
> ^^^ notice $kernelopts and $tuned_params got expanded and their content were
> written literally to the BLS entry. This shouldn't happen and it's the
> source of duplication described in the comment 0.

I think it should either ignore the variables and add/remove grubby content after them or maybe it could read the variables and edit their content in the grubenv, but it shouldn't expand it into options.

Comment 12 Javier Martinez Canillas 2019-11-27 16:27:49 UTC
When updating a single BLS entry I think that grubby is going the correct thing, since the expected behavior there is to expand all the variables and write in the BLS entry. This is done because updating the variables in grubenv will change the kernel command line parameters of all the entries and only a single entry should be changed.

Now, the grubby --update-kernel=ALL option should update the $kernelopts variable in the grubenv instead but there is a bug there since it's also expanding the variables and writing the result in the BLS entry.

Comment 15 Petr Janda 2019-11-29 15:15:51 UTC
reproduced on RHEL-8.2-20191120.0 x86_64

1) install RHEL-8.2

2) backup /boot/loader/entries:
# cp -a /boot/loader/entries /boot/loader/entries/backup

3) check that options are unexpanded in entry
# MID=`cat /etc/machine-id`
# KVER=`uname -r`
# BENTRY=/boot/loader/entries/$MID-$KVER.conf
# grep options $BENTRY
options $kernelopts $tuned_params

4) run grubby
# grubby --update-kernel=ALL --args="default_hugepagesz=1G"

5) check options again
# grep options $BENTRY

expanded options are present instead of $kernelopts etc.

qa_ack+

Comment 17 Zdenek Veleba 2020-03-09 14:18:29 UTC
Verified
grubby-8.40-38.el8.x86_64
RHEL-8.2.0-20200227.0

Comment 19 errata-xmlrpc 2020-04-28 16:59:27 UTC
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, 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-2020:1882


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