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