Bug 1007150 - sysctl processing by systemd-sysctl does not allow parameters override
sysctl processing by systemd-sysctl does not allow parameters override
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
19
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
:
: 993562 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-11 22:45 EDT by Alexander Murashkin
Modified: 2013-11-10 11:46 EST (History)
10 users (show)

See Also:
Fixed In Version: systemd-204-16.fc19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-10-08 07:38:33 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)
Detailed configuration and actual results for all scenarios (8.76 KB, text/plain)
2013-09-11 22:45 EDT, Alexander Murashkin
no flags Details

  None (edit)
Description Alexander Murashkin 2013-09-11 22:45:45 EDT
Created attachment 796603 [details]
Detailed configuration and actual results for all scenarios

Description of problem:

Parameters in /etc/sysctl.d/* do not override parameters in /usr/lib/sysctl.d/* while processed by systemd-sysctl. 

systemd-sysctl shall process parameters the same way as sysctl --system, specifically if a parameter is defined multiple times the last value shall be used.

Version-Release number of selected component (if applicable):

systemd-204-11.fc19.x86_64

How reproducible:

*****************************************************************
* Scenario A Naive attempt to use own sysctl configuration file *
*****************************************************************

Steps to Reproduce:

1. Create a file /etc/sysctl.d/ipv4_rp_filter_local.conf
net.ipv4.conf.default.rp_filter = 2

2. Reboot the system and check rp_filter parameters
sysctl -a | fgrep .rp_filter

Actual results:

net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.p4p1.rp_filter = 1

Expected results:

net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 2
net.ipv4.conf.p4p1.rp_filter = 2

**********************************************************************
* Scenario B Naive attempt to use /etc/sysctl.d/50-default.conf file *
**********************************************************************

Steps to Reproduce:

1. Copy /usr/lib/sysctl.d/50-default.conf to /etc/sysctl.d/50-default.conf. Edit /etc/sysctl.d/50-default.conf and change line net.ipv4.conf.default.rp_filter = 1 to 
net.ipv4.conf.default.rp_filter = 2

2. Reboot the system and check rp_filter parameters
sysctl -a | fgrep .rp_filter

Actual results:   Same as in scenario A
Expected results: Same as in scenario A

******************************************************************************
* Scenario C Another naive attempt to use /etc/sysctl.d/50-default.conf file *
******************************************************************************

Steps to Reproduce:

1. Create a file /etc/sysctl.d/ipv4_rp_filter_local.conf
net.ipv4.conf.default.rp_filter = 2

2. Copy /usr/lib/sysctl.d/50-default.conf to /etc/sysctl.d/50-default.conf. Comment out line net.ipv4.conf.default.rp_filter = 1

3. Reboot the system and check rp_filter parameters
sysctl -a | fgrep .rp_filter

Actual results:   Same as in scenario A
Expected results: Same as in scenario A

*********************************************************
* Scenario D Fix /usr/lib/sysctl.d/50-default.conf file *
*********************************************************

Note that it not a good workaround as updating systemd will restore the file.

Steps to Reproduce:

1. Edit /usr/lib/sysctl.d/50-default.conf file and comment out line net.ipv4.conf.default.rp_filter = 1

2. Reboot the system and check rp_filter parameter
sysctl -a | fgrep .rp_filter

Actual&expected results are the same:

net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 2
net.ipv4.conf.p4p1.rp_filter = 2

Additional info:

Note 1.

systemctl systemd-sysctl.service status output contains lines similar to

systemd-sysctl[674]: Duplicate assignment of net/ipv4/conf/default/rp_filter in file '/etc/sysctl.d/ipv4_rp_filter_local.conf', ignoring.
systemd-sysctl[715]: Duplicate assignment of net/ipv4/conf/default/rp_filter in file '/etc/sysctl.d/50-defaults.conf', ignoring.

Note 2. systemd-sysctl is not expected and is not reasonable

- it does not allow parameters override, so if a parameter is set in some /usr/lib/sysctl.d file it cannot be later changed in /etc/sysctl.d file
- it does not treat files with the same name in any special way, so it parses  /usr/lib/sysctl.d/50-defaults.conf file even if /etc/sysctl.d/50-defaults.conf file exists

Note 3. sysctl --system processes all config files one after another, all parameters in the files one after another, so the last value wins. There are no error messages if some parameter is defined in multiple files.

systemd-sysctl shall do its processing the same way as sysctl --system
Comment 1 Harald Hoyer 2013-09-12 08:25:25 EDT
Changed in systemd upstream

commit 04bf3c1a60d82791e0320381e9268f727708f776
Author: Kay Sievers <kay@vrfy.org>
Date:   Thu Aug 15 18:35:03 2013 +0200

    sysctl: allow overwriting of values specified in "later" files


cgit.freedesktop.org/systemd/systemd/commit/?id=04bf3c1a60d82791e0320381e9268f727708f776
Comment 2 Lennart Poettering 2013-09-12 15:39:30 EDT
*** Bug 993562 has been marked as a duplicate of this bug. ***
Comment 3 Fedora Update System 2013-09-13 12:15:47 EDT
systemd-207-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/systemd-207-1.fc20
Comment 4 Alexander Murashkin 2013-09-13 12:49:46 EDT
What about F19 systemd package?
Comment 5 Zbigniew Jędrzejewski-Szmek 2013-09-14 11:43:28 EDT
Hm, I think that this is too intrusive for a bugfix in F19. The behaviour was unexpected, but probably people have setups which work with it, and applying this patch could break them.
Comment 6 Fedora Update System 2013-09-22 20:03:57 EDT
systemd-207-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 7 Karel Volný 2013-09-25 06:36:16 EDT
(In reply to Zbigniew Jędrzejewski-Szmek from comment #5)
> but probably people have setups which work with it,

well, do you have some real life example of such "probable" setup?

- there are _real_ people who need this fixed on F19 who reported bugs that it is broken ... this is not "intrusive change", this is merely a fix so that the system behaves as documented (see e.g. bug #993562 and https://fedoraproject.org/wiki/QA/Sysrq#How_do_I_enable_the_magic_SysRq_key.3F )
Comment 8 Zbigniew Jędrzejewski-Szmek 2013-09-29 09:50:10 EDT
OK, I guess it might be a good idea to backport this fix to F19.

Hm, Harald, Lennart, Michal, objections?
Comment 9 Fedora Update System 2013-10-06 18:16:14 EDT
systemd-204-16.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/systemd-204-16.fc19
Comment 10 Fedora Update System 2013-10-08 07:38:33 EDT
systemd-204-16.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

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