16

I couldn't find an answer in the man pages for sysctl. My sysctl.conf file is still at its default state. I'm testing several values and loaded new settings via sysctl -p newsettings.conf. I thought it would be sufficient for reseting to do sysctl -p (which means that it reads the values from sysctl.conf), but a fast sysctl -a | grep domain revealed that they are still the old settings.

Any ideas?

2 Answers 2

20

As far as I know there is no "undo" for sysctl -- You need to re-enter the default settings (typically /etc/sysctl.conf simply does not specify defaults, so re-reading it won't revert your changes unless there's an explicit setting).

If you do not know your default settings a reboot will get them back, and you can then list them with sysctl -a (store this somewhere for reference). If you have another mostly-identical machine around you can grab the sysctl -a output from that host instead of rebooting.

3
  • 1
    Okay, thanks. Rebooting would be a possibility and then sysctl -a > sysctl_defaults.conf should do the trick. I'll leave this open for some time, maybe somebody else knows a way. If not I'll accept your answer as the correct one. Commented Aug 15, 2012 at 20:42
  • @Fleshgrinder Make sure you're storing the sysctl values somewhere where they aren't being routinely read at boot (like ~/sysctl_defaults.conf) -- Though it doesn't happen often sometimes the default value for a given sysctl knob changes, and you could introduce some accidental strangeness that way. Commented Aug 15, 2012 at 20:59
  • 1
    Thanks, I knew that and I stored them in my home directory as you have proposed. I also made sure that nothing is in /etc/sysctl.d before rebooting. Everything worked like a charm and I think your solution is totally fine. Thanks again for your help. Commented Aug 15, 2012 at 21:04
2

Sysctl Defaults

On CentOS 7, look at

/usr/lib/sysctl.d/ 

to get the default settings that ship with the OS.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.