When should sysctl be run during boot?

Thomas M Steenholdt tmus at tmus.dk
Tue Oct 2 00:43:12 UTC 2007


Jonathan Underwood wrote:
> On 01/10/2007, Bill Nottingham <notting at redhat.com> wrote:
>> Jonathan Underwood (jonathan.underwood at gmail.com) said:
>>> Thoughts?
>> As modules could be loaded at any time, it would seem the most
>> correct way would be to do it via a modprobe.d or udev rule.
>>
> 
> I see your point. But, taken to it's logical conclusion, we'd scrap sysctl.conf
> completely.
> 
> Actually, that would be the right thing to do - it's currently a badly defined
> ad hock kludge.
> 
> I presume this issue will be shaken out during the initscripts reworking and
> NetworkManager revisions in any case.
> 

As discussed in the bug 
https://bugzilla.redhat.com/show_bug.cgi?id=312481 , we might be able to 
solve this in a good way, with a few updated tools. I'll outline the 
thoughts here and let everybody join the discussion...

What Jonathan and I discussed, was the possibility of having the module 
loading mechanism (modprobe) figure out what proc nodes a newly loaded 
module provides and selectively, apply settings to those nodes only.

That would make it possible to have a single, system-wide sysctl.conf 
file with settings for all sorts of modules, and we would no longer need 
to worry, that perhaps our modules isn't loaded when the settings are 
applied etc. Also, it makes sure that manually applied settings are not 
touched.
See the following sniplet from the bugzilla discussion for an example:

-- snip --
My system is configured with net.ipv4.ip_forward = 0... But I'm plying 
with routing so I did an echo -n 1 >/proc/sys/net/ipv4/ip_forward to 
enable forwarding. Now I plug in my USB disk and modules gets loaded. 
It's really important that ip_forward is still "1" at this point
-- snap --

This should work for boot, randomly loading and unloading modules, 
manually changing /proc/sys settings at runtime etc.

Perhaps the heuristic needs to be: when loading a module, modprobe 
should (using sysctl or otherwise) look at sysctl.conf and set any 
values for entries created by the loading of this module, and disregard 
all others. sysctl -p would then serve the purpose of resetting all 
values to those in sysctl.conf, if needed by the user.


/Thomas (with random exempts from the BZ dialog with Jonathan Underwood)




More information about the fedora-devel-list mailing list