After reboot debian box ignore sysctl.conf values

17,341

Solution 1

Check if there is a file in /etc/sysctl.d with your parameter. These files override the /etc/sysctl.conf file...

Solution 2

https://bugs.launchpad.net/ubuntu/+source/procps/+bug/50093

/etc/init.d/procps.sh comes too early in the boot process to apply a lot of sysctl's. As it runs before networking modules are loaded and filesystems are mounted, there are quite a lot of commonly-used sysctl's which are simply ignored on boot and produce errors to the console.

All documentation on the net referring to changing certain settings in /etc/sysctl.conf such as net.ipv4.netfilter.ip_conntrack_max is wrong for Ubuntu & Debian.

Finally, "It seems to me it is a Debian Squeeze bug, see here for an example and workaround: http://wiki.debian.org/BridgeNetworkConnections

In the latter case, the procps init script should take care of loading them during boot. However, on Squeeze it does not, and you need to restart it from /etc/rc.local (or similar):

# /etc/rc.local

# Load kernel variables from /etc/sysctl.d
/etc/init.d/procps restart

exit 0

Solution 3

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.

Share:
17,341

Related videos on Youtube

Korjavin Ivan
Author by

Korjavin Ivan

Some links: Github: https://github.com/korjavin

Updated on September 18, 2022

Comments

  • Korjavin Ivan
    Korjavin Ivan almost 2 years

    Where is right place for sysctl redefined values?

    I have:

    > uname -a
    Linux note 3.1.0-1-amd64 #1 SMP Tue Jan 10 05:01:58 UTC 2012 x86_64 GNU/Linux
    
    > cat /etc/debian_version 
    wheezy/sid
    
    
    > tail -n 2 /etc/sysctl.conf   
    #
    net.ipv6.bindv6only=0
    

    But after each reboot net.ipv6.bindv6only still 1

  • James O'Gorman
    James O'Gorman over 12 years
    You mean Debian doesn't read sysctl.conf by default? wow.
  • stew
    stew over 12 years
    it reads sysctl by default. the /etc/init.d/procps mecahnism is the default mechanism. If my answer works, it is because this init script was disabled for some reason, which might be a bug. A bug causing this would not be surprising since he is running either the testing or unstable release of debian (or some combination thereof)
  • Korjavin Ivan
    Korjavin Ivan over 12 years
    > sysctl net.ipv6.bindv6only net.ipv6.bindv6only = 1 doesnt works
  • Korjavin Ivan
    Korjavin Ivan over 12 years
    yep. i found /etc/sysctl.d/bindv6only.conf thanks
  • Korjavin Ivan
    Korjavin Ivan almost 12 years
    Thank you. But no, i did not use ufw. Problem was solved, data was redefined in /etc/sysctl.d
  • lkanab
    lkanab over 7 years
    /etc/sysctl.d/README states the precedence order and specifically "use /etc/sysctl.conf directly, which overrides anything in this directory." Is the README wrong?
  • Dom
    Dom over 7 years
    If you have a recent Debian, it load the /etc/sysctl.conf at the last one (see 99-sysctl.conf file). This topic is for old Debian (before 2014). In the new versions, the files must have a number to know the order to use.
  • jit
    jit over 6 years
    @Dom i am using ubuntu 16.04 LTS . Still it not taking /etc/sysctl.conf neighter 99-sysctl.conf as precedence file. anything still missing?
  • Sentient
    Sentient over 4 years
    Damn I was pulling my hair on this for hours. I thought it was issue 50093, but this was it. Thank you, thank you, thank you!
  • stolenmoment
    stolenmoment almost 4 years
    Note that in RHEL, "sysctl --system" and "systemd-sysctl.service" apply the directories in different orders. Perhaps systemd inherited init.d's ordering. I do think that "sysctl --system" applies things in the wrong order, /etc/sysctl.d/* (at least) should come after /etc/sysctl.conf, and the "defaults" (/lib/sysctl.d) should be much earlier in the sequence. This forces us to be aware of the numbering of all of the files (version-dependent?), or to edit sysctl.conf, which is far more error-prone than dropping a new file in whatever sysctl.d is processed at the right time.
  • silencedmessage
    silencedmessage over 3 years
    8 years later this is still relevant. Confirmed to be the case on Ubuntu server 20.04 running UFW
  • Edheldil
    Edheldil about 2 years
    @stolenmoment I think it's a similar braindead situation in Debian 11 - /etc/sysctl.d/99-local.conf is overwritten by e.g. /lib/sysctl.d/protect-links.conf, so it's needed to use /etc/sysctl.d/zz-local.conf instead.