| 1 |
<?xml version="1.0"?> |
| 2 |
<!--*-nxml-*--> |
| 3 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 4 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 5 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 6 |
<refentry id="systemd-sysctl.service" |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>systemd-sysctl.service</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>systemd-sysctl.service</refentrytitle> |
| 16 |
<manvolnum>8</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>systemd-sysctl.service</refname> |
| 21 |
<refname>systemd-sysctl</refname> |
| 22 |
<refpurpose>Configure kernel parameters at boot</refpurpose> |
| 23 |
</refnamediv> |
| 24 |
|
| 25 |
<refsynopsisdiv> |
| 26 |
<cmdsynopsis> |
| 27 |
<command>/usr/lib/systemd/systemd-sysctl</command> |
| 28 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 29 |
<arg choice="opt" rep="repeat"><replaceable>CONFIGFILE</replaceable></arg> |
| 30 |
</cmdsynopsis> |
| 31 |
<para><filename>systemd-sysctl.service</filename></para> |
| 32 |
</refsynopsisdiv> |
| 33 |
|
| 34 |
<refsect1> |
| 35 |
<title>Description</title> |
| 36 |
|
| 37 |
<para><filename>systemd-sysctl.service</filename> is an early boot |
| 38 |
service that configures |
| 39 |
<citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 40 |
kernel parameters by invoking <command>/usr/lib/systemd/systemd-sysctl</command>.</para> |
| 41 |
|
| 42 |
<para>When invoked with no arguments, <command>/usr/lib/systemd/systemd-sysctl</command> applies |
| 43 |
all directives from configuration files listed in |
| 44 |
<citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>. |
| 45 |
When invoked with positional arguments, the configuration specified by the command line arguments is |
| 46 |
executed. If the string <literal>-</literal> is specified instead of a filename, the configuration is |
| 47 |
read from standard input. If the argument is a file name (without any slashes), all configuration |
| 48 |
directories are searched for a matching file and the file found that has the highest priority is |
| 49 |
executed. If the argument is a path, that file is used directly without searching the configuration |
| 50 |
directories for any other matching file.</para> |
| 51 |
|
| 52 |
<para>In addition, <option>--prefix=</option> option may be used to limit which sysctl |
| 53 |
settings are applied.</para> |
| 54 |
|
| 55 |
<para>See |
| 56 |
<citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 57 |
for information about the configuration of sysctl settings. After sysctl configuration is |
| 58 |
changed on disk, it must be written to the files in <filename>/proc/sys/</filename> before it |
| 59 |
takes effect. It is possible to update specific settings, or simply to reload all configuration, |
| 60 |
see Examples below.</para> |
| 61 |
</refsect1> |
| 62 |
|
| 63 |
<refsect1><title>Options</title> |
| 64 |
<variablelist> |
| 65 |
<varlistentry id='prefix'> |
| 66 |
<term><option>--prefix=</option></term> |
| 67 |
<listitem> |
| 68 |
<para>Only apply rules with the specified prefix.</para> |
| 69 |
|
| 70 |
<xi:include href="version-info.xml" xpointer="v230"/> |
| 71 |
</listitem> |
| 72 |
</varlistentry> |
| 73 |
<varlistentry id='strict'> |
| 74 |
<term><option>--strict=</option></term> |
| 75 |
<listitem> |
| 76 |
<para>Always return non-zero exit code on failure (including invalid sysctl variable |
| 77 |
name and insufficient permissions), unless the sysctl variable name is prefixed with a "-" |
| 78 |
character.</para> |
| 79 |
|
| 80 |
<xi:include href="version-info.xml" xpointer="v252"/> |
| 81 |
</listitem> |
| 82 |
</varlistentry> |
| 83 |
|
| 84 |
<varlistentry> |
| 85 |
<term><option>--inline</option></term> |
| 86 |
<listitem><para>Treat each positional argument as a separate configuration line instead of a file |
| 87 |
name.</para> |
| 88 |
|
| 89 |
<xi:include href="version-info.xml" xpointer="v259"/></listitem> |
| 90 |
</varlistentry> |
| 91 |
|
| 92 |
<xi:include href="standard-options.xml" xpointer="cat-config" /> |
| 93 |
<xi:include href="standard-options.xml" xpointer="tldr" /> |
| 94 |
<xi:include href="standard-options.xml" xpointer="no-pager" /> |
| 95 |
<xi:include href="standard-options.xml" xpointer="help" /> |
| 96 |
<xi:include href="standard-options.xml" xpointer="version" /> |
| 97 |
|
| 98 |
</variablelist> |
| 99 |
</refsect1> |
| 100 |
|
| 101 |
<refsect1> |
| 102 |
<title>Credentials</title> |
| 103 |
|
| 104 |
<para><command>systemd-sysctl</command> supports the service credentials logic as implemented by |
| 105 |
<varname>ImportCredential=</varname>/<varname>LoadCredential=</varname>/<varname>SetCredential=</varname> |
| 106 |
(see <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> for |
| 107 |
details). The following credentials are used when passed in:</para> |
| 108 |
|
| 109 |
<variablelist class='system-credentials'> |
| 110 |
<varlistentry> |
| 111 |
<term><varname>sysctl.extra</varname></term> |
| 112 |
|
| 113 |
<listitem><para>The contents of this credential may contain additional lines to operate on. The |
| 114 |
credential contents should follow the same format as any other <filename>sysctl.d/</filename> drop-in |
| 115 |
configuration file. If this credential is passed it is processed after all of the drop-in files read |
| 116 |
from the file system. The settings configured in the credential hence take precedence over those in |
| 117 |
the file system.</para> |
| 118 |
|
| 119 |
<xi:include href="version-info.xml" xpointer="v252"/></listitem> |
| 120 |
</varlistentry> |
| 121 |
</variablelist> |
| 122 |
|
| 123 |
<para>Note that by default the <filename>systemd-sysctl.service</filename> unit file is set up to inherit |
| 124 |
the <literal>sysctl.extra</literal> credential from the service manager.</para> |
| 125 |
</refsect1> |
| 126 |
|
| 127 |
<refsect1> |
| 128 |
<title>Examples</title> |
| 129 |
|
| 130 |
<example> |
| 131 |
<title>Reset all sysctl settings</title> |
| 132 |
|
| 133 |
<programlisting>systemctl restart systemd-sysctl</programlisting> |
| 134 |
</example> |
| 135 |
|
| 136 |
<example> |
| 137 |
<title>View coredump handler configuration</title> |
| 138 |
|
| 139 |
<programlisting># sysctl kernel.core_pattern |
| 140 |
kernel.core_pattern = |/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t %P %I |
| 141 |
</programlisting> |
| 142 |
</example> |
| 143 |
|
| 144 |
<example> |
| 145 |
<title>Update coredump handler configuration</title> |
| 146 |
|
| 147 |
<programlisting># /usr/lib/systemd/systemd-sysctl --prefix kernel.core_pattern</programlisting> |
| 148 |
|
| 149 |
<para>This searches all the directories listed in |
| 150 |
<citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 151 |
for configuration files and writes <filename>/proc/sys/kernel/core_pattern</filename>.</para> |
| 152 |
</example> |
| 153 |
|
| 154 |
<example> |
| 155 |
<title>Update coredump handler configuration according to a specific file</title> |
| 156 |
|
| 157 |
<programlisting># /usr/lib/systemd/systemd-sysctl 50-coredump.conf</programlisting> |
| 158 |
|
| 159 |
<para>This applies all the settings found in <filename>50-coredump.conf</filename>. |
| 160 |
Either <filename>/etc/sysctl.d/50-coredump.conf</filename>, or |
| 161 |
<filename>/run/sysctl.d/50-coredump.conf</filename>, or |
| 162 |
<filename>/usr/lib/sysctl.d/50-coredump.conf</filename> will be used, in the order |
| 163 |
of preference.</para> |
| 164 |
</example> |
| 165 |
|
| 166 |
<para>See |
| 167 |
<citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 168 |
for various ways to directly apply sysctl settings.</para> |
| 169 |
</refsect1> |
| 170 |
|
| 171 |
<refsect1> |
| 172 |
<title>See Also</title> |
| 173 |
<para><simplelist type="inline"> |
| 174 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 175 |
<member><citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 176 |
<member><citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 177 |
</simplelist></para> |
| 178 |
</refsect1> |
| 179 |
|
| 180 |
</refentry> |