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