|
|
4fbe94 |
From a2e00522971897909db2a81b4daf10e5700f453e Mon Sep 17 00:00:00 2001
|
|
|
4fbe94 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
|
4fbe94 |
Date: Fri, 15 Mar 2019 10:13:55 +0100
|
|
|
4fbe94 |
Subject: [PATCH] man: reorder and add examples to systemd-analyze(1)
|
|
|
4fbe94 |
|
|
|
4fbe94 |
The number of verbs supported by systemd-analyze has grown quite a bit, and the
|
|
|
4fbe94 |
man page has become an unreadable wall of text. Let's put each verb in a
|
|
|
4fbe94 |
separate subsection, grouping similar verbs together, and add a lot of examples
|
|
|
4fbe94 |
to guide the user.
|
|
|
4fbe94 |
|
|
|
4fbe94 |
(cherry picked from commit d323a99001c1f7625e8ac902e18deb514a4ca18d)
|
|
|
4fbe94 |
|
|
|
4fbe94 |
Related: #1750343
|
|
|
4fbe94 |
---
|
|
|
4fbe94 |
man/systemd-analyze.xml | 678 +++++++++++++++++++++++++---------------
|
|
|
4fbe94 |
1 file changed, 429 insertions(+), 249 deletions(-)
|
|
|
4fbe94 |
|
|
|
4fbe94 |
diff --git a/man/systemd-analyze.xml b/man/systemd-analyze.xml
|
|
|
4fbe94 |
index f3b595880f..7c873cbdd1 100644
|
|
|
4fbe94 |
--- a/man/systemd-analyze.xml
|
|
|
4fbe94 |
+++ b/man/systemd-analyze.xml
|
|
|
4fbe94 |
@@ -41,46 +41,50 @@
|
|
|
4fbe94 |
<arg choice="plain">critical-chain</arg>
|
|
|
4fbe94 |
<arg choice="opt" rep="repeat"><replaceable>UNIT</replaceable></arg>
|
|
|
4fbe94 |
</cmdsynopsis>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
<cmdsynopsis>
|
|
|
4fbe94 |
<command>systemd-analyze</command>
|
|
|
4fbe94 |
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
|
|
4fbe94 |
- <arg choice="plain">plot</arg>
|
|
|
4fbe94 |
- <arg choice="opt">> file.svg</arg>
|
|
|
4fbe94 |
+ <arg choice="plain">log-level</arg>
|
|
|
4fbe94 |
+ <arg choice="opt"><replaceable>LEVEL</replaceable></arg>
|
|
|
4fbe94 |
</cmdsynopsis>
|
|
|
4fbe94 |
<cmdsynopsis>
|
|
|
4fbe94 |
<command>systemd-analyze</command>
|
|
|
4fbe94 |
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
|
|
4fbe94 |
- <arg choice="plain">dot</arg>
|
|
|
4fbe94 |
- <arg choice="opt" rep="repeat"><replaceable>PATTERN</replaceable></arg>
|
|
|
4fbe94 |
- <arg choice="opt">> file.dot</arg>
|
|
|
4fbe94 |
+ <arg choice="plain">log-target</arg>
|
|
|
4fbe94 |
+ <arg choice="opt"><replaceable>TARGET</replaceable></arg>
|
|
|
4fbe94 |
</cmdsynopsis>
|
|
|
4fbe94 |
<cmdsynopsis>
|
|
|
4fbe94 |
<command>systemd-analyze</command>
|
|
|
4fbe94 |
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
|
|
4fbe94 |
- <arg choice="plain">dump</arg>
|
|
|
4fbe94 |
+ <arg choice="plain">service-watchdogs</arg>
|
|
|
4fbe94 |
+ <arg choice="opt"><replaceable>BOOL</replaceable></arg>
|
|
|
4fbe94 |
</cmdsynopsis>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
<cmdsynopsis>
|
|
|
4fbe94 |
<command>systemd-analyze</command>
|
|
|
4fbe94 |
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
|
|
4fbe94 |
- <arg choice="plain">cat-config</arg>
|
|
|
4fbe94 |
- <arg choice="plain" rep="repeat"><replaceable>NAME</replaceable>|<replaceable>PATH</replaceable></arg>
|
|
|
4fbe94 |
+ <arg choice="plain">dump</arg>
|
|
|
4fbe94 |
</cmdsynopsis>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
<cmdsynopsis>
|
|
|
4fbe94 |
<command>systemd-analyze</command>
|
|
|
4fbe94 |
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
|
|
4fbe94 |
- <arg choice="plain">unit-paths</arg>
|
|
|
4fbe94 |
+ <arg choice="plain">plot</arg>
|
|
|
4fbe94 |
+ <arg choice="opt">>file.svg</arg>
|
|
|
4fbe94 |
</cmdsynopsis>
|
|
|
4fbe94 |
<cmdsynopsis>
|
|
|
4fbe94 |
<command>systemd-analyze</command>
|
|
|
4fbe94 |
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
|
|
4fbe94 |
- <arg choice="plain">log-level</arg>
|
|
|
4fbe94 |
- <arg choice="opt"><replaceable>LEVEL</replaceable></arg>
|
|
|
4fbe94 |
+ <arg choice="plain">dot</arg>
|
|
|
4fbe94 |
+ <arg choice="opt" rep="repeat"><replaceable>PATTERN</replaceable></arg>
|
|
|
4fbe94 |
+ <arg choice="opt">>file.dot</arg>
|
|
|
4fbe94 |
</cmdsynopsis>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
<cmdsynopsis>
|
|
|
4fbe94 |
<command>systemd-analyze</command>
|
|
|
4fbe94 |
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
|
|
4fbe94 |
- <arg choice="plain">log-target</arg>
|
|
|
4fbe94 |
- <arg choice="opt"><replaceable>TARGET</replaceable></arg>
|
|
|
4fbe94 |
+ <arg choice="plain">unit-paths</arg>
|
|
|
4fbe94 |
</cmdsynopsis>
|
|
|
4fbe94 |
<cmdsynopsis>
|
|
|
4fbe94 |
<command>systemd-analyze</command>
|
|
|
4fbe94 |
@@ -91,20 +95,20 @@
|
|
|
4fbe94 |
<cmdsynopsis>
|
|
|
4fbe94 |
<command>systemd-analyze</command>
|
|
|
4fbe94 |
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
|
|
4fbe94 |
- <arg choice="plain">verify</arg>
|
|
|
4fbe94 |
- <arg choice="opt" rep="repeat"><replaceable>FILES</replaceable></arg>
|
|
|
4fbe94 |
+ <arg choice="plain">calendar</arg>
|
|
|
4fbe94 |
+ <arg choice="plain" rep="repeat"><replaceable>SPECS</replaceable></arg>
|
|
|
4fbe94 |
</cmdsynopsis>
|
|
|
4fbe94 |
<cmdsynopsis>
|
|
|
4fbe94 |
<command>systemd-analyze</command>
|
|
|
4fbe94 |
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
|
|
4fbe94 |
- <arg choice="plain">calendar</arg>
|
|
|
4fbe94 |
- <arg choice="plain" rep="repeat"><replaceable>SPECS</replaceable></arg>
|
|
|
4fbe94 |
+ <arg choice="plain">timespan</arg>
|
|
|
4fbe94 |
+ <arg choice="plain" rep="repeat"><replaceable>SPAN</replaceable></arg>
|
|
|
4fbe94 |
</cmdsynopsis>
|
|
|
4fbe94 |
<cmdsynopsis>
|
|
|
4fbe94 |
<command>systemd-analyze</command>
|
|
|
4fbe94 |
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
|
|
4fbe94 |
- <arg choice="plain">service-watchdogs</arg>
|
|
|
4fbe94 |
- <arg choice="opt"><replaceable>BOOL</replaceable></arg>
|
|
|
4fbe94 |
+ <arg choice="plain">cat-config</arg>
|
|
|
4fbe94 |
+ <arg choice="plain" rep="repeat"><replaceable>NAME</replaceable>|<replaceable>PATH</replaceable></arg>
|
|
|
4fbe94 |
</cmdsynopsis>
|
|
|
4fbe94 |
<cmdsynopsis>
|
|
|
4fbe94 |
<command>systemd-analyze</command>
|
|
|
4fbe94 |
@@ -123,73 +127,299 @@
|
|
|
4fbe94 |
verify the correctness of unit files. It is also used to access
|
|
|
4fbe94 |
special functions useful for advanced system manager debugging.</para>
|
|
|
4fbe94 |
|
|
|
4fbe94 |
- <para><command>systemd-analyze time</command> prints the time
|
|
|
4fbe94 |
- spent in the kernel before userspace has been reached, the time
|
|
|
4fbe94 |
- spent in the initial RAM disk (initrd) before normal system
|
|
|
4fbe94 |
- userspace has been reached, and the time normal system userspace
|
|
|
4fbe94 |
- took to initialize. Note that these measurements simply measure
|
|
|
4fbe94 |
- the time passed up to the point where all system services have
|
|
|
4fbe94 |
- been spawned, but not necessarily until they fully finished
|
|
|
4fbe94 |
- initialization or the disk is idle.</para>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze blame</command> prints a list of
|
|
|
4fbe94 |
- all running units, ordered by the time they took to initialize.
|
|
|
4fbe94 |
- This information may be used to optimize boot-up times. Note that
|
|
|
4fbe94 |
- the output might be misleading as the initialization of one
|
|
|
4fbe94 |
- service might be slow simply because it waits for the
|
|
|
4fbe94 |
- initialization of another service to complete.
|
|
|
4fbe94 |
- Also note: <command>systemd-analyze blame</command> doesn't display
|
|
|
4fbe94 |
- results for services with <varname>Type=simple</varname>,
|
|
|
4fbe94 |
- because systemd considers such services to be started immediately,
|
|
|
4fbe94 |
- hence no measurement of the initialization delays can be done.</para>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze critical-chain
|
|
|
4fbe94 |
- [<replaceable>UNIT…</replaceable>]</command> prints a tree of
|
|
|
4fbe94 |
- the time-critical chain of units (for each of the specified
|
|
|
4fbe94 |
- <replaceable>UNIT</replaceable>s or for the default target
|
|
|
4fbe94 |
- otherwise). The time after the unit is active or started is
|
|
|
4fbe94 |
- printed after the "@" character. The time the unit takes to start
|
|
|
4fbe94 |
- is printed after the "+" character. Note that the output might be
|
|
|
4fbe94 |
- misleading as the initialization of one service might depend on
|
|
|
4fbe94 |
- socket activation and because of the parallel execution of
|
|
|
4fbe94 |
- units.</para>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze plot</command> prints an SVG
|
|
|
4fbe94 |
- graphic detailing which system services have been started at what
|
|
|
4fbe94 |
- time, highlighting the time they spent on initialization.</para>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze dot</command> generates textual
|
|
|
4fbe94 |
- dependency graph description in dot format for further processing
|
|
|
4fbe94 |
- with the GraphViz
|
|
|
4fbe94 |
- <citerefentry project='die-net'><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
|
|
|
4fbe94 |
- tool. Use a command line like <command>systemd-analyze dot | dot
|
|
|
4fbe94 |
- -Tsvg > systemd.svg</command> to generate a graphical dependency
|
|
|
4fbe94 |
- tree. Unless <option>--order</option> or
|
|
|
4fbe94 |
- <option>--require</option> is passed, the generated graph will
|
|
|
4fbe94 |
- show both ordering and requirement dependencies. Optional pattern
|
|
|
4fbe94 |
- globbing style specifications (e.g. <filename>*.target</filename>)
|
|
|
4fbe94 |
- may be given at the end. A unit dependency is included in the
|
|
|
4fbe94 |
- graph if any of these patterns match either the origin or
|
|
|
4fbe94 |
- destination node.</para>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze dump</command> outputs a (usually
|
|
|
4fbe94 |
- very long) human-readable serialization of the complete server
|
|
|
4fbe94 |
- state. Its format is subject to change without notice and should
|
|
|
4fbe94 |
- not be parsed by applications.</para>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze cat-config</command> is similar
|
|
|
4fbe94 |
- to <command>systemctl cat</command>, but operates on config files.
|
|
|
4fbe94 |
- It will copy the contents of a config file and any drop-ins to standard
|
|
|
4fbe94 |
- output, using the usual systemd set of directories and rules for
|
|
|
4fbe94 |
- precedence. Each argument must be either an absolute path including
|
|
|
4fbe94 |
- the prefix (such as <filename>/etc/systemd/logind.conf</filename> or
|
|
|
4fbe94 |
- <filename>/usr/lib/systemd/logind.conf</filename>), or a name
|
|
|
4fbe94 |
- relative to the prefix (such as <filename>systemd/logind.conf</filename>).
|
|
|
4fbe94 |
- </para>
|
|
|
4fbe94 |
+ <para>If no command is passed, <command>systemd-analyze
|
|
|
4fbe94 |
+ time</command> is implied.</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze time</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>This command prints the time spent in the kernel before userspace has been reached, the time
|
|
|
4fbe94 |
+ spent in the initial RAM disk (initrd) before normal system userspace has been reached, and the time
|
|
|
4fbe94 |
+ normal system userspace took to initialize. Note that these measurements simply measure the time passed
|
|
|
4fbe94 |
+ up to the point where all system services have been spawned, but not necessarily until they fully
|
|
|
4fbe94 |
+ finished initialization or the disk is idle.</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title><command>Show how long the boot took</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <programlisting># in a container
|
|
|
4fbe94 |
+$ systemd-analyze time
|
|
|
4fbe94 |
+Startup finished in 296ms (userspace)
|
|
|
4fbe94 |
+multi-user.target reached after 275ms in userspace
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+# on a real machine
|
|
|
4fbe94 |
+$ systemd-analyze time
|
|
|
4fbe94 |
+Startup finished in 2.584s (kernel) + 19.176s (initrd) + 47.847s (userspace) = 1min 9.608s
|
|
|
4fbe94 |
+multi-user.target reached after 47.820s in userspace
|
|
|
4fbe94 |
+</programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze blame</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>This command prints a list of all running units, ordered by the time they took to initialize.
|
|
|
4fbe94 |
+ This information may be used to optimize boot-up times. Note that the output might be misleading as the
|
|
|
4fbe94 |
+ initialization of one service might be slow simply because it waits for the initialization of another
|
|
|
4fbe94 |
+ service to complete. Also note: <command>systemd-analyze blame</command> doesn't display results for
|
|
|
4fbe94 |
+ services with <varname>Type=simple</varname>, because systemd considers such services to be started
|
|
|
4fbe94 |
+ immediately, hence no measurement of the initialization delays can be done.</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title><command>Show which units took the most time during boot</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <programlisting>$ systemd-analyze blame
|
|
|
4fbe94 |
+ 32.875s pmlogger.service
|
|
|
4fbe94 |
+ 20.905s systemd-networkd-wait-online.service
|
|
|
4fbe94 |
+ 13.299s dev-vda1.device
|
|
|
4fbe94 |
+ ...
|
|
|
4fbe94 |
+ 23ms sysroot.mount
|
|
|
4fbe94 |
+ 11ms initrd-udevadm-cleanup-db.service
|
|
|
4fbe94 |
+ 3ms sys-kernel-config.mount
|
|
|
4fbe94 |
+ </programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze critical-chain <optional><replaceable>UNIT</replaceable>...</optional></command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>This command prints a tree of the time-critical chain of units (for each of the specified
|
|
|
4fbe94 |
+ <replaceable>UNIT</replaceable>s or for the default target otherwise). The time after the unit is
|
|
|
4fbe94 |
+ active or started is printed after the "@" character. The time the unit takes to start is printed after
|
|
|
4fbe94 |
+ the "+" character. Note that the output might be misleading as the initialization of services might
|
|
|
4fbe94 |
+ depend on socket activation and because of the parallel execution of units.</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze time</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <programlisting>$ systemd-analyze critical-chain
|
|
|
4fbe94 |
+multi-user.target @47.820s
|
|
|
4fbe94 |
+└─pmie.service @35.968s +548ms
|
|
|
4fbe94 |
+ └─pmcd.service @33.715s +2.247s
|
|
|
4fbe94 |
+ └─network-online.target @33.712s
|
|
|
4fbe94 |
+ └─systemd-networkd-wait-online.service @12.804s +20.905s
|
|
|
4fbe94 |
+ └─systemd-networkd.service @11.109s +1.690s
|
|
|
4fbe94 |
+ └─systemd-udevd.service @9.201s +1.904s
|
|
|
4fbe94 |
+ └─systemd-tmpfiles-setup-dev.service @7.306s +1.776s
|
|
|
4fbe94 |
+ └─kmod-static-nodes.service @6.976s +177ms
|
|
|
4fbe94 |
+ └─systemd-journald.socket
|
|
|
4fbe94 |
+ └─system.slice
|
|
|
4fbe94 |
+ └─-.slice
|
|
|
4fbe94 |
+</programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze log-level [<replaceable>LEVEL</replaceable>]</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para><command>systemd-analyze log-level</command> prints the current log level of the
|
|
|
4fbe94 |
+ <command>systemd</command> daemon. If an optional argument <replaceable>LEVEL</replaceable> is
|
|
|
4fbe94 |
+ provided, then the command changes the current log level of the <command>systemd</command> daemon to
|
|
|
4fbe94 |
+ <replaceable>LEVEL</replaceable> (accepts the same values as <option>--log-level=</option> described in
|
|
|
4fbe94 |
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).</para>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze log-target [<replaceable>TARGET</replaceable>]</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para><command>systemd-analyze log-target</command> prints the current log target of the
|
|
|
4fbe94 |
+ <command>systemd</command> daemon. If an optional argument <replaceable>TARGET</replaceable> is
|
|
|
4fbe94 |
+ provided, then the command changes the current log target of the <command>systemd</command> daemon to
|
|
|
4fbe94 |
+ <replaceable>TARGET</replaceable> (accepts the same values as <option>--log-target=</option>, described
|
|
|
4fbe94 |
+ in <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).</para>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze service-watchdogs [yes|no]</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para><command>systemd-analyze service-watchdogs</command> prints the current state of service runtime
|
|
|
4fbe94 |
+ watchdogs of the <command>systemd</command> daemon. If an optional boolean argument is provided, then
|
|
|
4fbe94 |
+ globally enables or disables the service runtime watchdogs (<option>WatchdogSec=</option>) and
|
|
|
4fbe94 |
+ emergency actions (e.g. <option>OnFailure=</option> or <option>StartLimitAction=</option>); see
|
|
|
4fbe94 |
+ <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
|
|
|
4fbe94 |
+ The hardware watchdog is not affected by this setting.</para>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze dump</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>This command outputs a (usually very long) human-readable serialization of the complete server
|
|
|
4fbe94 |
+ state. Its format is subject to change without notice and should not be parsed by applications.</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title>Show the internal state of user manager</title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <programlisting>$ systemd-analyze --user dump
|
|
|
4fbe94 |
+Timestamp userspace: Thu 2019-03-14 23:28:07 CET
|
|
|
4fbe94 |
+Timestamp finish: Thu 2019-03-14 23:28:07 CET
|
|
|
4fbe94 |
+Timestamp generators-start: Thu 2019-03-14 23:28:07 CET
|
|
|
4fbe94 |
+Timestamp generators-finish: Thu 2019-03-14 23:28:07 CET
|
|
|
4fbe94 |
+Timestamp units-load-start: Thu 2019-03-14 23:28:07 CET
|
|
|
4fbe94 |
+Timestamp units-load-finish: Thu 2019-03-14 23:28:07 CET
|
|
|
4fbe94 |
+-> Unit proc-timer_list.mount:
|
|
|
4fbe94 |
+ Description: /proc/timer_list
|
|
|
4fbe94 |
+ ...
|
|
|
4fbe94 |
+-> Unit default.target:
|
|
|
4fbe94 |
+ Description: Main user target
|
|
|
4fbe94 |
+...
|
|
|
4fbe94 |
+</programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze plot</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>This command prints an SVG graphic detailing which system services have been started at what
|
|
|
4fbe94 |
+ time, highlighting the time they spent on initialization.</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title><command>Plot a bootchart</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <programlisting>$ systemd-analyze plot >bootup.svg
|
|
|
4fbe94 |
+$ eog bootup.svg&
|
|
|
4fbe94 |
+</programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze dot [<replaceable>pattern</replaceable>...]</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>This command generates textual dependency graph description in dot format for further processing
|
|
|
4fbe94 |
+ with the GraphViz
|
|
|
4fbe94 |
+ <citerefentry project='die-net'><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
|
|
|
4fbe94 |
+ tool. Use a command line like <command>systemd-analyze dot | dot -Tsvg >systemd.svg</command> to
|
|
|
4fbe94 |
+ generate a graphical dependency tree. Unless <option>--order</option> or <option>--require</option> is
|
|
|
4fbe94 |
+ passed, the generated graph will show both ordering and requirement dependencies. Optional pattern
|
|
|
4fbe94 |
+ globbing style specifications (e.g. <filename>*.target</filename>) may be given at the end. A unit
|
|
|
4fbe94 |
+ dependency is included in the graph if any of these patterns match either the origin or destination
|
|
|
4fbe94 |
+ node.</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title>Plot all dependencies of any unit whose name starts with <literal>avahi-daemon</literal>
|
|
|
4fbe94 |
+ </title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <programlisting>$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg >avahi.svg
|
|
|
4fbe94 |
+$ eog avahi.svg</programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title>Plot the dependencies between all known target units</title>
|
|
|
4fbe94 |
|
|
|
4fbe94 |
- <example>
|
|
|
4fbe94 |
- <title>Showing logind configuration</title>
|
|
|
4fbe94 |
- <programlisting>$ systemd-analyze cat-config systemd/logind.conf
|
|
|
4fbe94 |
+ <programlisting>$ systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' \
|
|
|
4fbe94 |
+ | dot -Tsvg >targets.svg
|
|
|
4fbe94 |
+$ eog targets.svg</programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze unit-paths</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>This command outputs a list of all directories from which unit files, <filename>.d</filename>
|
|
|
4fbe94 |
+ overrides, and <filename>.wants</filename>, <filename>.requires</filename> symlinks may be
|
|
|
4fbe94 |
+ loaded. Combine with <option>--user</option> to retrieve the list for the user manager instance, and
|
|
|
4fbe94 |
+ <option>--global</option> for the global configuration of user manager instances.</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title><command>Show all paths for generated units</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <programlisting>$ systemd-analyze unit-paths | grep '^/run'
|
|
|
4fbe94 |
+/run/systemd/system.control
|
|
|
4fbe94 |
+/run/systemd/transient
|
|
|
4fbe94 |
+/run/systemd/generator.early
|
|
|
4fbe94 |
+/run/systemd/system
|
|
|
4fbe94 |
+/run/systemd/system.attached
|
|
|
4fbe94 |
+/run/systemd/generator
|
|
|
4fbe94 |
+/run/systemd/generator.late
|
|
|
4fbe94 |
+</programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>Note that this verb prints the list that is compiled into <command>systemd-analyze</command>
|
|
|
4fbe94 |
+ itself, and does not comunicate with the running manager. Use
|
|
|
4fbe94 |
+ <programlisting>systemctl [--user] [--global] show -p UnitPath --value</programlisting>
|
|
|
4fbe94 |
+ to retrieve the actual list that the manager uses, with any empty directories omitted.</para>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze syscall-filter <optional><replaceable>SET</replaceable>...</optional></command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>This command will list system calls contained in the specified system call set
|
|
|
4fbe94 |
+ <replaceable>SET</replaceable>, or all known sets if no sets are specified. Argument
|
|
|
4fbe94 |
+ <replaceable>SET</replaceable> must include the <literal>@</literal> prefix.</para>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze calendar <replaceable>EXPRESSION</replaceable>...</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>This command will parse and normalize repetitive calendar time events, and will calculate when
|
|
|
4fbe94 |
+ they elapse next. This takes the same input as the <varname>OnCalendar=</varname> setting in
|
|
|
4fbe94 |
+ <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
|
|
|
4fbe94 |
+ following the syntax described in
|
|
|
4fbe94 |
+ <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>. By
|
|
|
4fbe94 |
+ default, only the next time the calendar expression will elapse is shown; use
|
|
|
4fbe94 |
+ <option>--iterations=</option> to show the specified number of next times the expression
|
|
|
4fbe94 |
+ elapses.</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title>Show leap days in the near future</title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <programlisting>$ systemd-analyze calendar --iterations=5 '*-2-29 0:0:0'
|
|
|
4fbe94 |
+ Original form: *-2-29 0:0:0
|
|
|
4fbe94 |
+Normalized form: *-02-29 00:00:00
|
|
|
4fbe94 |
+ Next elapse: Sat 2020-02-29 00:00:00 UTC
|
|
|
4fbe94 |
+ From now: 11 months 15 days left
|
|
|
4fbe94 |
+ Iter. #2: Thu 2024-02-29 00:00:00 UTC
|
|
|
4fbe94 |
+ From now: 4 years 11 months left
|
|
|
4fbe94 |
+ Iter. #3: Tue 2028-02-29 00:00:00 UTC
|
|
|
4fbe94 |
+ From now: 8 years 11 months left
|
|
|
4fbe94 |
+ Iter. #4: Sun 2032-02-29 00:00:00 UTC
|
|
|
4fbe94 |
+ From now: 12 years 11 months left
|
|
|
4fbe94 |
+ Iter. #5: Fri 2036-02-29 00:00:00 UTC
|
|
|
4fbe94 |
+ From now: 16 years 11 months left
|
|
|
4fbe94 |
+</programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze timespan <replaceable>EXPRESSION</replaceable>...</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>This command parses a time span and outputs the normalized form and the equivalent value in
|
|
|
4fbe94 |
+ microseconds. The time span should adhere to the same syntax documented in
|
|
|
4fbe94 |
+ <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
|
|
|
4fbe94 |
+ Values without associated magnitudes are parsed as seconds.</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title>Show parsing of timespans</title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <programlisting>$ systemd-analyze timespan 1s 300s '1year 0.000001s'
|
|
|
4fbe94 |
+Original: 1s
|
|
|
4fbe94 |
+ μs: 1000000
|
|
|
4fbe94 |
+ Human: 1s
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+Original: 300s
|
|
|
4fbe94 |
+ μs: 300000000
|
|
|
4fbe94 |
+ Human: 5min
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+Original: 1year 0.000001s
|
|
|
4fbe94 |
+ μs: 31557600000001
|
|
|
4fbe94 |
+ Human: 1y 1us
|
|
|
4fbe94 |
+</programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze cat-config</command>
|
|
|
4fbe94 |
+ <replaceable>NAME</replaceable>|<replaceable>PATH</replaceable>...</title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>This command is similar to <command>systemctl cat</command>, but operates on config files. It
|
|
|
4fbe94 |
+ will copy the contents of a config file and any drop-ins to standard output, using the usual systemd
|
|
|
4fbe94 |
+ set of directories and rules for precedence. Each argument must be either an absolute path including
|
|
|
4fbe94 |
+ the prefix (such as <filename>/etc/systemd/logind.conf</filename> or
|
|
|
4fbe94 |
+ <filename>/usr/lib/systemd/logind.conf</filename>), or a name relative to the prefix (such as
|
|
|
4fbe94 |
+ <filename>systemd/logind.conf</filename>).</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title>Showing logind configuration</title>
|
|
|
4fbe94 |
+ <programlisting>$ systemd-analyze cat-config systemd/logind.conf
|
|
|
4fbe94 |
# /etc/systemd/logind.conf
|
|
|
4fbe94 |
...
|
|
|
4fbe94 |
[Login]
|
|
|
4fbe94 |
@@ -201,90 +431,122 @@ NAutoVTs=8
|
|
|
4fbe94 |
|
|
|
4fbe94 |
# /etc/systemd/logind.conf.d/50-override.conf
|
|
|
4fbe94 |
... some administrator override
|
|
|
4fbe94 |
- </programlisting>
|
|
|
4fbe94 |
- </example>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze unit-paths</command> outputs a list of all
|
|
|
4fbe94 |
- directories from which unit files, <filename>.d</filename> overrides, and
|
|
|
4fbe94 |
- <filename>.wants</filename>, <filename>.requires</filename> symlinks may be
|
|
|
4fbe94 |
- loaded. Combine with <option>--user</option> to retrieve the list for the user
|
|
|
4fbe94 |
- manager instance, and <option>--global</option> for the global configuration of
|
|
|
4fbe94 |
- user manager instances. Note that this verb prints the list that is compiled into
|
|
|
4fbe94 |
- <command>systemd-analyze</command> itself, and does not comunicate with the
|
|
|
4fbe94 |
- running manager. Use
|
|
|
4fbe94 |
- <programlisting>systemctl [--user] [--global] show -p UnitPath --value</programlisting>
|
|
|
4fbe94 |
- to retrieve the actual list that the manager uses, with any empty directories
|
|
|
4fbe94 |
- omitted.</para>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze log-level</command>
|
|
|
4fbe94 |
- prints the current log level of the <command>systemd</command> daemon.
|
|
|
4fbe94 |
- If an optional argument <replaceable>LEVEL</replaceable> is provided, then the command changes the current log
|
|
|
4fbe94 |
- level of the <command>systemd</command> daemon to <replaceable>LEVEL</replaceable> (accepts the same values as
|
|
|
4fbe94 |
- <option>--log-level=</option> described in
|
|
|
4fbe94 |
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).</para>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze log-target</command>
|
|
|
4fbe94 |
- prints the current log target of the <command>systemd</command> daemon.
|
|
|
4fbe94 |
- If an optional argument <replaceable>TARGET</replaceable> is provided, then the command changes the current log
|
|
|
4fbe94 |
- target of the <command>systemd</command> daemon to <replaceable>TARGET</replaceable> (accepts the same values as
|
|
|
4fbe94 |
- <option>--log-target=</option>, described in
|
|
|
4fbe94 |
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).</para>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze syscall-filter <optional><replaceable>SET</replaceable>…</optional></command>
|
|
|
4fbe94 |
- will list system calls contained in the specified system call set <replaceable>SET</replaceable>,
|
|
|
4fbe94 |
- or all known sets if no sets are specified. Argument <replaceable>SET</replaceable> must include
|
|
|
4fbe94 |
- the <literal>@</literal> prefix.</para>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze verify</command> will load unit files and print
|
|
|
4fbe94 |
- warnings if any errors are detected. Files specified on the command line will be
|
|
|
4fbe94 |
- loaded, but also any other units referenced by them. The full unit search path is
|
|
|
4fbe94 |
- formed by combining the directories for all command line arguments, and the usual unit
|
|
|
4fbe94 |
- load paths (variable <varname>$SYSTEMD_UNIT_PATH</varname> is supported, and may be
|
|
|
4fbe94 |
- used to replace or augment the compiled in set of unit load paths; see
|
|
|
4fbe94 |
- <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
|
|
|
4fbe94 |
- All units files present in the directories containing the command line arguments will
|
|
|
4fbe94 |
- be used in preference to the other paths.</para>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze calendar</command> will parse and normalize repetitive calendar time events, and
|
|
|
4fbe94 |
- will calculate when they will elapse next. This takes the same input as the <varname>OnCalendar=</varname> setting
|
|
|
4fbe94 |
- in <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>, following the
|
|
|
4fbe94 |
- syntax described in
|
|
|
4fbe94 |
- <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze service-watchdogs</command>
|
|
|
4fbe94 |
- prints the current state of service runtime watchdogs of the <command>systemd</command> daemon.
|
|
|
4fbe94 |
- If an optional boolean argument is provided, then globally enables or disables the service
|
|
|
4fbe94 |
- runtime watchdogs (<option>WatchdogSec=</option>) and emergency actions (e.g.
|
|
|
4fbe94 |
- <option>OnFailure=</option> or <option>StartLimitAction=</option>); see
|
|
|
4fbe94 |
- <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
|
|
|
4fbe94 |
- The hardware watchdog is not affected by this setting.</para>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para><command>systemd-analyze security</command> analyzes the security and sandboxing settings of one or more
|
|
|
4fbe94 |
- specified service units. If at least one unit name is specified the security settings of the specified service
|
|
|
4fbe94 |
- units are inspected and a detailed analysis is shown. If no unit name is specified, all currently loaded,
|
|
|
4fbe94 |
- long-running service units are inspected and a terse table with results shown. The command checks for various
|
|
|
4fbe94 |
- security-related service settings, assigning each a numeric "exposure level" value, depending on how important a
|
|
|
4fbe94 |
- setting is. It then calculates an overall exposure level for the whole unit, which is an estimation in the range
|
|
|
4fbe94 |
- 0.0…10.0 indicating how exposed a service is security-wise. High exposure levels indicate very little applied
|
|
|
4fbe94 |
- sandboxing. Low exposure levels indicate tight sandboxing and strongest security restrictions. Note that this only
|
|
|
4fbe94 |
- analyzes the per-service security features systemd itself implements. This means that any additional security
|
|
|
4fbe94 |
- mechanisms applied by the service code itself are not accounted for. The exposure level determined this way should
|
|
|
4fbe94 |
- not be misunderstood: a high exposure level neither means that there is no effective sandboxing applied by the
|
|
|
4fbe94 |
- service code itself, nor that the service is actually vulnerable to remote or local attacks. High exposure levels
|
|
|
4fbe94 |
- do indicate however that most likely the service might benefit from additional settings applied to them. Please
|
|
|
4fbe94 |
- note that many of the security and sandboxing settings individually can be circumvented — unless combined with
|
|
|
4fbe94 |
- others. For example, if a service retains the privilege to establish or undo mount points many of the sandboxing
|
|
|
4fbe94 |
- options can be undone by the service code itself. Due to that is essential that each service uses the most
|
|
|
4fbe94 |
- comprehensive and strict sandboxing and security settings possible. The tool will take into account some of these
|
|
|
4fbe94 |
- combinations and relationships between the settings, but not all. Also note that the security and sandboxing
|
|
|
4fbe94 |
- settings analyzed here only apply to the operations executed by the service code itself. If a service has access to
|
|
|
4fbe94 |
- an IPC system (such as D-Bus) it might request operations from other services that are not subject to the same
|
|
|
4fbe94 |
- restrictions. Any comprehensive security and sandboxing analysis is hence incomplete if the IPC access policy is
|
|
|
4fbe94 |
- not validated too.</para>
|
|
|
4fbe94 |
+ </programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
|
|
|
4fbe94 |
- <para>If no command is passed, <command>systemd-analyze
|
|
|
4fbe94 |
- time</command> is implied.</para>
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze verify <replaceable>FILE</replaceable>...</command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>This command will load unit files and print warnings if any errors are detected. Files specified
|
|
|
4fbe94 |
+ on the command line will be loaded, but also any other units referenced by them. The full unit search
|
|
|
4fbe94 |
+ path is formed by combining the directories for all command line arguments, and the usual unit load
|
|
|
4fbe94 |
+ paths (variable <varname>$SYSTEMD_UNIT_PATH</varname> is supported, and may be used to replace or
|
|
|
4fbe94 |
+ augment the compiled in set of unit load paths; see
|
|
|
4fbe94 |
+ <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>). All
|
|
|
4fbe94 |
+ units files present in the directories containing the command line arguments will be used in preference
|
|
|
4fbe94 |
+ to the other paths.</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>The following errors are currently detected:</para>
|
|
|
4fbe94 |
+ <itemizedlist>
|
|
|
4fbe94 |
+ <listitem><para>unknown sections and directives,</para></listitem>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <listitem><para>missing dependencies which are required to start the given unit,</para></listitem>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <listitem><para>man pages listed in <varname>Documentation=</varname> which are not found in the
|
|
|
4fbe94 |
+ system,</para></listitem>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <listitem><para>commands listed in <varname>ExecStart=</varname> and similar which are not found in
|
|
|
4fbe94 |
+ the system or not executable.</para></listitem>
|
|
|
4fbe94 |
+ </itemizedlist>
|
|
|
4fbe94 |
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title>Misspelt directives</title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <programlisting>$ cat ./user.slice
|
|
|
4fbe94 |
+[Unit]
|
|
|
4fbe94 |
+WhatIsThis=11
|
|
|
4fbe94 |
+Documentation=man:nosuchfile(1)
|
|
|
4fbe94 |
+Requires=different.service
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+[Service]
|
|
|
4fbe94 |
+Description=x
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+$ systemd-analyze verify ./user.slice
|
|
|
4fbe94 |
+[./user.slice:9] Unknown lvalue 'WhatIsThis' in section 'Unit'
|
|
|
4fbe94 |
+[./user.slice:13] Unknown section 'Service'. Ignoring.
|
|
|
4fbe94 |
+Error: org.freedesktop.systemd1.LoadFailed:
|
|
|
4fbe94 |
+ Unit different.service failed to load:
|
|
|
4fbe94 |
+ No such file or directory.
|
|
|
4fbe94 |
+Failed to create user.slice/start: Invalid argument
|
|
|
4fbe94 |
+user.slice: man nosuchfile(1) command failed with code 16
|
|
|
4fbe94 |
+ </programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title>Missing service units</title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <programlisting>$ tail ./a.socket ./b.socket
|
|
|
4fbe94 |
+==> ./a.socket <==
|
|
|
4fbe94 |
+[Socket]
|
|
|
4fbe94 |
+ListenStream=100
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+==> ./b.socket <==
|
|
|
4fbe94 |
+[Socket]
|
|
|
4fbe94 |
+ListenStream=100
|
|
|
4fbe94 |
+Accept=yes
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+$ systemd-analyze verify ./a.socket ./b.socket
|
|
|
4fbe94 |
+Service a.service not loaded, a.socket cannot be started.
|
|
|
4fbe94 |
+Service b@0.service not loaded, b.socket cannot be started.
|
|
|
4fbe94 |
+ </programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <refsect2>
|
|
|
4fbe94 |
+ <title><command>systemd-analyze security <optional><replaceable>UNIT</replaceable>...</optional></command></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>This command analyzes the security and sandboxing settings of one or more specified service
|
|
|
4fbe94 |
+ units. If at least one unit name is specified the security settings of the specified service units are
|
|
|
4fbe94 |
+ inspected and a detailed analysis is shown. If no unit name is specified, all currently loaded,
|
|
|
4fbe94 |
+ long-running service units are inspected and a terse table with results shown. The command checks for
|
|
|
4fbe94 |
+ various security-related service settings, assigning each a numeric "exposure level" value, depending
|
|
|
4fbe94 |
+ on how important a setting is. It then calculates an overall exposure level for the whole unit, which
|
|
|
4fbe94 |
+ is an estimation in the range 0.0…10.0 indicating how exposed a service is security-wise. High exposure
|
|
|
4fbe94 |
+ levels indicate very little applied sandboxing. Low exposure levels indicate tight sandboxing and
|
|
|
4fbe94 |
+ strongest security restrictions. Note that this only analyzes the per-service security features systemd
|
|
|
4fbe94 |
+ itself implements. This means that any additional security mechanisms applied by the service code
|
|
|
4fbe94 |
+ itself are not accounted for. The exposure level determined this way should not be misunderstood: a
|
|
|
4fbe94 |
+ high exposure level neither means that there is no effective sandboxing applied by the service code
|
|
|
4fbe94 |
+ itself, nor that the service is actually vulnerable to remote or local attacks. High exposure levels do
|
|
|
4fbe94 |
+ indicate however that most likely the service might benefit from additional settings applied to
|
|
|
4fbe94 |
+ them.</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <para>Please note that many of the security and sandboxing settings individually can be circumvented —
|
|
|
4fbe94 |
+ unless combined with others. For example, if a service retains the privilege to establish or undo mount
|
|
|
4fbe94 |
+ points many of the sandboxing options can be undone by the service code itself. Due to that is
|
|
|
4fbe94 |
+ essential that each service uses the most comprehensive and strict sandboxing and security settings
|
|
|
4fbe94 |
+ possible. The tool will take into account some of these combinations and relationships between the
|
|
|
4fbe94 |
+ settings, but not all. Also note that the security and sandboxing settings analyzed here only apply to
|
|
|
4fbe94 |
+ the operations executed by the service code itself. If a service has access to an IPC system (such as
|
|
|
4fbe94 |
+ D-Bus) it might request operations from other services that are not subject to the same
|
|
|
4fbe94 |
+ restrictions. Any comprehensive security and sandboxing analysis is hence incomplete if the IPC access
|
|
|
4fbe94 |
+ policy is not validated too.</para>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <example>
|
|
|
4fbe94 |
+ <title>Analyze <filename noindex="true">systemd-logind.service</filename></title>
|
|
|
4fbe94 |
+
|
|
|
4fbe94 |
+ <programlisting>$ systemd-analyze security --no-pager systemd-logind.service
|
|
|
4fbe94 |
+ NAME DESCRIPTION EXPOSURE
|
|
|
4fbe94 |
+✗ PrivateNetwork= Service has access to the host's network 0.5
|
|
|
4fbe94 |
+✗ User=/DynamicUser= Service runs as root user 0.4
|
|
|
4fbe94 |
+✗ DeviceAllow= Service has no device ACL 0.2
|
|
|
4fbe94 |
+✓ IPAddressDeny= Service blocks all IP address ranges
|
|
|
4fbe94 |
+...
|
|
|
4fbe94 |
+→ Overall exposure level for systemd-logind.service: 4.1 OK 🙂
|
|
|
4fbe94 |
+</programlisting>
|
|
|
4fbe94 |
+ </example>
|
|
|
4fbe94 |
+ </refsect2>
|
|
|
4fbe94 |
</refsect1>
|
|
|
4fbe94 |
|
|
|
4fbe94 |
<refsect1>
|
|
|
4fbe94 |
@@ -408,88 +670,6 @@ NAutoVTs=8
|
|
|
4fbe94 |
otherwise.</para>
|
|
|
4fbe94 |
</refsect1>
|
|
|
4fbe94 |
|
|
|
4fbe94 |
- <refsect1>
|
|
|
4fbe94 |
- <title>Examples for <command>dot</command></title>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <example>
|
|
|
4fbe94 |
- <title>Plots all dependencies of any unit whose name starts with
|
|
|
4fbe94 |
- <literal>avahi-daemon</literal></title>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <programlisting>$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg > avahi.svg
|
|
|
4fbe94 |
-$ eog avahi.svg</programlisting>
|
|
|
4fbe94 |
- </example>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <example>
|
|
|
4fbe94 |
- <title>Plots the dependencies between all known target units</title>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <programlisting>$ systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' | dot -Tsvg > targets.svg
|
|
|
4fbe94 |
-$ eog targets.svg</programlisting>
|
|
|
4fbe94 |
- </example>
|
|
|
4fbe94 |
- </refsect1>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <refsect1>
|
|
|
4fbe94 |
- <title>Examples for <command>verify</command></title>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <para>The following errors are currently detected:</para>
|
|
|
4fbe94 |
- <itemizedlist>
|
|
|
4fbe94 |
- <listitem><para>unknown sections and directives,
|
|
|
4fbe94 |
- </para></listitem>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <listitem><para>missing dependencies which are required to start
|
|
|
4fbe94 |
- the given unit,</para></listitem>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <listitem><para>man pages listed in
|
|
|
4fbe94 |
- <varname>Documentation=</varname> which are not found in the
|
|
|
4fbe94 |
- system,</para></listitem>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <listitem><para>commands listed in <varname>ExecStart=</varname>
|
|
|
4fbe94 |
- and similar which are not found in the system or not
|
|
|
4fbe94 |
- executable.</para></listitem>
|
|
|
4fbe94 |
- </itemizedlist>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <example>
|
|
|
4fbe94 |
- <title>Misspelt directives</title>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <programlisting>$ cat ./user.slice
|
|
|
4fbe94 |
-[Unit]
|
|
|
4fbe94 |
-WhatIsThis=11
|
|
|
4fbe94 |
-Documentation=man:nosuchfile(1)
|
|
|
4fbe94 |
-Requires=different.service
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
-[Service]
|
|
|
4fbe94 |
-Description=x
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
-$ systemd-analyze verify ./user.slice
|
|
|
4fbe94 |
-[./user.slice:9] Unknown lvalue 'WhatIsThis' in section 'Unit'
|
|
|
4fbe94 |
-[./user.slice:13] Unknown section 'Service'. Ignoring.
|
|
|
4fbe94 |
-Error: org.freedesktop.systemd1.LoadFailed:
|
|
|
4fbe94 |
- Unit different.service failed to load:
|
|
|
4fbe94 |
- No such file or directory.
|
|
|
4fbe94 |
-Failed to create user.slice/start: Invalid argument
|
|
|
4fbe94 |
-user.slice: man nosuchfile(1) command failed with code 16
|
|
|
4fbe94 |
- </programlisting>
|
|
|
4fbe94 |
- </example>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <example>
|
|
|
4fbe94 |
- <title>Missing service units</title>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
- <programlisting>$ tail ./a.socket ./b.socket
|
|
|
4fbe94 |
-==> ./a.socket <==
|
|
|
4fbe94 |
-[Socket]
|
|
|
4fbe94 |
-ListenStream=100
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
-==> ./b.socket <==
|
|
|
4fbe94 |
-[Socket]
|
|
|
4fbe94 |
-ListenStream=100
|
|
|
4fbe94 |
-Accept=yes
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
-$ systemd-analyze verify ./a.socket ./b.socket
|
|
|
4fbe94 |
-Service a.service not loaded, a.socket cannot be started.
|
|
|
4fbe94 |
-Service b@0.service not loaded, b.socket cannot be started.
|
|
|
4fbe94 |
- </programlisting>
|
|
|
4fbe94 |
- </example>
|
|
|
4fbe94 |
- </refsect1>
|
|
|
4fbe94 |
-
|
|
|
4fbe94 |
<xi:include href="less-variables.xml" />
|
|
|
4fbe94 |
|
|
|
4fbe94 |
<refsect1>
|