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

Mantas Mikulėnas grawity at gmail.com
Sun Nov 18 22:13:47 PST 2012


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?

--
Mantas Mikulėnas


More information about the systemd-devel mailing list