44

I am making changes to a file in the /etc/sysctl.d directory (Ubuntu 12.04).

I know that sysctl -p reloads from /etc/sysctl.conf but it doesn't seem to work for anything under the /etc/sysctl.d/ directory. A reboot works, but I'd like to do it without a reboot.

Any suggestions?

nc4pk
  • 9,117
  • 14
  • 60
  • 71

3 Answers3

77

As documented, for recent util-linux versions:

# Load settings from all system configuration files
sysctl --system

For older versions (that is, if --system does not work):

# Load settings from /etc/sysctl.conf
sysctl -p
# Load settings from the specified file
sysctl -p /etc/sysctl.d/<whatever>.conf
u1686_grawity
  • 452,512
11

The README file in /etc/sysctl.d/ on an Ubuntu 12.04 system with procps 1:3.2.8-11ubuntu6.3 says to run:

service procps start

Which ends up running (via /etc/init/procps.conf) this:

cat /etc/sysctl.d/*.conf /etc/sysctl.conf | sysctl -e -p -
0

On newer systemd-based systems, the preferred procedure is to either run systemd-sysctl manually:

systemd-sysctl

or restart the corresponding service:

systemctl restart systemd-sysctl

Source: systemd-sysctl manpage

danielkza
  • 404
  • 4
  • 10