Share this page : facebooktwitterlinkedinmailfacebooktwitterlinkedinmail
Sysctl command
The /sbin/sysctl command is used to view, set, and automate kernel settings in the /proc/sys/ directory.
For a quick overview of all settings configurable in the /proc/sys/ directory, type the /sbin/sysctl -a command as root. This creates a large, comprehensive list, a small portion of which looks something like the following:

This is the same information seen if each of the files were viewed individually. The only difference is the file location. For example, the /proc/sys/net/ipv4/route/min_delay file is listed as net.ipv4.route.min_delay, with the directory slashes replaced by dots and the proc.sys portion assumed.
The sysctl command can be used in place of echo to assign values to writable files in the /proc/sys/ directory. For example, instead of using the command
use the equivalent sysctl command as follows:
While quickly setting single values like this in /proc/sys/ is helpful during testing, this method does not work as well on a production system as special settings within /proc/sys/are lost when the machine is rebooted. To preserve custom settings, add them to the /etc/sysctl.conf file.
Each time the system boots, the init program runs the /etc/rc.d/rc.sysinit script. This script contains a command to execute sysctl using /etc/sysctl.conf to determine the values passed to the kernel. Any values added to /etc/sysctl.conf therefore take effect each time the system boots.
An issue with systemd-sysctl.service

step1: systemctl status systemd-sysctl.service

● systemd-sysctl.service – Apply Kernel Variables
Loaded: loaded (/lib/systemd/system/systemd-sysctl.service; static; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2016-05-18 12:08:32 AEST; 21min ago
Docs: man:systemd-sysctl.service(8)
man:sysctl.d(5)
Process: 539 ExecStart=/lib/systemd/systemd-sysctl (code=exited, status=1/FAILURE)
Main PID: 539 (code=exited, status=1/FAILURE)

May 18 12:08:32 frank systemd[1]: Starting Apply Kernel Variables…
May 18 12:08:32 frank systemd[1]: systemd-sysctl.service: Main process exited, code=exited, status=1/FAILURE
May 18 12:08:32 frank systemd[1]: Failed to start Apply Kernel Variables.
May 18 12:08:32 frank systemd[1]: systemd-sysctl.service: Unit entered failed state.
May 18 12:08:32 frank systemd[1]: systemd-sysctl.service: Failed with result ‘exit-code’.
Warning: systemd-sysctl.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.

step 2: less /lib/systemd/system/systemd-sysctl.service

Then compared mine with another post on the internet:
less /lib/systemd/system/systemd-sysctl.service

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit] Description=Apply Kernel Variables
Documentation=man:systemd-sysctl.service(8) man:sysctl.d(5)
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
After=systemd-modules-load.service
Before=sysinit.target shutdown.target
ConditionPathIsReadWrite=/proc/sys/

[Service] Type=oneshot
RemainAfterExit=yes
ExecStart=/lib/systemd/systemd-sysctl

 

I found that the line “After=systemd-readahead-collect.service systemd-readahead-replay.service” was missing, so inserted it into my configuration file:
“After=systemd-readahead-collect.service systemd-readahead-replay.service”
Error missed! done!