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