Ubuntu sysctl (chaos, /etc/systcl.conf not read / ignored)

Explanation: https://serverfault.com/questions/355520/after-reboot-debian-box-ignore-sysctl-conf-values

  • /etc/sysctl.conf is not used, or the values are overriden by other sysctl configs like in /etc/sysctl.d or ufw (se below)

  • If you use ufw (uncomplicated firewall) you really need to change the values in /etc/ufw/sysctl.conf as the configuration here overrides /etc/sysctl.conf one!!!

    • net/ipv4/... directives

  • The problem seems to exist for many years, even in Ubuntu 20.04

Solution:

  • Use /etc/sysctl.d/99-sysctl.conf or separate files in /etc/sysctl.d

 

Other Information

Reload all sysctl config files:

  • sysctl --system

List all current values

  • sysctl --all
  • sysctl --all | grep swap

List a specific value

  • cat /proc/sys/vm/swappiness