SYSTEMD-SYSCTL.SERVICE(8)

โœจ SYSTEMD-SYSCTL.SERVICE(8) โœจ

okay bestie, so this is the manual for systemd-sysctl.service and systemd-sysctl, living in the systemd-sysctl.service section of the systemd docs ๐Ÿ’– pull up a chair, we're configuring kernel parameters at boot and it's honestly iconic.


๐ŸŒธ NAME ๐ŸŒธ

systemd-sysctl.service, systemd-sysctl โ€” configure kernel parameters at boot ๐Ÿซถ


โœจ SYNOPSIS โœจ

/usr/lib/systemd/systemd-sysctl [OPTIONS...] [CONFIGFILE...]

systemd-sysctl.service

๐Ÿ’… DESCRIPTION ๐Ÿ’…

So systemd-sysctl.service is an early boot service that sets up your sysctl(8) kernel parameters by calling /usr/lib/systemd/systemd-sysctl. Like, before you've even had your coffee, she's already out there doing the work ๐Ÿ‘‘

When you run /usr/lib/systemd/systemd-sysctl with no arguments, it applies all the directives from the configuration files listed in sysctl.d(5). But when you hit it with positional arguments, it executes exactly the config you asked for on the command line. The deets:

  • If you pass the string - instead of a filename, the configuration is read from standard input ๐Ÿ™ˆ
  • If your argument is a file name (no slashes anywhere), all the configuration directories get searched for a matching file, and the one with the highest priority wins and gets executed.
  • If your argument is a path, that file is used directly โ€” no searching the config directories for other matching files, periodt.

Also, the --prefix= option can be used to limit which sysctl settings get applied. So like, a little vibe check on what actually runs โœจ

Peep sysctl.d(5) for info about configuring sysctl settings. And heads up: after the sysctl config is changed on disk, it must be written to the files in /proc/sys/ before it actually takes effect. You can update specific settings, or just reload all the config โ€” check the Examples below ๐ŸŒˆ


๐ŸŽ€ OPTIONS ๐ŸŽ€

  • --prefix= โ€” Only apply rules with the specified prefix.

Added in version 230.

  • --strict โ€” Always return a non-zero exit code on failure (including an invalid sysctl variable name and insufficient permissions), unless the sysctl variable name is prefixed with a - character.

Added in version 252.

  • --verify โ€” After systemd-sysctl successfully writes a value to a sysctl variable, the variable gets read back and verified to match the value that was written. If it can't be read back, or if the value that comes back differs from what was written, the write operation counts as failed ๐Ÿ’€ To detect these failures reliably, it's recommended to also specify --strict, and to make sure the settings being applied are not prefixed with - (see sysctl.d(5) for the details). This mode is disabled by default, since the format the kernel accepts may differ from the format returned when the variable is read back, or the kernel may normalize the input. Because of that, verification may not work reliably in all cases. So this option is best used together with explicitly specified configuration files, or settings provided through --inline, or with --prefix= to restrict the set of sysctl variables being written.

Added in version 262.

  • --inline โ€” Treat each positional argument as a separate configuration line instead of a file name. When you use this, at least one positional argument must be specified.

Added in version 259.

  • --save=FILENAME โ€” Before applying the loaded sysctl settings, write them to /run/sysctl.d/ using the specified filename. If the filename doesn't end with .conf, the suffix gets appended. This option requires one or more positional arguments. May be combined with --inline. This is useful for creating runtime sysctl configuration files or overriding existing sysctl configuration files ๐Ÿ”ฅ

Added in version 262.

  • --revert=FILENAME โ€” Before loading and applying the sysctl settings, removes the specified sysctl configuration file under /run/sysctl.d/. If the filename doesn't end with .conf, the suffix gets appended. This is handy for removing configuration files that were created by --save=.

Added in version 262.

  • --cat-config โ€” Copy the contents of config files to standard output. Before each file, the filename gets printed as a comment.
  • --tldr โ€” Copy the contents of config files to standard output. Only the "interesting" parts of the configuration files get printed โ€” comments and empty lines are skipped. Before each file, the filename gets printed as a comment. (ngl this is the one for when you have zero attention span, no shade ๐Ÿ˜ญ)
  • --no-pager โ€” Do not pipe output into a pager.
  • -h, --help โ€” Print a short help text and exit.
  • --version โ€” Print a short version string and exit.

๐Ÿฆ‹ CREDENTIALS ๐Ÿฆ‹

systemd-sysctl supports the service credentials logic as implemented by ImportCredential=/LoadCredential=/SetCredential= (peep systemd.exec(5) for the details). Here's which credentials get used when passed in:

  • sysctl.extra โ€” The contents of this credential may contain additional lines to operate on. The credential contents should follow the same format as any other sysctl.d/ drop-in configuration file. If this credential is passed, it gets processed after all of the drop-in files read from the file system. So the settings configured in the credential take precedence over the ones in the file system ๐Ÿ‘‘

Added in version 252.

ngl, by default the systemd-sysctl.service unit file is set up to inherit the "sysctl.extra" credential from the service manager. so that's just happening, bestie.

๐Ÿ“ EXAMPLES ๐Ÿ“

Example 1. Reset all sysctl settings

systemctl restart systemd-sysctl

Example 2. View coredump handler configuration

# sysctl kernel.core_pattern
kernel.core_pattern = |/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t %P %I

Example 3. Update and verify coredump handler configuration

# /usr/lib/systemd/systemd-sysctl --prefix kernel.core_pattern --strict --verify

This searches all the directories listed in sysctl.d(5) for configuration files and writes /proc/sys/kernel/core_pattern. The sysctl variable gets read back and verified. If the writing or the verification fails, the command exits with a non-zero status โ€” unless the corresponding setting is prefixed with -.

Example 4. Update coredump handler configuration according to a specific file

# /usr/lib/systemd/systemd-sysctl 50-coredump.conf

This applies all the settings found in 50-coredump.conf. Either /etc/sysctl.d/50-coredump.conf, or /run/sysctl.d/50-coredump.conf, or /usr/lib/sysctl.d/50-coredump.conf will be used, in the order of preference.

Example 5. Disable IPv6 on an interface and save the specified setting

# /usr/lib/systemd/systemd-sysctl --save=99-disable-ipv6-foo - <<EOF
net.ipv6.conf.foo.disable_ipv6=1
EOF

This disables IPv6 on the network interface foo, and creates /run/sysctl.d/99-disable-ipv6-foo.conf โœจ

Example 6. Remove a runtime sysctl configuration file

# /usr/lib/systemd/systemd-sysctl --revert=99-disable-ipv6-foo --prefix=/net/ipv6/conf/foo

This removes /run/sysctl.d/99-disable-ipv6-foo.conf, and applies the remaining sysctl settings for the network interface foo.

Also peep sysctl(8) for various ways to directly apply sysctl settings, iykyk ๐Ÿ’œ


๐ŸŒŸ SEE ALSO ๐ŸŒŸ

systemd(1), sysctl.d(5), sysctl(8)


and that's the whole page, bestie!! ๐ŸŽ€ this one's from systemd 262.1, and it's the SYSTEMD-SYSCTL.SERVICE(8) manual page โ€” go configure those kernel parameters, you absolute main character ๐Ÿ‘‘๐Ÿ’–

๐Ÿ“ฆ where this page comes from
  • arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms