]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-analyze.xml
analyze: add 'cat-config' verb
[thirdparty/systemd.git] / man / systemd-analyze.xml
CommitLineData
359deb60
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
359deb60
LP
4
5<!--
572eb058
ZJS
6 SPDX-License-Identifier: LGPL-2.1+
7
359deb60
LP
8 This file is part of systemd.
9
10 Copyright 2012 Lennart Poettering
359deb60
LP
11-->
12
21ac6ff1 13<refentry id="systemd-analyze"
798d3a52
ZJS
14 xmlns:xi="http://www.w3.org/2001/XInclude">
15
16 <refentryinfo>
17 <title>systemd-analyze</title>
18 <productname>systemd</productname>
19
20 <authorgroup>
21 <author>
22 <contrib>Developer</contrib>
23 <firstname>Lennart</firstname>
24 <surname>Poettering</surname>
25 <email>lennart@poettering.net</email>
26 </author>
27 <author>
28 <contrib>Developer</contrib>
29 <firstname>Harald</firstname>
30 <surname>Hoyer</surname>
31 <email>harald@redhat.com</email>
32 </author>
33 </authorgroup>
34 </refentryinfo>
35
36 <refmeta>
37 <refentrytitle>systemd-analyze</refentrytitle>
38 <manvolnum>1</manvolnum>
39 </refmeta>
40
41 <refnamediv>
42 <refname>systemd-analyze</refname>
889d695d 43 <refpurpose>Analyze and debug system manager</refpurpose>
798d3a52
ZJS
44 </refnamediv>
45
46 <refsynopsisdiv>
47 <cmdsynopsis>
48 <command>systemd-analyze</command>
49 <arg choice="opt" rep="repeat">OPTIONS</arg>
50 <arg>time</arg>
51 </cmdsynopsis>
52 <cmdsynopsis>
53 <command>systemd-analyze</command>
54 <arg choice="opt" rep="repeat">OPTIONS</arg>
55 <arg choice="plain">blame</arg>
56 </cmdsynopsis>
57 <cmdsynopsis>
58 <command>systemd-analyze</command>
59 <arg choice="opt" rep="repeat">OPTIONS</arg>
60 <arg choice="plain">critical-chain</arg>
61 <arg choice="opt" rep="repeat"><replaceable>UNIT</replaceable></arg>
62 </cmdsynopsis>
63 <cmdsynopsis>
64 <command>systemd-analyze</command>
65 <arg choice="opt" rep="repeat">OPTIONS</arg>
66 <arg choice="plain">plot</arg>
67 <arg choice="opt">&gt; file.svg</arg>
68 </cmdsynopsis>
69 <cmdsynopsis>
70 <command>systemd-analyze</command>
71 <arg choice="opt" rep="repeat">OPTIONS</arg>
72 <arg choice="plain">dot</arg>
73 <arg choice="opt" rep="repeat"><replaceable>PATTERN</replaceable></arg>
74 <arg choice="opt">&gt; file.dot</arg>
75 </cmdsynopsis>
76 <cmdsynopsis>
77 <command>systemd-analyze</command>
78 <arg choice="opt" rep="repeat">OPTIONS</arg>
79 <arg choice="plain">dump</arg>
80 </cmdsynopsis>
854a42fb
ZJS
81 <cmdsynopsis>
82 <command>systemd-analyze</command>
83 <arg choice="opt" rep="repeat">OPTIONS</arg>
84 <arg choice="plain">cat-config</arg>
85 <arg choice="plain" rep="repeat"><replaceable>NAME</replaceable></arg>
86 </cmdsynopsis>
31a5924e
ZJS
87 <cmdsynopsis>
88 <command>systemd-analyze</command>
89 <arg choice="opt" rep="repeat">OPTIONS</arg>
90 <arg choice="plain">unit-paths</arg>
91 </cmdsynopsis>
798d3a52
ZJS
92 <cmdsynopsis>
93 <command>systemd-analyze</command>
94 <arg choice="opt" rep="repeat">OPTIONS</arg>
90657286
YW
95 <arg choice="plain">log-level</arg>
96 <arg choice="opt"><replaceable>LEVEL</replaceable></arg>
798d3a52 97 </cmdsynopsis>
213cf5b1
LP
98 <cmdsynopsis>
99 <command>systemd-analyze</command>
100 <arg choice="opt" rep="repeat">OPTIONS</arg>
90657286
YW
101 <arg choice="plain">log-target</arg>
102 <arg choice="opt"><replaceable>TARGET</replaceable></arg>
ef5a8cb1 103 </cmdsynopsis>
869feb33
ZJS
104 <cmdsynopsis>
105 <command>systemd-analyze</command>
106 <arg choice="opt" rep="repeat">OPTIONS</arg>
107 <arg choice="plain">syscall-filter</arg>
1eecafb8 108 <arg choice="opt"><replaceable>SET</replaceable>…</arg>
869feb33 109 </cmdsynopsis>
798d3a52
ZJS
110 <cmdsynopsis>
111 <command>systemd-analyze</command>
112 <arg choice="opt" rep="repeat">OPTIONS</arg>
113 <arg choice="plain">verify</arg>
114 <arg choice="opt" rep="repeat"><replaceable>FILES</replaceable></arg>
115 </cmdsynopsis>
6d86f4bd
LP
116 <cmdsynopsis>
117 <command>systemd-analyze</command>
118 <arg choice="opt" rep="repeat">OPTIONS</arg>
119 <arg choice="plain">calendar</arg>
120 <arg choice="plain" rep="repeat"><replaceable>SPECS</replaceable></arg>
121 </cmdsynopsis>
889d695d
JK
122 <cmdsynopsis>
123 <command>systemd-analyze</command>
124 <arg choice="opt" rep="repeat">OPTIONS</arg>
125 <arg choice="plain">service-watchdogs</arg>
90657286 126 <arg choice="opt"><replaceable>BOOL</replaceable></arg>
889d695d 127 </cmdsynopsis>
798d3a52
ZJS
128 </refsynopsisdiv>
129
130 <refsect1>
131 <title>Description</title>
132
133 <para><command>systemd-analyze</command> may be used to determine
134 system boot-up performance statistics and retrieve other state and
135 tracing information from the system and service manager, and to
889d695d
JK
136 verify the correctness of unit files. It is also used to access
137 special functions useful for advanced system manager debugging.</para>
798d3a52
ZJS
138
139 <para><command>systemd-analyze time</command> prints the time
140 spent in the kernel before userspace has been reached, the time
141 spent in the initial RAM disk (initrd) before normal system
142 userspace has been reached, and the time normal system userspace
143 took to initialize. Note that these measurements simply measure
144 the time passed up to the point where all system services have
145 been spawned, but not necessarily until they fully finished
146 initialization or the disk is idle.</para>
147
148 <para><command>systemd-analyze blame</command> prints a list of
149 all running units, ordered by the time they took to initialize.
150 This information may be used to optimize boot-up times. Note that
151 the output might be misleading as the initialization of one
152 service might be slow simply because it waits for the
153 initialization of another service to complete.</para>
154
155 <para><command>systemd-analyze critical-chain
1eecafb8 156 [<replaceable>UNIT…</replaceable>]</command> prints a tree of
798d3a52
ZJS
157 the time-critical chain of units (for each of the specified
158 <replaceable>UNIT</replaceable>s or for the default target
159 otherwise). The time after the unit is active or started is
160 printed after the "@" character. The time the unit takes to start
161 is printed after the "+" character. Note that the output might be
162 misleading as the initialization of one service might depend on
163 socket activation and because of the parallel execution of
164 units.</para>
165
166 <para><command>systemd-analyze plot</command> prints an SVG
167 graphic detailing which system services have been started at what
168 time, highlighting the time they spent on initialization.</para>
169
170 <para><command>systemd-analyze dot</command> generates textual
171 dependency graph description in dot format for further processing
172 with the GraphViz
3ba3a79d 173 <citerefentry project='die-net'><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
798d3a52
ZJS
174 tool. Use a command line like <command>systemd-analyze dot | dot
175 -Tsvg > systemd.svg</command> to generate a graphical dependency
176 tree. Unless <option>--order</option> or
177 <option>--require</option> is passed, the generated graph will
178 show both ordering and requirement dependencies. Optional pattern
179 globbing style specifications (e.g. <filename>*.target</filename>)
180 may be given at the end. A unit dependency is included in the
181 graph if any of these patterns match either the origin or
182 destination node.</para>
183
184 <para><command>systemd-analyze dump</command> outputs a (usually
185 very long) human-readable serialization of the complete server
186 state. Its format is subject to change without notice and should
187 not be parsed by applications.</para>
188
854a42fb
ZJS
189 <para><command>systemd-analyze cat-config</command> is similar
190 to <command>systemctl cat</command>, but operates on config files.
191 It will copy the contents of a config file and any drop-ins to standard
192 output, using the usual systemd set of directories and rules for
193 precedence.</para>
194
195 <example>
196 <title>Showing logind configuration</title>
197 <programlisting>$ systemd-analyze cat-config systemd/logind.conf
198# /etc/systemd/logind.conf
199# This file is part of systemd.
200...
201[Login]
202NAutoVTs=8
203...
204
205# /usr/lib/systemd/logind.conf.d/20-test.conf
206... some override from another package
207
208# /etc/systemd/logind.conf.d/50-override.conf
209... some adminstrator override
210 </programlisting>
211 </example>
212
31a5924e
ZJS
213 <para><command>systemd-analyze unit-paths</command> outputs a list of all
214 directories from which unit files, <filename>.d</filename> overrides, and
215 <filename>.wants</filename>, <filename>.requires</filename> symlinks may be
216 loaded. Combine with <option>--user</option> to retrieve the list for the user
217 manager instance, and <option>--global</option> for the global configuration of
218 user manager instances. Note that this verb prints the list that is compiled into
219 <command>systemd-analyze</command> itself, and does not comunicate with the
220 running manager. Use
221 <programlisting>systemctl [--user] [--global] show -p UnitPath --value</programlisting>
222 to retrieve the actual list that the manager uses, with any empty directories
223 omitted.</para>
224
90657286
YW
225 <para><command>systemd-analyze log-level</command>
226 prints the current log level of the <command>systemd</command> daemon.
227 If an optional argument <replaceable>LEVEL</replaceable> is provided, then the command changes the current log
228 level of the <command>systemd</command> daemon to <replaceable>LEVEL</replaceable> (accepts the same values as
798d3a52
ZJS
229 <option>--log-level=</option> described in
230 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).</para>
231
90657286
YW
232 <para><command>systemd-analyze log-target</command>
233 prints the current log target of the <command>systemd</command> daemon.
234 If an optional argument <replaceable>TARGET</replaceable> is provided, then the command changes the current log
235 target of the <command>systemd</command> daemon to <replaceable>TARGET</replaceable> (accepts the same values as
b938cb90 236 <option>--log-target=</option>, described in
2ca2a91c
LP
237 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).</para>
238
1eecafb8 239 <para><command>systemd-analyze syscall-filter <optional><replaceable>SET</replaceable>…</optional></command>
869feb33
ZJS
240 will list system calls contained in the specified system call set <replaceable>SET</replaceable>,
241 or all known sets if no sets are specified. Argument <replaceable>SET</replaceable> must include
242 the <literal>@</literal> prefix.</para>
243
d941ea22
ZJS
244 <para><command>systemd-analyze verify</command> will load unit files and print
245 warnings if any errors are detected. Files specified on the command line will be
246 loaded, but also any other units referenced by them. The full unit search path is
247 formed by combining the directories for all command line arguments, and the usual unit
248 load paths (variable <varname>$SYSTEMD_UNIT_PATH</varname> is supported, and may be
249 used to replace or augment the compiled in set of unit load paths; see
250 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
251 All units files present in the directories containing the command line arguments will
252 be used in preference to the other paths.</para>
798d3a52 253
6d86f4bd
LP
254 <para><command>systemd-analyze calendar</command> will parse and normalize repetitive calendar time events, and
255 will calculate when they will elapse next. This takes the same input as the <varname>OnCalendar=</varname> setting
256 in <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>, following the
257 syntax described in
258 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
259
90657286
YW
260 <para><command>systemd-analyze service-watchdogs</command>
261 prints the current state of service runtime watchdogs of the <command>systemd</command> daemon.
262 If an optional boolean argument is provided, then globally enables or disables the service
889d695d
JK
263 runtime watchdogs (<option>WatchdogSec=</option>) and emergency actions (e.g.
264 <option>OnFailure=</option> or <option>StartLimitAction=</option>); see
265 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
266 The hardware watchdog is not affected by this setting.</para>
267
798d3a52
ZJS
268 <para>If no command is passed, <command>systemd-analyze
269 time</command> is implied.</para>
270
271 </refsect1>
272
273 <refsect1>
274 <title>Options</title>
275
276 <para>The following options are understood:</para>
277
278 <variablelist>
28b35ef2
ZJS
279 <varlistentry>
280 <term><option>--system</option></term>
281
282 <listitem><para>Operates on the system systemd instance. This
283 is the implied default.</para></listitem>
284 </varlistentry>
285
798d3a52
ZJS
286 <varlistentry>
287 <term><option>--user</option></term>
288
289 <listitem><para>Operates on the user systemd
290 instance.</para></listitem>
291 </varlistentry>
292
293 <varlistentry>
28b35ef2 294 <term><option>--global</option></term>
798d3a52 295
28b35ef2
ZJS
296 <listitem><para>Operates on the system-wide configuration for
297 user systemd instance.</para></listitem>
798d3a52
ZJS
298 </varlistentry>
299
300 <varlistentry>
301 <term><option>--order</option></term>
302 <term><option>--require</option></term>
303
304 <listitem><para>When used in conjunction with the
305 <command>dot</command> command (see above), selects which
306 dependencies are shown in the dependency graph. If
307 <option>--order</option> is passed, only dependencies of type
308 <varname>After=</varname> or <varname>Before=</varname> are
309 shown. If <option>--require</option> is passed, only
310 dependencies of type <varname>Requires=</varname>,
798d3a52 311 <varname>Requisite=</varname>,
798d3a52
ZJS
312 <varname>Wants=</varname> and <varname>Conflicts=</varname>
313 are shown. If neither is passed, this shows dependencies of
314 all these types.</para></listitem>
315 </varlistentry>
316
317 <varlistentry>
318 <term><option>--from-pattern=</option></term>
319 <term><option>--to-pattern=</option></term>
320
321 <listitem><para>When used in conjunction with the
322 <command>dot</command> command (see above), this selects which
6ecb6cec
ZJS
323 relationships are shown in the dependency graph. Both options
324 require a
3ba3a79d 325 <citerefentry project='die-net'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
6ecb6cec
ZJS
326 pattern as an argument, which will be matched against the
327 left-hand and the right-hand, respectively, nodes of a
328 relationship.</para>
329
330 <para>Each of these can be used more than once, in which case
331 the unit name must match one of the values. When tests for
332 both sides of the relation are present, a relation must pass
333 both tests to be shown. When patterns are also specified as
334 positional arguments, they must match at least one side of the
335 relation. In other words, patterns specified with those two
336 options will trim the list of edges matched by the positional
337 arguments, if any are given, and fully determine the list of
338 edges shown otherwise.</para></listitem>
798d3a52
ZJS
339 </varlistentry>
340
341 <varlistentry>
342 <term><option>--fuzz=</option><replaceable>timespan</replaceable></term>
343
344 <listitem><para>When used in conjunction with the
345 <command>critical-chain</command> command (see above), also
346 show units, which finished <replaceable>timespan</replaceable>
347 earlier, than the latest unit in the same level. The unit of
348 <replaceable>timespan</replaceable> is seconds unless
349 specified with a different unit, e.g.
350 "50ms".</para></listitem>
351 </varlistentry>
352
353 <varlistentry>
641c0fd1 354 <term><option>--man=no</option></term>
798d3a52
ZJS
355
356 <listitem><para>Do not invoke man to verify the existence of
6ecb6cec 357 man pages listed in <varname>Documentation=</varname>.
798d3a52
ZJS
358 </para></listitem>
359 </varlistentry>
360
641c0fd1
ZJS
361 <varlistentry>
362 <term><option>--generators</option></term>
363
364 <listitem><para>Invoke unit generators, see
365 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
06815764
ZJS
366 Some generators require root privileges. Under a normal user, running with
367 generators enabled will generally result in some warnings.</para></listitem>
641c0fd1
ZJS
368 </varlistentry>
369
798d3a52
ZJS
370 <xi:include href="user-system-options.xml" xpointer="host" />
371 <xi:include href="user-system-options.xml" xpointer="machine" />
372
373 <xi:include href="standard-options.xml" xpointer="help" />
374 <xi:include href="standard-options.xml" xpointer="version" />
375 <xi:include href="standard-options.xml" xpointer="no-pager" />
376 </variablelist>
377
378 </refsect1>
379
380 <refsect1>
381 <title>Exit status</title>
382
383 <para>On success, 0 is returned, a non-zero failure code
384 otherwise.</para>
385 </refsect1>
386
387 <refsect1>
388 <title>Examples for <command>dot</command></title>
389
390 <example>
391 <title>Plots all dependencies of any unit whose name starts with
392 <literal>avahi-daemon</literal></title>
393
394 <programlisting>$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg > avahi.svg
1de2a9a5 395$ eog avahi.svg</programlisting>
798d3a52
ZJS
396 </example>
397
398 <example>
399 <title>Plots the dependencies between all known target units</title>
400
1de2a9a5 401 <programlisting>$ systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' | dot -Tsvg > targets.svg
816f25e8 402$ eog targets.svg</programlisting>
798d3a52
ZJS
403 </example>
404 </refsect1>
816f25e8 405
798d3a52
ZJS
406 <refsect1>
407 <title>Examples for <command>verify</command></title>
142c4eca 408
798d3a52
ZJS
409 <para>The following errors are currently detected:</para>
410 <itemizedlist>
411 <listitem><para>unknown sections and directives,
412 </para></listitem>
142c4eca 413
798d3a52 414 <listitem><para>missing dependencies which are required to start
2a03116d 415 the given unit,</para></listitem>
142c4eca 416
798d3a52
ZJS
417 <listitem><para>man pages listed in
418 <varname>Documentation=</varname> which are not found in the
419 system,</para></listitem>
142c4eca 420
798d3a52
ZJS
421 <listitem><para>commands listed in <varname>ExecStart=</varname>
422 and similar which are not found in the system or not
423 executable.</para></listitem>
424 </itemizedlist>
142c4eca 425
798d3a52
ZJS
426 <example>
427 <title>Misspelt directives</title>
142c4eca 428
798d3a52 429 <programlisting>$ cat ./user.slice
142c4eca
ZJS
430[Unit]
431WhatIsThis=11
432Documentation=man:nosuchfile(1)
433Requires=different.service
434
435[Service]
301a21a8 436Description=x
142c4eca 437
ee9c4ff4 438$ systemd-analyze verify ./user.slice
142c4eca
ZJS
439[./user.slice:9] Unknown lvalue 'WhatIsThis' in section 'Unit'
440[./user.slice:13] Unknown section 'Service'. Ignoring.
441Error: org.freedesktop.systemd1.LoadFailed:
798d3a52
ZJS
442 Unit different.service failed to load:
443 No such file or directory.
142c4eca
ZJS
444Failed to create user.slice/start: Invalid argument
445user.slice: man nosuchfile(1) command failed with code 16
798d3a52
ZJS
446 </programlisting>
447 </example>
142c4eca 448
798d3a52
ZJS
449 <example>
450 <title>Missing service units</title>
142c4eca 451
798d3a52 452 <programlisting>$ tail ./a.socket ./b.socket
142c4eca
ZJS
453==> ./a.socket &lt;==
454[Socket]
455ListenStream=100
456
457==> ./b.socket &lt;==
458[Socket]
459ListenStream=100
460Accept=yes
461
ee9c4ff4 462$ systemd-analyze verify ./a.socket ./b.socket
142c4eca
ZJS
463Service a.service not loaded, a.socket cannot be started.
464Service b@0.service not loaded, b.socket cannot be started.
798d3a52
ZJS
465 </programlisting>
466 </example>
467 </refsect1>
468
469 <xi:include href="less-variables.xml" />
470
471 <refsect1>
472 <title>See Also</title>
473 <para>
474 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
475 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
476 </para>
477 </refsect1>
359deb60
LP
478
479</refentry>