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 1455161 - Not limited parser for bootloader variable initrd_remove_dir
Summary: Not limited parser for bootloader variable initrd_remove_dir
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: tuned
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jaroslav Škarvada
QA Contact: Tereza Cerna
URL:
Whiteboard:
Depends On:
Blocks: 1465887 TUNED-7.5-REBASE 1485946
TreeView+ depends on / blocked
 
Reported: 2017-05-24 11:59 UTC by Tereza Cerna
Modified: 2018-04-10 16:01 UTC (History)
4 users (show)

Fixed In Version: tuned-2.9.0-0.1.rc1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 16:01:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0879 0 normal SHIPPED_LIVE tuned bug fix and enhancement update 2018-04-10 13:39:08 UTC

Description Tereza Cerna 2017-05-24 11:59:25 UTC
Description of problem:
=======================
There is parser with no limits for variable initrd_remove_dir. By description, it should check something like 'True', 'true' and '1' and then remove specified directory. However it removes directory for all values of this variable. I tried 'True', 'true', '1', 'False', 'false', '0', '/root/image' or 'blabla' and it removes this directory for all these values.


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


How reproducible:
=================
Always


Steps to Reproduce:
===================
# cat /usr/lib/tuned/test-profile/tuned.conf 
[bootloader]
initrd_add_dir=/root/image
initrd_dst_img=/boot/test-tuned-2.img
initrd_remove_dir=blabla

# find /root/image
/root/image
/root/image/etc
/root/image/etc/aaa

# tuned-adm profile test-profile

# cat /var/log/tuned/tuned.log 
2017-05-24 07:04:25,872 INFO     tuned.daemon.daemon: stopping tunning
2017-05-24 07:04:26,072 INFO     tuned.profiles.loader: loading profile: test-profile
2017-05-24 07:04:26,073 INFO     tuned.daemon.daemon: starting tuning
2017-05-24 07:04:26,076 INFO     tuned.plugins.plugin_bootloader: generating initrd image from directory '/root/image'
2017-05-24 07:04:26,080 INFO     tuned.plugins.plugin_bootloader: installing initrd image as '/boot/test-tuned-2.img'
2017-05-24 07:04:26,081 INFO     tuned.plugins.plugin_bootloader: removing directory '/root/image'
2017-05-24 07:04:26,082 INFO     tuned.daemon.daemon: static tuning from profile 'test-profile' applied

# ls /root | grep image


Actual results:
===============
# cat /var/log/tuned/tuned.log 
...
2017-05-24 07:04:26,081 INFO     tuned.plugins.plugin_bootloader: removing directory '/root/image'
...


Expected results:
=================
It can't remove anything. There is no valid value in variable initrd_remove_dir in profile configuration file. It should remove /root/image only if this variable is set to 'True', 'true' or '1'.


Additional info:
================
I tried these values of initrd_remove_dir:
  initrd_remove_dir=True
  initrd_remove_dir=true
  initrd_remove_dir=1
  initrd_remove_dir=/root/image
  initrd_remove_dir=False
  initrd_remove_dir=false
  initrd_remove_dir=0
  initrd_remove_dir=blabla

For all these options, directory /root/image was removed.

Comment 4 Fedora Update System 2017-10-13 14:20:53 UTC
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 6 Fedora Update System 2017-10-13 22:25:15 UTC
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 7 Fedora Update System 2017-10-13 23:25:04 UTC
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 8 Fedora Update System 2017-10-29 21:07:05 UTC
tuned-2.9.0-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-0e45ce4685

Comment 9 Fedora Update System 2017-10-29 21:13:12 UTC
tuned-2.9.0-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-c30e9bd1ea

Comment 10 Tereza Cerna 2018-01-25 15:17:01 UTC
============================
Verified in:
    tuned-2.9.0-1.el7.noarch
PASS
============================

:: [   LOG    ] :: ================================================================
:: [   LOG    ] :: ==== Config: [bootloader] initrd_remove_dir=False ====
:: [   LOG    ] :: See content of profile dst-img-profile2
[bootloader]
initrd_add_dir=/root/tuned-overlay.img
initrd_dst_img=/boot/test-tuned-2.img
initrd_remove_dir=False
:: [   PASS   ] :: Command 'tuned-adm profile dst-img-profile2' (Expected 0, got 0)
:: [   PASS   ] :: Command 'tuned-adm active | grep dst-img-profile2' (Expected 0, got 0)
:: [   LOG    ] :: Check log file
:: [   PASS   ] :: Command 'grep "INFO     tuned.plugins.plugin_bootloader: generating initrd image from directory '/root/tuned-overlay.img'" /var/log/tuned/tuned.log' (Expected 0, got 0)
:: [   PASS   ] :: Command 'grep "INFO     tuned.plugins.plugin_bootloader: installing initrd image as '/boot/test-tuned-2.img'" /var/log/tuned/tuned.log' (Expected 0, got 0)
:: [   PASS   ] :: Command 'grep "INFO     tuned.plugins.plugin_bootloader: removing directory '/root/tuned-overlay.img'" /var/log/tuned/tuned.log' (Expected 1, got 1)
:: [   PASS   ] :: Command 'grep "ERROR" /var/log/tuned/tuned.log' (Expected 1, got 1)
:: [   LOG    ] :: Check grub.cfg
:: [   PASS   ] :: Command 'grep 'set tuned_initrd="/test-tuned-2.img"' /boot/grub2/grub.cfg' (Expected 0, got 0)
:: [   LOG    ] :: Check existence of new image in /boot
:: [   PASS   ] :: Command 'ls /boot | grep test-tuned-2.img' (Expected 0, got 0)
:: [   PASS   ] :: Command 'ls /root | grep tuned-overlay.img' (Expected 0, got 0)

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

:: [   LOG    ] :: ================================================================
:: [   LOG    ] :: ==== Config: [bootloader] initrd_remove_dir=$INVALID_VALUE ====
:: [   LOG    ] :: See content of profile dst-img-profile2
:: [   PASS   ] :: Command 'tuned-adm profile dst-img-profile2' (Expected 0, got 0)
:: [   PASS   ] :: Command 'tuned-adm active | grep dst-img-profile2' (Expected 0, got 0)
:: [   LOG    ] :: Check log file
:: [   PASS   ] :: Command 'grep "INFO     tuned.plugins.plugin_bootloader: generating initrd image from directory '/root/tuned-overlay.img'" /var/log/tuned/tuned.log' (Expected 0, got 0)
:: [   PASS   ] :: Command 'grep "INFO     tuned.plugins.plugin_bootloader: installing initrd image as '/boot/test-tuned-2.img'" /var/log/tuned/tuned.log' (Expected 0, got 0)
:: [   FAIL   ] :: Command 'grep "INFO     tuned.plugins.plugin_bootloader: removing directory '/root/tuned-overlay.img'" /var/log/tuned/tuned.log' (Expected 1, got 0)
:: [   PASS   ] :: Command 'grep "ERROR" /var/log/tuned/tuned.log' (Expected 1, got 1)
:: [   LOG    ] :: Check grub.cfg
:: [   PASS   ] :: Command 'grep 'set tuned_initrd="/test-tuned-2.img"' /boot/grub2/grub.cfg' (Expected 0, got 0)
:: [   LOG    ] :: Check existence of new image in /boot
:: [   PASS   ] :: Command 'ls /boot | grep test-tuned-2.img' (Expected 0, got 0)
:: [   FAIL   ] :: Command 'ls /root | grep tuned-overlay.img' (Expected 0, got 1)

Comment 13 errata-xmlrpc 2018-04-10 16:01:26 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-2018:0879


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