Bug 1315847

Summary: /etc/init.d/function applies sysctl in wrong order.
Product: Red Hat Enterprise Linux 6 Reporter: Shatadru Bandyopadhyay <sbandyop>
Component: initscriptsAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED CANTFIX QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 6.7CC: lnykryn
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-09 08:07:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
patch none

Description Shatadru Bandyopadhyay 2016-03-08 18:44:13 UTC
Created attachment 1134273 [details]
patch

Description of problem:
/etc/init.d/function applies sysctl in wrong order.

It first applies /etc/sysctl.conf and then /etc/sysctl.d/*.conf

However sysctl --system does it in different order :
~~~
              /run/sysctl.d/*.conf
              /etc/sysctl.d/*.conf
              /usr/local/lib/sysctl.d/*.conf
              /usr/lib/sysctl.d/*.conf
              /lib/sysctl.d/*.conf
              /etc/sysctl.conf
~~~

This causes inconsistency in the order how sysctl are applied at system boot.

Version-Release number of selected component (if applicable):
initscripts-9.03.49-1.el6_7.4.x86_64

How reproducible:
Always.

Steps to Reproduce:

1. Set a same sysctl parameter in /etc/sysctl.conf and in configuration file under /etc/sysctl.d/*.conf.

Taking example of "net.ipv4.tcp_keepalive_time"
  ~~~
  # cat /etc/sysctl.conf|grep keep
  net.ipv4.tcp_keepalive_time = 999

  # cat /etc/sysctl.d/99.conf|grep keep
  net.ipv4.tcp_keepalive_time = 666


  # sysctl --system
  * Applying /etc/sysctl.d/99.conf ...
  net.ipv4.tcp_keepalive_time = 666
  * Applying /etc/sysctl.conf ...
  net.ipv4.tcp_keepalive_time = 999

  # sysctl net.ipv4.tcp_keepalive_time
  net.ipv4.tcp_keepalive_time = 999

2. Reboot the system
 # sysctl net.ipv4.tcp_keepalive_time
  net.ipv4.tcp_keepalive_time = 666<<======

3. Running "sysctl --system" of course scans all config file in proper order and sets expected value.
   
   # sysctl --system
   # sysctl net.ipv4.tcp_keepalive_time
    net.ipv4.tcp_keepalive_time = 999

Actual results:

after system boots 

 # sysctl net.ipv4.tcp_keepalive_time
  net.ipv4.tcp_keepalive_time = 666<<======



Expected results:

after system boots

 # sysctl net.ipv4.tcp_keepalive_time
  net.ipv4.tcp_keepalive_time = 999


Additional info:

1. patch attached

2. Issue is not reproducible if "NetworkManager" is installed and enabled at boot, as it only reads /etc/sysctl.conf and when it is started at boot it overrides the settings.

Comment 1 Lukáš Nykrýn 2016-03-09 08:07:48 UTC
Yeah, this is a known issue. Unfortunately fixing this would break existing setups, so there is not much we can do. This is fixed in rhel7.