Bug 1461279 - Heredity of cmdline works wrong when using 'replace=false'
Heredity of cmdline works wrong when using 'replace=false'
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: tuned (Show other bugs)
7.4
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Jaroslav Škarvada
Tereza Cerna
: Patch, Upstream
Depends On:
Blocks: 1465887 TUNED-7.5-REBASE 1485946
  Show dependency treegraph
 
Reported: 2017-06-14 02:29 EDT by Tereza Cerna
Modified: 2018-04-10 12:04 EDT (History)
4 users (show)

See Also:
Fixed In Version: tuned-2.9.0-0.1.rc1.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-04-10 12:04:16 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0879 normal SHIPPED_LIVE tuned bug fix and enhancement update 2018-04-10 09:39:08 EDT

  None (edit)
Description Tereza Cerna 2017-06-14 02:29:46 EDT
Description of problem:
=======================
Bootloader plugin for heredity of cmdline with addition/overwrite doesn't work as expected. 

When user uses rule 'replace=false' in child profile, all parents parameters were inherited to child. Then user wants to remove some rule from parent profile with using '=-', but this rules are still there and it should not be there. See reproducer and results.

Version-Release number of selected component:
=============================================
tuned-2.8.0-4.el7.noarch

How reproducible:
=================
always

Steps to Reproduce:
===================
1. Create a parent profile:
   # cat /usr/lib/tuned/parent-profile/tuned.conf 
   [bootloader]
   cmdline=quiet noexec=on intel_pstate=disable

2. Create a child profile:
   # cat /usr/lib/tuned/child-profile/tuned.conf 
   [main]
   include=parent-profile

   [bootloader]
   replace=false
   cmdline1=+nosoftlockup
   cmdline2=-quiet intel_pstate=disable
   cmdline3=nmi_watchdog=1

3. Activate child profile:
   # tuned-adm profile child-profile

Actual results:
===============
# grep 'set tuned_params=' /boot/grub2/grub.cfg
set tuned_params="quiet noexec=on intel_pstate=disable nosoftlockup nmi_watchdog=1"

Expected results:
=================
# grep 'set tuned_params=' /boot/grub2/grub.cfg
set tuned_params="noexec=on nosoftlockup nmi_watchdog=1"

Additional info:
================
Founded in automated test case /CoreOS/tuned/Regression/add-bootloader-plugin-for-heredity-of-cmdline-options
Comment 2 Tereza Cerna 2017-06-14 02:36:33 EDT
Info for QA:
This bug was found in automated test case /CoreOS/tuned/Regression/add-bootloader-plugin-for-heredity-of-cmdline-options in phase 'TEST 3'
Comment 3 Jaroslav Škarvada 2017-06-14 10:07:19 EDT
I am currently not sure whether it's actually bug. The line "cmdline2=-quiet intel_pstate=disable" tries to match and remove string "quiet intel_pstate=disable" which is not there, the following will do the trick:

# cat /usr/lib/tuned/child-profile/tuned.conf 
[main]
include=parent-profile

[bootloader]
replace=false
cmdline1=+nosoftlockup
cmdline2=-quiet
cmdline2.5=-intel_pstate=disable
cmdline3=nmi_watchdog=1

I.e. it will try to remove strings "quiet" and "intel_pstate=disable". Of course we could learn the plugin to automatically split it which will be probably more user friendly.
Comment 4 Jaroslav Škarvada 2017-06-14 10:43:10 EDT
RFE implemented upstream:
https://github.com/redhat-performance/tuned/commit/f068a031a820ae48426cb8c99e38a8873988a570
Comment 6 Ondřej Lysoněk 2017-07-04 05:04:01 EDT
Actually it's not a bug, it's meant to be a feature :). The reason I implemented it this way is to account for the following:

# cat /usr/lib/tuned/parent-profile/tuned.conf 
[bootloader]
cmdline=some_option 1 other_option 1

# cat /usr/lib/tuned/child-profile/tuned.conf 
[main]
include=parent-profile

[bootloader]
cmdline1=-other_option 1


Where the '1' belongs to the options 'some_option' and 'other_option'. After applying the child profile with the new implementation, you would get 'cmdline=some_option', which is not what you want. I'm not sure if such options exist in the kernel though.
Comment 7 Jaroslav Škarvada 2017-07-04 05:39:11 EDT
(In reply to Ondřej Lysoněk from comment #6)
> Actually it's not a bug, it's meant to be a feature :). The reason I
> implemented it this way is to account for the following:
> 
> # cat /usr/lib/tuned/parent-profile/tuned.conf 
> [bootloader]
> cmdline=some_option 1 other_option 1
> 
> # cat /usr/lib/tuned/child-profile/tuned.conf 
> [main]
> include=parent-profile
> 
> [bootloader]
> cmdline1=-other_option 1
> 
> 
> Where the '1' belongs to the options 'some_option' and 'other_option'. After
> applying the child profile with the new implementation, you would get
> 'cmdline=some_option', which is not what you want. I'm not sure if such
> options exist in the kernel though.

I thought it's not a bug. If I am not mistaken it should be safe to split the cmdline by spaces (and also more user friendly). IMHO the cmdline is free text, interpreted by dracut, it's scripts, kernel modules (or builtins) and AFAIK space is taken as a separator. At the moment I am not aware of anything interpreting it different way, but of course such thing can exists. To be 100% safe we could add modifier for not doing the auto-split.
Comment 8 Fedora Update System 2017-10-13 10:20:42 EDT
tuned-2.9.0-0.1.rc1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-d9c6b990df
Comment 10 Fedora Update System 2017-10-13 18:25:08 EDT
tuned-2.9.0-0.1.rc1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-d9c6b990df
Comment 11 Fedora Update System 2017-10-13 19:24:56 EDT
tuned-2.9.0-0.1.rc1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-5f0849d207
Comment 12 Fedora Update System 2017-10-29 17:06:55 EDT
tuned-2.9.0-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-0e45ce4685
Comment 13 Fedora Update System 2017-10-29 17:13:02 EDT
tuned-2.9.0-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-c30e9bd1ea
Comment 14 Tereza Cerna 2018-01-05 06:35:26 EST
============================
Verified in:
    tuned-2.9.0-1.el7.noarch
PASS
============================

:: [   LOG    ] :: ===== Apply child profile =====
:: [   PASS   ] :: Command 'tuned-adm profile test3-child-profile' (Expected 0, got 0)
:: [   PASS   ] :: Command 'grep ERROR /var/log/tuned/tuned.log' (Expected 1, got 1)
:: [   PASS   ] :: Command 'grep 'set tuned_params=' /boot/grub2/grub.cfg > output' (Expected 0, got 0)
:: [   LOG    ] :: There should be: noexec=on nosoftlockup nmi_watchdog=1
:: [   PASS   ] :: Command 'grep noexec=on output' (Expected 0, got 0)
:: [   PASS   ] :: Command 'grep nosoftlockup output' (Expected 0, got 0)
:: [   PASS   ] :: Command 'grep nmi_watchdog=1 output' (Expected 0, got 0)
:: [   LOG    ] :: There shouldn't be: intel_pstate=disable quiet
:: [   PASS   ] :: Command 'grep intel_pstate=disable output' (Expected 1, got 1)
:: [   PASS   ] :: Command 'grep quiet output' (Expected 1, got 1)

============================
Reproduced in:
    tuned-2.8.0-5.el7.noarch
FAIL
============================

:: [   LOG    ] :: ===== Apply child profile =====
:: [   PASS   ] :: Command 'tuned-adm profile test3-child-profile' (Expected 0, got 0)
:: [   PASS   ] :: Command 'grep ERROR /var/log/tuned/tuned.log' (Expected 1, got 1)
:: [   PASS   ] :: Command 'grep 'set tuned_params=' /boot/grub2/grub.cfg > output' (Expected 0, got 0)
:: [   LOG    ] :: There should be: noexec=on nosoftlockup nmi_watchdog=1
:: [   PASS   ] :: Command 'grep noexec=on output' (Expected 0, got 0)
:: [   PASS   ] :: Command 'grep nosoftlockup output' (Expected 0, got 0)
:: [   PASS   ] :: Command 'grep nmi_watchdog=1 output' (Expected 0, got 0)
:: [   LOG    ] :: There shouldn't be: intel_pstate=disable quiet
:: [   FAIL   ] :: Command 'grep intel_pstate=disable output' (Expected 1, got 0)
:: [   FAIL   ] :: Command 'grep quiet output' (Expected 1, got 0)
Comment 17 errata-xmlrpc 2018-04-10 12:04:16 EDT
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-2018:0879

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