[systemd-devel] Handling sysctl entries that depend on module presence?

Mantas Mikulėnas grawity at gmail.com
Tue Nov 20 12:03:40 PST 2012


On Tue, Nov 20, 2012 at 2:06 AM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Mon, 19.11.12 08:13, Mantas Mikulėnas (grawity at gmail.com) wrote:
>
>> On Mon, Nov 19, 2012 at 8:01 AM, Mantas Mikulėnas <grawity at gmail.com> wrote:
>> > Anything that is written to /sys/module/*/parameters goes to
>> > modprobe.d(5) -- again, to be applied when the module is inserted, not
>> > at some fixed point:
>> >
>> >   https://github.com/vodik/powersave/blob/master/modprobe.d/powersave.conf
>> >
>> > Use sysctl.conf(5) for settings under /proc/sys:
>> >
>> >   https://github.com/vodik/powersave/blob/master/sysctl.d/powersave.conf
>>
>> This reminded me that systemd-sysctl doesn't properly handle
>> sysctl.conf entries that depend on the presence of modules loaded by
>> modules-load.d...
>>
>> In particular, I was having problems with:
>>
>>     net.ipv4.tcp_allowed_congestion_control = cubic reno lp
>>
>> This setting is required to allow non-root programs (the Transmission
>> BitTorrent daemon in particular) to use the "lowest priority"
>> congestion control algorithm.
>>
>> However, if the "tcp_lp" module is not yet loaded, the write to
>> /proc/sys is simply refused with EINVAL (if I remember correctly).
>>
>> And if the module is loaded later (or not loaded manually), without
>> the sysctl setting being updated, Transmission receives EPERM when it
>> calls setsockopt(TCP_CONGESTION).
>>
>> This doesn't affect TCPCongestion= in systemd socket units, since root
>> is allowed to set any algorithm, and the module is simply loaded on
>> demand when systemd asks for it...
>>
>> How can this be fixed?
>
> Hmm, whenever a module is loaded this also generates udev events, maybe
> for this specific case we should add a udev rule that tries to write the
> sysctl again after the module was successfully loaded?

There would probably be too many modules even for this sysctl :/

Now that I think of it, it would be nicer if setting the sysctl
autoloaded the modules...

--
Mantas Mikulėnas


More information about the systemd-devel mailing list