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