Plainnotes

sysctl changes that do not stick

2024-01-18 · 2 min readSystems

/etc/sysctl.conf edited, sysctl -p run, and net.ipv4.ip_forward is still 0.

The file may not be read: on systemd systems /etc/sysctl.conf is often a compatibility shim, and /etc/sysctl.d/*.conf is what applies, in filename order with later files winning.

Something may override it: /run/sysctl.d/ outranks /etc/sysctl.d/, and container runtimes or cloud-init write values there.

Or the key does not exist. sysctl -w errors, but a bad line in a config file only reaches the boot log, and sysctl -p can skip it quietly.

sysctl --system reloads everything; if the value still does not change, grep -r <key> /etc/sysctl.d /run/sysctl.d /usr/lib/sysctl.d finds the winner.