I couldn't find an answer in the man pages for sysctl. My sysctl.conf file is still at it's default state, I'm testing several values and loaded new settings via sysctl -p newsettings.conf. I though 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 there are still the old settings.

1 Answer
1

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.

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.
–
FleshgrinderAug 15 '12 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.
–
voretaq7♦Aug 15 '12 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.
–
FleshgrinderAug 15 '12 at 21:04