HALF ECHO LEARN / REFERENCE COLLECTION
v262.2man/systemctl.xml
Git blob: b67a7efabcd07f37520a1232e63e3e99dd654150
Lines 1–1000 of 3,119
<?xml version='1.0'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % entities SYSTEM "custom-entities.ent" >
%entities;
]>
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
<refentry id="systemctl"
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>systemctl</title>
<productname>systemd</productname>
</refentryinfo>
<refmeta>
<refentrytitle>systemctl</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>systemctl</refname>
<refpurpose>Control the systemd system and service manager</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>systemctl</command>
<arg choice="opt" rep="repeat">OPTIONS</arg>
<arg choice="plain">COMMAND</arg>
<arg choice="opt" rep="repeat">UNIT</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><command>systemctl</command> may be used to introspect and
control the state of the <literal>systemd</literal> system and
service manager. Please refer to
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
for an introduction into the basic concepts and functionality this
tool manages.</para>
</refsect1>
<refsect1>
<title>Commands</title>
<para>The following commands are understood:</para>
<refsect2>
<title>Unit Commands (Introspection and Modification)</title>
<variablelist>
<varlistentry>
<term><command>list-units</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
<listitem>
<para>List units that <command>systemd</command> currently has in memory. This includes units that are
either referenced directly or through a dependency, units that are pinned by applications programmatically,
or units that were active in the past and have failed. By default, only units which are active, have pending
jobs, or have failed are shown; this can be changed with option <option>--all</option>. If one or more
<replaceable>PATTERN</replaceable>s are specified, only units matching one of them are shown. The units
that are shown are additionally filtered by <option>--type=</option> and <option>--state=</option> if those
options are specified.</para>
<para>Note that this command does not show unit templates, but only instances of unit
templates. Units templates that are not instantiated are not runnable, and will thus never show up
in the output of this command. Specifically this means that <filename>foo@.service</filename>
will never be shown in this list — unless instantiated, e.g. as
<filename>foo@bar.service</filename>. Use <command>list-unit-files</command> (see below) for
listing installed unit template files.</para>
<para>Produces output similar to
<programlisting> UNIT LOAD ACTIVE SUB DESCRIPTION
sys-module-fuse.device loaded active plugged /sys/module/fuse
-.mount loaded active mounted Root Mount
boot-efi.mount loaded active mounted /boot/efi
systemd-journald.service loaded active running Journal Service
systemd-logind.service loaded active running Login Service
● user@1000.service loaded failed failed User Manager for UID 1000
…
systemd-tmpfiles-clean.timer loaded active waiting Daily Cleanup of Temporary Directories
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
123 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.</programlisting></para>
<para>The header and the last unit of a given type are underlined if the terminal supports
that. A colored dot is shown next to services which were masked, not found, or otherwise
failed.</para>
<para>The LOAD column shows the load state, one of <constant>loaded</constant>,
<constant>not-found</constant>, <constant>bad-setting</constant>, <constant>error</constant>,
<constant>masked</constant>. The ACTIVE columns shows the general unit state, one of the
following:</para>
<xi:include href="unit-states.xml" xpointer="table"/>
<para>The SUB column shows the unit-type-specific detailed state of the unit, possible values
vary by unit type. The list of possible LOAD, ACTIVE, and SUB states is not constant and new
systemd releases may both add and remove values.
<programlisting>systemctl --state=help</programlisting> command may be used to display the
current set of possible values.</para>
<para>This is the default command.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>list-automounts</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
<listitem>
<para>List automount units currently in memory, ordered by mount path. If one or more
<replaceable>PATTERN</replaceable>s are specified, only automount units matching one of them are shown.
Produces output similar to
<programlisting>
WHAT WHERE MOUNTED IDLE TIMEOUT UNIT
/dev/sdb1 /mnt/test no 120s mnt-test.automount
binfmt_misc /proc/sys/fs/binfmt_misc yes 0 proc-sys-fs-binfmt_misc.automount
2 automounts listed.</programlisting>
</para>
<para>Also see <option>--show-types</option>, <option>--all</option>, and <option>--state=</option>.</para>
<xi:include href="version-info.xml" xpointer="v252"/>
</listitem>
</varlistentry>
<varlistentry>
<term><command>list-paths</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
<listitem>
<para>List path units currently in memory, ordered by path. If one or more
<replaceable>PATTERN</replaceable>s are specified, only path units matching one of them are shown.
Produces output similar to
<programlisting>
PATH CONDITION UNIT ACTIVATES
/run/systemd/ask-password DirectoryNotEmpty systemd-ask-password-plymouth.path systemd-ask-password-plymouth.service
/run/systemd/ask-password DirectoryNotEmpty systemd-ask-password-wall.path systemd-ask-password-wall.service
/var/cache/cups/org.cups.cupsd PathExists cups.path cups.service
3 paths listed.</programlisting>
</para>
<para>Also see <option>--show-types</option>, <option>--all</option>, and <option>--state=</option>.</para>
<xi:include href="version-info.xml" xpointer="v254"/>
</listitem>
</varlistentry>
<varlistentry>
<term><command>list-sockets</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
<listitem>
<para>List socket units currently in memory, ordered by listening address. If one or more
<replaceable>PATTERN</replaceable>s are specified, only socket units matching one of them are
shown. Produces output similar to
<programlisting>
LISTEN UNIT ACTIVATES
kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
/dev/rfkill systemd-rfkill.socket systemd-rfkill.service
…
5 sockets listed.</programlisting>
Note: because the addresses might contains spaces, this output
is not suitable for programmatic consumption.
</para>
<para>Also see <option>--show-types</option>, <option>--all</option>, and <option>--state=</option>.</para>
<xi:include href="version-info.xml" xpointer="v202"/>
</listitem>
</varlistentry>
<varlistentry>
<term><command>list-timers</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
<listitem>
<para>List timer units currently in memory, ordered by the time they elapse next. If one or more
<replaceable>PATTERN</replaceable>s are specified, only units matching one of them are shown.
Produces output similar to
<programlisting>
NEXT LEFT LAST PASSED UNIT ACTIVATES
- - Thu 2017-02-23 13:40:29 EST 3 days ago ureadahead-stop.timer ureadahead-stop.service
Sun 2017-02-26 18:55:42 EST 1min 14s left Thu 2017-02-23 13:54:44 EST 3 days ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Sun 2017-02-26 20:37:16 EST 1h 42min left Sun 2017-02-26 11:56:36 EST 6h ago apt-daily.timer apt-daily.service
Sun 2017-02-26 20:57:49 EST 2h 3min left Sun 2017-02-26 11:56:36 EST 6h ago snapd.refresh.timer snapd.refresh.service
</programlisting>
</para>
<para><emphasis>NEXT</emphasis> shows the next time the timer will run.</para>
<para><emphasis>LEFT</emphasis> shows how long till the next time the timer runs.</para>
<para><emphasis>LAST</emphasis> shows the last time the timer ran.</para>
<para><emphasis>PASSED</emphasis> shows how long has passed since the timer last ran.</para>
<para><emphasis>UNIT</emphasis> shows the name of the timer</para>
<para><emphasis>ACTIVATES</emphasis> shows the name the service the timer activates when it runs.</para>
<para>Also see <option>--all</option> and <option>--state=</option>.</para>
<xi:include href="version-info.xml" xpointer="v209"/>
</listitem>
</varlistentry>
<varlistentry>
<term><command>is-active <replaceable>PATTERN</replaceable>…</command></term>
<listitem>
<para>Check whether any of the specified units are active
(i.e. running). Returns an exit code
<constant>0</constant> if at least one is active, or
non-zero otherwise. Unless <option>--quiet</option> is
specified, this will also print the current unit state to
standard output.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>is-failed <optional><replaceable>PATTERN</replaceable>…</optional></command></term>
<listitem>
<para>Check whether any of the specified units is in the "failed" state. If no unit is specified,
check whether there are any failed units or ordering cycles, which corresponds to the <literal>degraded</literal>
state returned by <command>is-system-running</command>. Returns an exit code <constant>0</constant>
if at least one has failed, non-zero otherwise. Unless <option>--quiet</option> is specified, this
will also print the current unit or system state to standard output.</para>
<xi:include href="version-info.xml" xpointer="v197"/>
</listitem>
</varlistentry>
<varlistentry>
<term><command>status</command> <optional><replaceable>PATTERN</replaceable>…|<replaceable>PID</replaceable>…]</optional></term>
<listitem>
<para>Show runtime status information about the whole system or about one or more units followed
by most recent log data from the journal. If no positional arguments are specified, and no unit
filter is given with <option>--type=</option>, <option>--state=</option>, or
<option>--failed</option>, shows the status of the whole system. If combined with
<option>--all</option>, follows that with the status of all units. If positional arguments are
specified, each positional argument is treated as either a unit name to show, or a glob pattern
to show units whose names match that pattern, or a PID to show the unit containing that PID. When
<option>--type=</option>, <option>--state=</option>, or <option>--failed</option> are used, units
are additionally filtered by the TYPE and ACTIVE state.</para>
<para>This function is intended to generate human-readable output. If you are looking for
computer-parsable output, use <command>show</command> instead. By default, this function only
shows 10 lines of output and ellipsizes lines to fit in the terminal window. This can be changed
with <option>--lines</option> and <option>--full</option>, see above. In addition,
<command>journalctl --unit=<replaceable>NAME</replaceable></command> or <command>journalctl
--user-unit=<replaceable>NAME</replaceable></command> use a similar filter for messages and might
be more convenient.</para>
<para>Note that this operation only displays <emphasis>runtime</emphasis> status, i.e. information about
the current invocation of the unit (if it is running) or the most recent invocation (if it is not
running anymore, and has not been released from memory). Information about earlier invocations,
invocations from previous system boots, or prior invocations that have already been released from
memory may be retrieved via <command>journalctl --unit=</command>.</para>
<para>systemd implicitly loads units as necessary, so just running the <command>status</command>
will attempt to load a file. The command is thus not useful for determining if something was
already loaded or not. The units may possibly also be quickly unloaded after the operation is
completed if there's no reason to keep it in memory thereafter.</para>
<example>
<title>Example output from systemctl status </title>
<programlisting>$ systemctl status bluetooth
● bluetooth.service - Bluetooth service
Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; preset: enabled)
Active: active (running) since Wed 2017-01-04 13:54:04 EST; 1 weeks 0 days ago
Docs: man:bluetoothd(8)
Main PID: 930 (bluetoothd)
Status: "Running"
Tasks: 1
Memory: 648.0K
CPU: 435ms
CGroup: /system.slice/bluetooth.service
└─930 /usr/lib/bluetooth/bluetoothd
Jan 12 10:46:45 example.com bluetoothd[8900]: Not enough free handles to register service
Jan 12 10:46:45 example.com bluetoothd[8900]: Current Time Service could not be registered
Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output error (5)
</programlisting>
<para>The dot ("●") uses color on supported terminals to summarize the unit state at a
glance. Along with its color, its shape varies according to its state:
<literal>inactive</literal> or <literal>maintenance</literal> is a white circle ("○"),
<literal>active</literal> is a green dot ("●"), <literal>deactivating</literal> is a white dot,
<literal>failed</literal> or <literal>error</literal> is a red cross ("×"), and
<literal>reloading</literal> or <literal>refreshing</literal> is a green clockwise circle arrow
("↻").</para>
<para>The "Loaded:" line in the output will show <literal>loaded</literal> if the unit has been
loaded into memory. Other possible values for "Loaded:" include: <literal>error</literal> if
there was a problem loading it, <literal>not-found</literal> if no unit file was found for this
unit, <literal>bad-setting</literal> if an essential unit file setting could not be parsed and
<literal>masked</literal> if the unit file has been masked. Along with showing the path to the
unit file, this line will also show the enablement state. Enabled units are included in the
dependency network between units, and thus are started at boot or via some other form of
activation. See the full table of possible enablement states — including the definition of
<literal>masked</literal> — in the documentation for the <command>is-enabled</command> command.
</para>
<para>The "Active:" line shows active state. The value is usually <literal>active</literal> or
<literal>inactive</literal>. Active could mean started, bound, plugged in, etc depending on the
unit type. The unit could also be in process of changing states, reporting a state of
<literal>activating</literal> or <literal>deactivating</literal>. A special
<literal>failed</literal> state is entered when the service failed in some way, such as a crash,
exiting with an error code or timing out. If the failed state is entered the cause will be logged
for later reference.</para>
</example>
</listitem>
</varlistentry>
<varlistentry>
<term><command>show</command> <optional><replaceable>PATTERN</replaceable>…|<replaceable>JOB</replaceable>…</optional></term>
<listitem>
<para>Show properties of one or more units, jobs, or the manager itself. If no argument is specified,
properties of the manager will be shown. If a unit name is specified, properties of the unit are shown, and
if a job ID is specified, properties of the job are shown. By default, empty properties are suppressed. Use
<option>--all</option> to show those too. To select specific properties to show, use
<option>--property=</option>. This command is intended to be used whenever computer-parsable output is
required. Use <command>status</command> if you are looking for formatted human-readable output.</para>
<para>Many properties shown by <command>systemctl show</command> map directly to configuration settings of
the system and service manager and its unit files. Note that the properties shown by the command are
generally more low-level, normalized versions of the original configuration settings and expose runtime
state in addition to configuration. For example, properties shown for service units include the service's
current main process identifier as <literal>MainPID</literal> (which is runtime state), and time settings
are always exposed as properties ending in the <literal>…USec</literal> suffix even if a matching
configuration options end in <literal>…Sec</literal>, because microseconds is the normalized time unit used
internally by the system and service manager.</para>
<para>For details about many of these properties, see the documentation of the D-Bus interface
backing these properties, see
<citerefentry><refentrytitle>org.freedesktop.systemd1</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>cat <replaceable>PATTERN</replaceable>…</command></term>
<listitem>
<para>Show backing files of one or more units. Prints the
"fragment" and "drop-ins" (source files) of units. Each
file is preceded by a comment which includes the file
name. Note that this shows the contents of the backing files
on disk, which might not match the system manager's
understanding of these units if any unit files were
updated on disk and the <command>daemon-reload</command>
command was not issued since.</para>
<xi:include href="version-info.xml" xpointer="v209"/>
</listitem>
</varlistentry>
<varlistentry>
<term><command>help <replaceable>PATTERN</replaceable>…|<replaceable>PID</replaceable>…</command></term>
<listitem>
<para>Show manual pages for one or more units, if
available. If a PID is given, the manual pages for the unit
the process belongs to are shown.</para>
<xi:include href="version-info.xml" xpointer="v185"/>
</listitem>
</varlistentry>
<varlistentry>
<term>
<command>list-dependencies</command>
<optional><replaceable>UNIT</replaceable>…</optional>
</term>
<listitem>
<para>Shows units required and wanted by the specified
units. This recursively lists units following the
<varname>Requires=</varname>, <varname>Requisite=</varname>,
<varname>Wants=</varname>, <varname>ConsistsOf=</varname>,
<varname>BindsTo=</varname>, and <varname>Upholds=</varname>
dependencies. If no units are specified,
<filename>default.target</filename> is implied.</para>
<para>The units that are shown are additionally filtered by <option>--type=</option> and
<option>--state=</option> if those options are specified. Note that we will not be able to
use a tree structure in this case, so <option>--plain</option> is implied.</para>
<para>By default, only target units are recursively
expanded. When <option>--all</option> is passed, all other
units are recursively expanded as well.</para>
<para>Options <option>--reverse</option>,
<option>--after</option>, <option>--before</option>
may be used to change what types of dependencies
are shown.</para>
<para>Note that this command only lists units currently loaded into memory by the service manager. In
particular, this command is not suitable to get a comprehensive list at all reverse dependencies on a
specific unit, as it will not list the dependencies declared by units currently not loaded.</para>
<xi:include href="version-info.xml" xpointer="v198"/>
</listitem>
</varlistentry>
<!-- Commands that modify unit state start here -->
<varlistentry>
<term><command>start <replaceable>PATTERN</replaceable>…</command></term>
<listitem>
<para>Start (activate) one or more units specified on the command line.</para>
<para>When more than one unit is specified, the units are enqueued in a single job transaction.
This ensures that ordering dependencies (<varname>After=</varname>/<varname>Before=</varname>)
configured between the listed units are honored, regardless of the order in which they are given
on the command line. The same applies to <command>stop</command>, <command>restart</command> and
the reload/restart variants below. If a single transaction cannot be put together, separate
transactions will be submitted separately instead as a fallback.</para>
<para>Note that unit glob patterns expand to names of units currently in memory. Units which are
not active and are not in a failed state usually are not in memory, and will not be matched by
any pattern. In addition, in case of instantiated units, systemd is often unaware of the instance
name until the instance has been started. Therefore, using glob patterns with
<command>start</command> has limited usefulness. Also, secondary alias names of units are not
considered.</para>
<para>Option <option>--all</option> may be used to also operate on inactive units which are
referenced by other loaded units. Note that this is not the same as operating on "all" possible
units, because as the previous paragraph describes, such a list is ill-defined. Nevertheless,
<command>systemctl start --all <replaceable>GLOB</replaceable></command> may be useful if all the
units that should match the pattern are pulled in by some target which is known to be loaded.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>stop <replaceable>PATTERN</replaceable>…</command></term>
<listitem>
<para>Stop (deactivate) one or more units specified on the command line.</para>
<para>This command will fail if the unit does not exist or if stopping of the unit is prohibited (see
<varname>RefuseManualStop=</varname> in
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
It will <emphasis>not</emphasis> fail if any of the commands configured to stop the unit
(<varname>ExecStop=</varname>, etc.) fail, because the manager will still forcibly terminate the
unit.</para>
<para>If a unit that gets stopped can still be triggered by other units, a warning containing
the names of the triggering units is shown. <option>--no-warn</option> can be used to suppress
the warning.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>reload <replaceable>PATTERN</replaceable>…</command></term>
<listitem>
<para>Asks all units listed on the command line to reload
their configuration. Note that this will reload the
service-specific configuration, not the unit configuration
file of systemd. If you want systemd to reload the
configuration file of a unit, use the
<command>daemon-reload</command> command. In other words:
for the example case of Apache, this will reload Apache's
<filename>httpd.conf</filename> in the web server, not the
<filename>apache.service</filename> systemd unit
file.</para>
<para>This command should not be confused with the
<command>daemon-reload</command> command.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>restart <replaceable>PATTERN</replaceable>…</command></term>
<listitem>
<para>Stop and then start one or more units specified on the command line. If the units are not running
yet, they will be started.</para>
<para>Note that restarting a unit with this command does not necessarily flush out all of the unit's
resources before it is started again. For example, the per-service file descriptor storage facility (see
<varname>FileDescriptorStoreMax=</varname> in
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>) will
remain intact as long as the unit has a job pending, and is only cleared when the unit is fully stopped and
no jobs are pending anymore. If it is intended that the file descriptor store is flushed out, too, during a
restart operation an explicit <command>systemctl stop</command> command followed by <command>systemctl
start</command> should be issued.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>try-restart <replaceable>PATTERN</replaceable>…</command></term>
<listitem>
<para>Stop and then start one or more units specified on the
command line if the units are running. This does nothing
if units are not running.</para>
<!-- Note that we do not document condrestart here, as that is just compatibility support, and we generally
do not document that. -->
</listitem>
</varlistentry>
<varlistentry>
<term><command>enqueue-marked</command></term>
<listitem><para>Enqueue start/stop/restart/reload jobs for all units that have the respective
<literal>needs-*</literal> markers set. When a unit marked for reload does not support reload,
restart will be queued. Those properties can be set using <command>set-property Markers=…</command>.</para>
<para>Note that <literal>needs-restart</literal> and <literal>needs-reload</literal> use
<command>try-restart</command>/<literal>try-reload</literal> semantics: inactive units are not started.
This differs from <command>reload-or-restart</command> without <option>--marked</option>, which
starts units that are not yet running. Markers such as <literal>needs-start</literal> still
enqueue an unconditional start job.</para>
<para>Unless <option>--no-block</option> is used, <command>systemctl</command> will wait for the
queued jobs to finish.</para>
<xi:include href="version-info.xml" xpointer="v260"/></listitem>
</varlistentry>
<varlistentry>
<term><command>reload-or-restart <replaceable>PATTERN</replaceable>…</command></term>
<listitem>
<para>Reload one or more units if they support it. If not, stop and then start them instead. If the units
are not running yet, they will be started.</para>
<para>When used in combination with <option>--marked</option>, it is a deprecated alias of
<command>enqueue-marked</command>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>try-reload-or-restart <replaceable>PATTERN</replaceable>…</command></term>
<listitem>
<para>Reload one or more units if they support it. If not, stop and then start them instead. This does
nothing if the units are not running.</para>
<!-- Note that we do not document force-reload here, as that is just compatibility support, and we generally
do not document that. -->
<xi:include href="version-info.xml" xpointer="v229"/>
</listitem>
</varlistentry>
<varlistentry>
<term><command>isolate <replaceable>UNIT</replaceable></command></term>
<listitem>
<para>Start the unit specified on the command line and its dependencies
and stop all others, unless they have
<option>IgnoreOnIsolate=yes</option> (see
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
If a unit name with no extension is given, an extension of
<literal>.target</literal> will be assumed.</para>
<para>This command is dangerous, since it will immediately stop processes that are not enabled in
the new target, possibly including the graphical environment or terminal you are currently using.
</para>
<para>Note that this operation is allowed only on units where
<option>AllowIsolate=</option> is enabled. See
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>kill <replaceable>PATTERN</replaceable>…</command></term>
<listitem>
<para>Send a UNIX process signal to one or more processes of the unit. Use
<option>--kill-whom=</option> to select which process to send the signal to. Use
<option>--signal=</option> to select the signal to send. Combine with
<option>--kill-value=</option> to enqueue a POSIX Realtime Signal with an associated
value.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>clean <replaceable>PATTERN</replaceable>…</command></term>
<listitem>
<para>Remove the configuration, state, cache, logs, runtime or file descriptor store data of the specified units. Use
<option>--what=</option> to select which kind of resource to remove. For service units this may
be used to remove the directories configured with <varname>ConfigurationDirectory=</varname>,
<varname>StateDirectory=</varname>, <varname>CacheDirectory=</varname>,
<varname>LogsDirectory=</varname> and <varname>RuntimeDirectory=</varname>, see
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details. It may also be used to clear the file descriptor store as enabled via
<varname>FileDescriptorStoreMax=</varname>, see
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details. For timer units this may be used to clear out the persistent timestamp data if
<varname>Persistent=</varname> is used and <option>--what=state</option> is selected, see
<citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
command only applies to units that use either of these settings. If <option>--what=</option> is
not specified, the cache and runtime data as well as the file descriptor store are removed (as
these three types of resources are generally redundant and reproducible on the next invocation of
the unit). Multiple values can be separated by commas. Note that the specified units must be stopped
to invoke this operation.</para>
<table>
<title>
Possible values for <option>--what=</option>
</title>
<tgroup cols='2'>
<thead>
<row>
<entry>Value</entry>
<entry>Unit Setting</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>runtime</literal></entry>
<entry><varname>RuntimeDirectory=</varname></entry>
</row>
<row>
<entry><literal>state</literal></entry>
<entry><varname>StateDirectory=</varname></entry>
</row>
<row>
<entry><literal>cache</literal></entry>
<entry><varname>CacheDirectory=</varname></entry>
</row>
<row>
<entry><literal>logs</literal></entry>
<entry><varname>LogsDirectory=</varname></entry>
</row>
<row>
<entry><literal>configuration</literal></entry>
<entry><varname>ConfigurationDirectory=</varname></entry>
</row>
<row>
<entry><literal>fdstore</literal></entry>
<entry><varname>FileDescriptorStorePreserve=</varname></entry>
</row>
<row>
<entry><literal>all</literal></entry>
<entry>All of the above</entry>
</row>
<row>
<entry><literal>help</literal></entry>
<entry>Show the supported values and exit</entry>
</row>
</tbody>
</tgroup>
</table>
<xi:include href="version-info.xml" xpointer="v243"/>
</listitem>
</varlistentry>
<varlistentry>
<term><command>freeze <replaceable>PATTERN</replaceable>…</command></term>
<listitem>
<para>Freeze one or more units specified on the
command line using cgroup freezer</para>
<para>Freezing the unit will cause all processes contained within the cgroup corresponding to the unit
to be suspended. Being suspended means that unit's processes will not be scheduled to run on CPU until thawed.
Note that this command is supported only on systems that use unified cgroup hierarchy. Unit is automatically
thawed just before we execute a job against the unit, e.g. before the unit is stopped.</para>
<xi:include href="version-info.xml" xpointer="v246"/>
</listitem>
</varlistentry>
<varlistentry>
<term><command>thaw <replaceable>PATTERN</replaceable>…</command></term>
<listitem>
<para>Thaw (unfreeze) one or more units specified on the
command line.</para>
<para>This is the inverse operation to the <command>freeze</command> command and resumes the execution of
processes in the unit's cgroup.</para>
<xi:include href="version-info.xml" xpointer="v246"/>
</listitem>
</varlistentry>
<varlistentry>
<term><command>set-property <replaceable>UNIT</replaceable> <replaceable>PROPERTY</replaceable>=<replaceable>VALUE</replaceable>…</command></term>
<listitem>
<para>Set the specified unit properties at runtime where
this is supported. This allows changing configuration
parameter properties such as resource control settings at
runtime. Not all properties may be changed at runtime, but
many resource control settings (primarily those in
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
may. The changes are applied immediately, and stored on disk
for future boots, unless <option>--runtime</option> is
passed, in which case the settings only apply until the
next reboot. The syntax of the property assignment follows
closely the syntax of assignments in unit files.</para>
<para>Example: <command>systemctl set-property foobar.service CPUWeight=200</command></para>
<para>If the specified unit appears to be inactive, the
changes will be only stored on disk as described
previously hence they will be effective when the unit will
be started.</para>
<para>Note that this command allows changing multiple properties at the same time, which is
preferable over setting them individually.</para>
<para>Example: <command>systemctl set-property foobar.service CPUWeight=200 MemoryMax=2G IPAccounting=yes</command></para>
<para>Like with unit file configuration settings, assigning an empty setting usually resets a
property to its defaults.</para>
<para>Example: <command>systemctl set-property avahi-daemon.service IPAddressDeny=</command></para>
<xi:include href="version-info.xml" xpointer="v206"/>
</listitem>
</varlistentry>
<varlistentry>
<term>
<command>bind</command>
<replaceable>UNIT</replaceable>
<replaceable>PATH</replaceable>
[<replaceable>PATH</replaceable>]
</term>
<listitem><para>Bind-mounts a file or directory from the host into the specified unit's mount
namespace. The first path argument is the source file or directory on the host, the second path
argument is the destination file or directory in the unit's mount namespace. When the latter is
omitted, the destination path in the unit's mount namespace is the same as the source path on the
host. When combined with the <option>--read-only</option> switch, a read-only bind mount is
created. When combined with the <option>--mkdir</option> switch, the destination path is first
created before the mount is applied.</para>
<para>Note that this option is currently only supported for units that run within a mount namespace
(e.g.: with <option>RootImage=</option>, <option>PrivateMounts=</option>, etc.). This command
supports bind-mounting directories, regular files, device nodes, <constant>AF_UNIX</constant>
socket nodes, as well as FIFOs. The bind mount is ephemeral, and it is undone as soon as the
current unit process exits. Note that the namespace mentioned here, where the bind mount will be
added to, is the one where the main service process runs. Other processes (those executed by
<option>ExecReload=</option>, <option>ExecStartPre=</option>, etc.) run in distinct namespaces.
</para>
<para>If supported by the kernel, any prior mount on the selected target will be replaced by the
new mount. If not supported, any prior mount will be over-mounted, but remain pinned and
inaccessible.</para>
<xi:include href="version-info.xml" xpointer="v248"/></listitem>
</varlistentry>
<varlistentry>
<term>
<command>mount-image</command>
<replaceable>UNIT</replaceable>
<replaceable>IMAGE</replaceable>
[<replaceable>PATH</replaceable>
[<replaceable>PARTITION_NAME</replaceable>:<replaceable>MOUNT_OPTIONS</replaceable>]]
</term>
<listitem><para>Mounts an image from the host into the specified unit's mount namespace. The first
path argument is the source image on the host, the second path argument is the destination
directory in the unit's mount namespace (i.e. inside
<option>RootImage=</option>/<option>RootDirectory=</option>). The following argument, if any, is
interpreted as a colon-separated tuple of partition name and comma-separated list of mount options
for that partition. The format is the same as the service <option>MountImages=</option>
setting. When combined with the <option>--read-only</option> switch, a read-only mount is
created. When combined with the <option>--mkdir</option> switch, the destination path is first
created before the mount is applied.</para>
<para>Note that this option is currently only supported for units that run within a mount namespace
(i.e. with <option>RootImage=</option>, <option>PrivateMounts=</option>, etc.). Note that the
namespace mentioned here, where the image mount will be added to, is the one where the main
service process runs. Other processes (those executed by
<option>ExecReload=</option>, <option>ExecStartPre=</option>, etc.) run in distinct namespaces.
</para>
<para>If supported by the kernel, any prior mount on the selected target will be replaced by the
new mount. If not supported, any prior mount will be over-mounted, but remain pinned and
inaccessible.</para>
<para>Example:
<programlisting>systemctl mount-image foo.service /tmp/img.raw /var/lib/image root:ro,nosuid</programlisting>
<programlisting>systemctl mount-image --mkdir bar.service /tmp/img.raw /var/lib/baz/img</programlisting>
</para>
<xi:include href="version-info.xml" xpointer="v248"/></listitem>
</varlistentry>
<varlistentry>
<term><command>service-log-level</command> <replaceable>SERVICE</replaceable> [<replaceable>LEVEL</replaceable>]</term>
<listitem><para>If the <replaceable>LEVEL</replaceable> argument is not given, print the current
log level as reported by service <replaceable>SERVICE</replaceable>.</para>
<para>If the optional argument <replaceable>LEVEL</replaceable> is provided, then change the
current log level of the service to <replaceable>LEVEL</replaceable>. The log level should be a
typical syslog log level, i.e. a value in the range 0…7 or one of the strings
<constant>emerg</constant>, <constant>alert</constant>, <constant>crit</constant>,
<constant>err</constant>, <constant>warning</constant>, <constant>notice</constant>,
<constant>info</constant>, <constant>debug</constant>; see <citerefentry
project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
for details.</para>
<para>The service must have the appropriate
<varname>BusName=<replaceable>destination</replaceable></varname> property and also implement the
generic
<citerefentry><refentrytitle>org.freedesktop.LogControl1</refentrytitle><manvolnum>5</manvolnum></citerefentry>
interface. (<filename>systemctl</filename> will use the generic D-Bus protocol to access the
<interfacename>org.freedesktop.LogControl1.LogLevel</interfacename> interface for the D-Bus name
<replaceable>destination</replaceable>.)</para>
<xi:include href="version-info.xml" xpointer="v247"/></listitem>
</varlistentry>
<varlistentry>
<term><command>service-log-target</command> <replaceable>SERVICE</replaceable> [<replaceable>TARGET</replaceable>]</term>
<listitem><para>If the <replaceable>TARGET</replaceable> argument is not given, print the current
log target as reported by service <replaceable>SERVICE</replaceable>.</para>
<para>If the optional argument <replaceable>TARGET</replaceable> is provided, then change the
current log target of the service to <replaceable>TARGET</replaceable>. The log target should be
one of the strings <constant>console</constant> (for log output to the service's standard error
stream), <constant>kmsg</constant> (for log output to the kernel log buffer),
<constant>journal</constant> (for log output to
<citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
using the native journal protocol), <constant>syslog</constant> (for log output to the classic
syslog socket <filename>/dev/log</filename>), <constant>null</constant> (for no log output
whatsoever) or <constant>auto</constant> (for an automatically determined choice, typically
equivalent to <constant>console</constant> if the service is invoked interactively, and
<constant>journal</constant> or <constant>syslog</constant> otherwise).</para>
<para>For most services, only a small subset of log targets make sense. In particular, most
"normal" services should only implement <constant>console</constant>, <constant>journal</constant>,
and <constant>null</constant>. Anything else is only appropriate for low-level services that
are active in very early boot before proper logging is established.</para>
<para>The service must have the appropriate
<varname>BusName=<replaceable>destination</replaceable></varname> property and also implement the
generic
<citerefentry><refentrytitle>org.freedesktop.LogControl1</refentrytitle><manvolnum>5</manvolnum></citerefentry>
interface. (<filename>systemctl</filename> will use the generic D-Bus protocol to access the
<interfacename>org.freedesktop.LogControl1.LogLevel</interfacename> interface for the D-Bus name
<replaceable>destination</replaceable>.)</para>
<xi:include href="version-info.xml" xpointer="v247"/></listitem>
</varlistentry>
<varlistentry>
<term><command>reset-failed [<replaceable>PATTERN</replaceable>…]</command></term>
<listitem>
<para>Reset the <literal>failed</literal> state of the specified units, or if no unit name is passed, reset
the state of all units. When a unit fails in some way (i.e. process exiting with non-zero error code,
terminating abnormally or timing out), it will automatically enter the <literal>failed</literal> state and
its exit code and status is recorded for introspection by the administrator until the service is
stopped/re-started or reset with this command.</para>
<para>In addition to resetting the <literal>failed</literal> state of a unit it also resets various other
per-unit properties: the start rate limit counter of all unit types is reset to zero, as is the restart
counter of service units. Thus, if a unit's start limit (as configured with
<varname>StartLimitIntervalSec=</varname>/<varname>StartLimitBurst=</varname>) is hit and the unit refuses
to be started again, use this command to make it startable again.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>whoami [<replaceable>PID</replaceable>…]</command></term>
<listitem><para>Returns the units the processes referenced by the given PIDs belong to (one per
line). If no PID is specified returns the unit the <command>systemctl</command> command is invoked
in.</para>
<xi:include href="version-info.xml" xpointer="v254"/></listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2>
<title>Unit File Commands</title>
<variablelist>
<varlistentry>
<term><command>list-unit-files</command> <optional><replaceable>PATTERN…</replaceable></optional></term>
<listitem>
<para>List unit files installed on the system, in combination with their enablement state (as
reported by <command>is-enabled</command>). If one or more <replaceable>PATTERN</replaceable>s
are specified, only unit files whose name matches one of them are shown (patterns matching unit
file system paths are not supported).</para>
<para>Unlike <command>list-units</command> this command will list template units in addition to
explicitly instantiated units.</para>
<xi:include href="version-info.xml" xpointer="v233"/>
</listitem>
</varlistentry>
<varlistentry>
<term><command>enable <replaceable>UNIT</replaceable>…</command></term>
<term><command>enable <replaceable>PATH</replaceable>…</command></term>
<listitem>
<para>Enable one or more units or unit instances. This will create a set of symlinks, as encoded in the
[Install] sections of the indicated unit files. After the symlinks have been created,
the system manager configuration is reloaded (in a way equivalent to <command>daemon-reload</command>), in
order to ensure the changes are taken into account immediately. Note that this does
<emphasis>not</emphasis> have the effect of also starting any of the units being enabled. If this is
desired, combine this command with the <option>--now</option> switch, or invoke <command>start</command>
with appropriate arguments later. Note that in case of unit instance enablement (i.e. enablement of units of
the form <filename>foo@bar.service</filename>), symlinks named the same as instances are created in the
unit configuration directory, however they point to the single template unit file they are instantiated
from.</para>
<para>This command expects either valid unit names (in which case various unit file directories are
automatically searched for unit files with appropriate names), or absolute paths to unit files (in which
case these files are read directly). If a specified unit file is located outside of the usual unit file
directories, an additional symlink is created, linking it into the unit configuration path, thus ensuring
it is found when requested by commands such as <command>start</command>. The file system where the linked
unit files are located must be accessible when systemd is started (e.g. anything underneath
<filename>/home/</filename> or <filename>/var/</filename> is not allowed, unless those directories are
located on the root file system).</para>
<para>This command will print the file system operations executed. This output may be suppressed by passing
<option>--quiet</option>.
</para>
<para>Note that this operation creates only the symlinks suggested in the [Install]
section of the unit files. While this command is the recommended way to manipulate the unit configuration
directory, the administrator is free to make additional changes manually by placing or removing symlinks
below this directory. This is particularly useful to create configurations that deviate from the suggested
default installation. In this case, the administrator must make sure to invoke
<command>daemon-reload</command> manually as necessary, in order to ensure the changes are taken into
account.
</para>
<para>When using this operation on units without install information, a warning about it is shown.
<option>--no-warn</option> can be used to suppress the warning.</para>
<para>Enabling units should not be confused with starting (activating) units, as done by the
<command>start</command> command. Enabling and starting units is orthogonal: units may be enabled without
being started and started without being enabled. Enabling simply hooks the unit into various suggested
places (for example, so that the unit is automatically started on boot or when a particular kind of
hardware is plugged in). Starting actually spawns the daemon process (in case of service units), or binds
the socket (in case of socket units), and so on.</para>
<para>Depending on whether <option>--system</option>, <option>--user</option>, <option>--runtime</option>,
or <option>--global</option> is specified, this enables the unit for the system, for the calling user only,
for only this boot of the system, or for all future logins of all users. Note that in the last case, no
systemd daemon configuration is reloaded.</para>
<para>Using <command>enable</command> on masked units is not supported and results in an error.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>disable <replaceable>UNIT</replaceable>…</command></term>
<listitem>
<para>Disables one or more units. This removes all symlinks to the unit files backing the specified units
from the unit configuration directory, and hence undoes any changes made by <command>enable</command> or
<command>link</command>. Note that this removes <emphasis>all</emphasis> symlinks to matching unit files,
including manually created symlinks, and not just those actually created by <command>enable</command> or
<command>link</command>. Note that while <command>disable</command> undoes the effect of
<command>enable</command>, the two commands are otherwise not symmetric, as <command>disable</command> may
remove more symlinks than a prior <command>enable</command> invocation of the same unit created.</para>
<para>This command expects valid unit names only, it does not accept paths to unit files.</para>
<para>In addition to the units specified as arguments, all units are disabled that are listed in the
<varname>Also=</varname> setting contained in the [Install] section of any of the unit
files being operated on.</para>
<para>This command implicitly reloads the system manager configuration after completing the operation. Note
that this command does not implicitly stop the units that are being disabled. If this is desired, either
combine this command with the <option>--now</option> switch, or invoke the <command>stop</command> command
with appropriate arguments later.</para>
<para>This command will print information about the file system operations (symlink removals)
executed. This output may be suppressed by passing <option>--quiet</option>.
</para>
<para>If a unit gets disabled but its triggering units are still active, a warning containing
the names of the triggering units is shown. <option>--no-warn</option> can be used to suppress
the warning.</para>
<para>When this command is used with <option>--user</option>, the units being operated on might
still be enabled in global scope, and thus get started automatically even after a successful
disablement in user scope. In this case, a warning about it is shown, which can be suppressed
using <option>--no-warn</option>.</para>
<para>This command honors <option>--system</option>, <option>--user</option>, <option>--runtime</option>,
<option>--global</option> and <option>--no-warn</option> in a similar way as <command>enable</command>.</para>
<xi:include href="version-info.xml" xpointer="v238"/>