Bug 869779 - settings in /etc/sysctl.d are not applied
Summary: settings in /etc/sysctl.d are not applied
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 17
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Michal Schmidt
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-24 19:27 UTC by Gabriel Ramirez
Modified: 2012-12-08 04:35 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-12-08 04:35:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
settings to be applied to running kernel (421 bytes, text/plain)
2012-10-24 19:27 UTC, Gabriel Ramirez
no flags Details

Description Gabriel Ramirez 2012-10-24 19:27:01 UTC
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 21:22:20 UTC
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 05:42:17 UTC
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 09:55:55 UTC
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 12:02:00 UTC
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 13:03:56 UTC
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 13:06:32 UTC
Gabriel, thank you for your reports. We now have sufficient information about the bug.

Comment 8 Fedora Update System 2012-10-26 15:43:18 UTC
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 16:17:37 UTC
(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-28 00:59:53 UTC
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 14:27:44 UTC
(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 18:17:26 UTC
(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 17:20:03 UTC
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-08 04:35:52 UTC
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.