Bug 869779 - settings in /etc/sysctl.d are not applied
settings in /etc/sysctl.d are not applied
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
17
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Michal Schmidt
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-24 15:27 EDT by Gabriel Ramirez
Modified: 2012-12-07 23:35 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-07 23:35:50 EST
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)
settings to be applied to running kernel (421 bytes, text/plain)
2012-10-24 15:27 EDT, Gabriel Ramirez
no flags Details

  None (edit)
Description Gabriel Ramirez 2012-10-24 15:27:01 EDT
Created attachment 632981 [details]
settings to be applied to running kernel

Description of problem:

after upgrade to systemd-44-20.fc17.x86_64 

systemd don't apply the settings specified in /etc/sysctl.d/local.conf


Version-Release number of selected component (if applicable):
systemd-44-20.fc17.x86_64

How reproducible:
always

also happens in a kvm virtual machine 

Steps to Reproduce:
1. put a file with custom settings to be in /etc/systctl.d
2. restart
3. the setting are not applied
  
Actual results:
settings arre not applied 

Expected results:
settings applied to the running kernel

Additional info:

Fedora 17 x86_64
Comment 1 Jóhann B. Guðmundsson 2012-10-24 17:22:20 EDT
Could you remove the space after the -p in line 666 in /etc/init.d/functions

As in change the line from this

test -f "$file" && sysctl -e -p "$file" >/dev/null 2>&1

To this 

test -f "$file" && sysctl -e -p"$file" >/dev/null 2>&1

Reboot and see if your file(s) gets read and the changes applied? 

See...

https://gitorious.org/procps/procps/commit/e2987888e27173f1a421e75f582ccfbe6fd5d05e
Comment 2 Gabriel Ramirez 2012-10-25 01:42:17 EDT
thanks but changing the line to:

test -f "$file" && sysctl -e -p"$file" >/dev/null 2>&1

didn't work

I ran the following tests in a virtual machine:

current systemd-44-20.fc17.x86_64
current systemd-sysv-44-20.fc17.x86_64
current procps-3.2.8-27.20110302git.fc17.x86_64
apply changes from /etc/sysctl.conf but not from /etc/sysctl.d/*

current systemd-44-20.fc17.x86_64
current systemd-sysv-44-20.fc17.x86_64
previous procps-3.2.8-26.20110302git.fc17.x86_64
apply changes from /etc/sysctl.conf but not from /etc/sysctl.d/*

previous systemd-44-17.fc17.x86_64
previous systemd-sysv-44-17.fc17.x86_64
current  procps-3.2.8-27.20110302git.fc17.x86_64
apply correctly changes in /etc/sysctl.conf and /etc/sysctl.d/*.conf to kernel

previous systemd-44-17.fc17.x86_64
previous systemd-sysv-44-17.fc17.x86_64
previous procps-3.2.8-26.20110302git.fc17.x86_64
apply correctly changes in /etc/sysctl.conf and /etc/sysctl.d/*.conf to kernel

after that I made a backup of /usr/lib/systemd/systemd-sysctl from systemd-44-17
updated to 
current systemd-44-20.fc17.x86_64
current systemd-sysv-44-20.fc17.x86_64
current procps-3.2.8-27.20110302git.fc17.x86_64
and replaced the /usr/lib/systemd/systemd-sysctl with the file from the systemd-44-17 and that worked too
apply correctly changes in /etc/sysctl.conf and /etc/sysctl.d/*.conf to kernel
Comment 3 Jóhann B. Guðmundsson 2012-10-25 05:55:55 EDT
Probably this that is causing this http://pkgs.fedoraproject.org/cgit/systemd.git/diff/0521-sysctl-apply-configuration-at-once.patch?h=f17&id=f27ed14f670c5527e69e326bfd41ca859e3394c2

And that's ignoring files in the following directory's or not applying settings from files in those directory's

"/etc/sysctl.d","/run/sysctl.d","/usr/local/lib/sysctl.d","/usr/lib/sysctl.d",

the rest of the sysctl patches that got apply seem to be error handling...
Comment 4 Michal Schmidt 2012-10-25 08:02:00 EDT
I see the bug. It's introduced by 0568-sysctl-avoiding-exiting-with-error-on-EEXIST.patch. When we encounter a previously defined key (in this case "net.ipv4.ip_forward"), we skip parsing the rest of the file by mistake.
Comment 5 Gabriel Ramirez 2012-10-25 09:03:56 EDT
when running the above tests in the virtual machine I was not testing/seeing the last one setting 
net.netfilter.nf_conntrack_acct = 1


and using in my real machine the following combination:
current systemd-44-20.fc17.x86_64
current systemd-sysv-44-20.fc17.x86_64
current procps-3.2.8-27.20110302git.fc17.x86_64
with /usr/lib/systemd/systemd-sysctl from systemd-44-17.fc17.x86_64

net.ipv4.ip_forward = 1 is applied
kernel.shmmax = 134217728 is applied
net.netfilter.nf_conntrack_acct = 1 is not applied

after booting the machine I can:
echo 1 > /proc/sys/net/netfilter/nf_conntrack_acct 
cat /proc/sys/net/netfilter/nf_conntrack_acct
1
Comment 6 Michal Schmidt 2012-10-25 09:06:32 EDT
Gabriel, thank you for your reports. We now have sufficient information about the bug.
Comment 8 Fedora Update System 2012-10-26 11:43:18 EDT
systemd-44-21.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/systemd-44-21.fc17
Comment 9 Gabriel Ramirez 2012-10-26 12:17:37 EDT
(In reply to comment #8)
> systemd-44-21.fc17 has been submitted as an update for Fedora 17.
> https://admin.fedoraproject.org/updates/systemd-44-21.fc17

I tested it with /etc/sysctl.d/local.conf fixed one issue but another remains

net.ipv4.ip_forward = 1 is not applied
if I comment out net.ipv4.ip_forward = 0 from /etc/sysctl.conf the setting is applied so seems /etc/sysctl.conf takes precedence over /etc/sysctl.d

kernel.shmmax = 134217728 is applied correctly

net.netfilter.nf_conntrack_acct = 1
I checked and netfilter is a module  so I removed the setting from /etc/sysctl.d/local.conf and put in /etc/modprobe.d and there works
Comment 10 Fedora Update System 2012-10-27 20:59:53 EDT
Package systemd-44-21.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-44-21.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-17053/systemd-44-21.fc17
then log in and leave karma (feedback).
Comment 11 Michal Schmidt 2012-10-28 10:27:44 EDT
(In reply to comment #9)
> seems /etc/sysctl.conf takes precedence over /etc/sysctl.d

Yes, it does, intentionally. See bug 760254.
Comment 12 Gabriel Ramirez 2012-10-29 14:17:26 EDT
(In reply to comment #11)
> (In reply to comment #9)
> > seems /etc/sysctl.conf takes precedence over /etc/sysctl.d
> 
> Yes, it does, intentionally. See bug 760254.

ok, well then, the bug can be changed to fixed, 
because systemd-44-21.fc17 applies the kernel.shmmax setting

thanks
Comment 13 Fedora Update System 2012-12-05 12:20:03 EST
systemd-195-10.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/systemd-195-10.fc18
Comment 14 Fedora Update System 2012-12-07 23:35:52 EST
systemd-195-10.fc18 has been pushed to the Fedora 18 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.