]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-analyze.xml
analyze: add new fdstore verb
[thirdparty/systemd.git] / man / systemd-analyze.xml
CommitLineData
359deb60 1<?xml version='1.0'?> <!--*-nxml-*-->
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
359deb60 5
bb5a34fb 6<refentry id="systemd-analyze" conditional='ENABLE_ANALYZE'
798d3a52
ZJS
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>systemd-analyze</title>
11 <productname>systemd</productname>
798d3a52
ZJS
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>systemd-analyze</refentrytitle>
16 <manvolnum>1</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>systemd-analyze</refname>
889d695d 21 <refpurpose>Analyze and debug system manager</refpurpose>
798d3a52
ZJS
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <cmdsynopsis>
26 <command>systemd-analyze</command>
27 <arg choice="opt" rep="repeat">OPTIONS</arg>
28 <arg>time</arg>
29 </cmdsynopsis>
30 <cmdsynopsis>
31 <command>systemd-analyze</command>
32 <arg choice="opt" rep="repeat">OPTIONS</arg>
33 <arg choice="plain">blame</arg>
34 </cmdsynopsis>
35 <cmdsynopsis>
36 <command>systemd-analyze</command>
37 <arg choice="opt" rep="repeat">OPTIONS</arg>
38 <arg choice="plain">critical-chain</arg>
39 <arg choice="opt" rep="repeat"><replaceable>UNIT</replaceable></arg>
40 </cmdsynopsis>
d323a990 41
854a42fb
ZJS
42 <cmdsynopsis>
43 <command>systemd-analyze</command>
44 <arg choice="opt" rep="repeat">OPTIONS</arg>
d323a990 45 <arg choice="plain">dump</arg>
d1d8786c 46 <arg choice="opt" rep="repeat"><replaceable>PATTERN</replaceable></arg>
854a42fb 47 </cmdsynopsis>
d323a990 48
31a5924e
ZJS
49 <cmdsynopsis>
50 <command>systemd-analyze</command>
51 <arg choice="opt" rep="repeat">OPTIONS</arg>
d323a990
ZJS
52 <arg choice="plain">plot</arg>
53 <arg choice="opt">>file.svg</arg>
31a5924e 54 </cmdsynopsis>
798d3a52
ZJS
55 <cmdsynopsis>
56 <command>systemd-analyze</command>
57 <arg choice="opt" rep="repeat">OPTIONS</arg>
d323a990
ZJS
58 <arg choice="plain">dot</arg>
59 <arg choice="opt" rep="repeat"><replaceable>PATTERN</replaceable></arg>
60 <arg choice="opt">>file.dot</arg>
798d3a52 61 </cmdsynopsis>
d323a990 62
aff13177
LP
63 <cmdsynopsis>
64 <command>systemd-analyze</command>
65 <arg choice="opt" rep="repeat">OPTIONS</arg>
66 <arg choice="plain">unit-files</arg>
67 </cmdsynopsis>
213cf5b1
LP
68 <cmdsynopsis>
69 <command>systemd-analyze</command>
70 <arg choice="opt" rep="repeat">OPTIONS</arg>
d323a990 71 <arg choice="plain">unit-paths</arg>
ef5a8cb1 72 </cmdsynopsis>
76ed04d9
ZJS
73 <cmdsynopsis>
74 <command>systemd-analyze</command>
75 <arg choice="opt" rep="repeat">OPTIONS</arg>
5238d9a8
LP
76 <arg choice="plain">exit-status</arg>
77 <arg choice="opt" rep="repeat"><replaceable>STATUS</replaceable></arg>
76ed04d9 78 </cmdsynopsis>
b2af819b
LP
79 <cmdsynopsis>
80 <command>systemd-analyze</command>
81 <arg choice="opt" rep="repeat">OPTIONS</arg>
82 <arg choice="plain">capability</arg>
83 <arg choice="opt" rep="repeat"><replaceable>CAPABILITY</replaceable></arg>
84 </cmdsynopsis>
edfea9fe
ZJS
85 <cmdsynopsis>
86 <command>systemd-analyze</command>
87 <arg choice="opt" rep="repeat">OPTIONS</arg>
88 <arg choice="plain">condition</arg>
89 <arg choice="plain"><replaceable>CONDITION</replaceable>…</arg>
90 </cmdsynopsis>
869feb33
ZJS
91 <cmdsynopsis>
92 <command>systemd-analyze</command>
93 <arg choice="opt" rep="repeat">OPTIONS</arg>
94 <arg choice="plain">syscall-filter</arg>
1eecafb8 95 <arg choice="opt"><replaceable>SET</replaceable>…</arg>
869feb33 96 </cmdsynopsis>
20080622
ILG
97 <cmdsynopsis>
98 <command>systemd-analyze</command>
99 <arg choice="opt" rep="repeat">OPTIONS</arg>
100 <arg choice="plain">filesystems</arg>
101 <arg choice="opt"><replaceable>SET</replaceable>…</arg>
102 </cmdsynopsis>
798d3a52
ZJS
103 <cmdsynopsis>
104 <command>systemd-analyze</command>
105 <arg choice="opt" rep="repeat">OPTIONS</arg>
d323a990 106 <arg choice="plain">calendar</arg>
2cae4711
ZJS
107 <arg choice="plain" rep="repeat"><replaceable>SPEC</replaceable></arg>
108 </cmdsynopsis>
109 <cmdsynopsis>
110 <command>systemd-analyze</command>
111 <arg choice="opt" rep="repeat">OPTIONS</arg>
112 <arg choice="plain">timestamp</arg>
113 <arg choice="plain" rep="repeat"><replaceable>TIMESTAMP</replaceable></arg>
798d3a52 114 </cmdsynopsis>
6d86f4bd
LP
115 <cmdsynopsis>
116 <command>systemd-analyze</command>
117 <arg choice="opt" rep="repeat">OPTIONS</arg>
d323a990
ZJS
118 <arg choice="plain">timespan</arg>
119 <arg choice="plain" rep="repeat"><replaceable>SPAN</replaceable></arg>
6d86f4bd 120 </cmdsynopsis>
889d695d
JK
121 <cmdsynopsis>
122 <command>systemd-analyze</command>
123 <arg choice="opt" rep="repeat">OPTIONS</arg>
d323a990
ZJS
124 <arg choice="plain">cat-config</arg>
125 <arg choice="plain" rep="repeat"><replaceable>NAME</replaceable>|<replaceable>PATH</replaceable></arg>
889d695d 126 </cmdsynopsis>
bc012a3e
ZJS
127 <cmdsynopsis>
128 <command>systemd-analyze</command>
129 <arg choice="opt" rep="repeat">OPTIONS</arg>
130 <arg choice="plain">compare-versions</arg>
131 <arg choice="plain"><replaceable>VERSION1</replaceable></arg>
132 <arg choice="opt"><replaceable>OP</replaceable></arg>
133 <arg choice="plain"><replaceable>VERSION2</replaceable></arg>
134 </cmdsynopsis>
3f1c1287
CD
135 <cmdsynopsis>
136 <command>systemd-analyze</command>
137 <arg choice="opt" rep="repeat">OPTIONS</arg>
d323a990
ZJS
138 <arg choice="plain">verify</arg>
139 <arg choice="opt" rep="repeat"><replaceable>FILE</replaceable></arg>
3f1c1287 140 </cmdsynopsis>
ee93c1e6
LP
141 <cmdsynopsis>
142 <command>systemd-analyze</command>
143 <arg choice="opt" rep="repeat">OPTIONS</arg>
144 <arg choice="plain">security</arg>
145 <arg choice="plain" rep="repeat"><replaceable>UNIT</replaceable></arg>
146 </cmdsynopsis>
aff13177
LP
147 <cmdsynopsis>
148 <command>systemd-analyze</command>
149 <arg choice="opt" rep="repeat">OPTIONS</arg>
150 <arg choice="plain">inspect-elf</arg>
151 <arg choice="plain" rep="repeat"><replaceable>FILE</replaceable></arg>
152 </cmdsynopsis>
f50535af
LB
153 <cmdsynopsis>
154 <command>systemd-analyze</command>
155 <arg choice="opt" rep="repeat">OPTIONS</arg>
156 <arg choice="plain">malloc</arg>
157 <arg choice="opt" rep="repeat"><replaceable>D-BUS SERVICE</replaceable></arg>
158 </cmdsynopsis>
5f43c97c
LP
159 <cmdsynopsis>
160 <command>systemd-analyze</command>
161 <arg choice="opt" rep="repeat">OPTIONS</arg>
162 <arg choice="plain">fdstore</arg>
163 <arg choice="opt" rep="repeat"><replaceable>UNIT</replaceable></arg>
164 </cmdsynopsis>
798d3a52
ZJS
165 </refsynopsisdiv>
166
167 <refsect1>
168 <title>Description</title>
169
170 <para><command>systemd-analyze</command> may be used to determine
171 system boot-up performance statistics and retrieve other state and
172 tracing information from the system and service manager, and to
889d695d
JK
173 verify the correctness of unit files. It is also used to access
174 special functions useful for advanced system manager debugging.</para>
798d3a52 175
d323a990
ZJS
176 <para>If no command is passed, <command>systemd-analyze
177 time</command> is implied.</para>
854a42fb 178
d323a990
ZJS
179 <refsect2>
180 <title><command>systemd-analyze time</command></title>
181
182 <para>This command prints the time spent in the kernel before userspace has been reached, the time
55c041b4
LP
183 spent in the initrd before normal system userspace has been reached, and the time normal system
184 userspace took to initialize. Note that these measurements simply measure the time passed up to the
185 point where all system services have been spawned, but not necessarily until they fully finished
186 initialization or the disk is idle.</para>
d323a990
ZJS
187
188 <example>
189 <title><command>Show how long the boot took</command></title>
190
191 <programlisting># in a container
192$ systemd-analyze time
193Startup finished in 296ms (userspace)
194multi-user.target reached after 275ms in userspace
195
196# on a real machine
197$ systemd-analyze time
198Startup finished in 2.584s (kernel) + 19.176s (initrd) + 47.847s (userspace) = 1min 9.608s
199multi-user.target reached after 47.820s in userspace
200</programlisting>
201 </example>
202 </refsect2>
203
204 <refsect2>
205 <title><command>systemd-analyze blame</command></title>
206
207 <para>This command prints a list of all running units, ordered by the time they took to initialize.
208 This information may be used to optimize boot-up times. Note that the output might be misleading as the
209 initialization of one service might be slow simply because it waits for the initialization of another
210 service to complete. Also note: <command>systemd-analyze blame</command> doesn't display results for
211 services with <varname>Type=simple</varname>, because systemd considers such services to be started
15b0fdd5
LP
212 immediately, hence no measurement of the initialization delays can be done. Also note that this command
213 only shows the time units took for starting up, it does not show how long unit jobs spent in the
214 execution queue. In particular it shows the time units spent in <literal>activating</literal> state,
215 which is not defined for units such as device units that transition directly from
216 <literal>inactive</literal> to <literal>active</literal>. This command hence gives an impression of the
217 performance of program code, but cannot accurately reflect latency introduced by waiting for
218 hardware and similar events.</para>
d323a990
ZJS
219
220 <example>
221 <title><command>Show which units took the most time during boot</command></title>
222
223 <programlisting>$ systemd-analyze blame
224 32.875s pmlogger.service
225 20.905s systemd-networkd-wait-online.service
226 13.299s dev-vda1.device
227 ...
228 23ms sysroot.mount
229 11ms initrd-udevadm-cleanup-db.service
230 3ms sys-kernel-config.mount
231 </programlisting>
232 </example>
233 </refsect2>
234
235 <refsect2>
236 <title><command>systemd-analyze critical-chain <optional><replaceable>UNIT</replaceable>...</optional></command></title>
237
238 <para>This command prints a tree of the time-critical chain of units (for each of the specified
239 <replaceable>UNIT</replaceable>s or for the default target otherwise). The time after the unit is
240 active or started is printed after the "@" character. The time the unit takes to start is printed after
241 the "+" character. Note that the output might be misleading as the initialization of services might
15102ced 242 depend on socket activation and because of the parallel execution of units. Also, similarly to the
15b0fdd5
LP
243 <command>blame</command> command, this only takes into account the time units spent in
244 <literal>activating</literal> state, and hence does not cover units that never went through an
245 <literal>activating</literal> state (such as device units that transition directly from
246 <literal>inactive</literal> to <literal>active</literal>). Moreover it does not show information on
247 jobs (and in particular not jobs that timed out).</para>
d323a990
ZJS
248
249 <example>
be78e0f0 250 <title><command>systemd-analyze critical-chain</command></title>
d323a990
ZJS
251
252 <programlisting>$ systemd-analyze critical-chain
253multi-user.target @47.820s
254└─pmie.service @35.968s +548ms
255 └─pmcd.service @33.715s +2.247s
256 └─network-online.target @33.712s
257 └─systemd-networkd-wait-online.service @12.804s +20.905s
258 └─systemd-networkd.service @11.109s +1.690s
259 └─systemd-udevd.service @9.201s +1.904s
260 └─systemd-tmpfiles-setup-dev.service @7.306s +1.776s
261 └─kmod-static-nodes.service @6.976s +177ms
262 └─systemd-journald.socket
263 └─system.slice
264 └─-.slice
265</programlisting>
266 </example>
267 </refsect2>
268
d323a990 269 <refsect2>
d1d8786c 270 <title><command>systemd-analyze dump [<replaceable>pattern</replaceable>…]</command></title>
d323a990 271
d1d8786c
FB
272 <para>Without any parameter, this command outputs a (usually very long) human-readable serialization of
273 the complete service manager state. Optional glob pattern may be specified, causing the output to be
274 limited to units whose names match one of the patterns. The output format is subject to change without
275 notice and should not be parsed by applications.</para>
d323a990
ZJS
276
277 <example>
278 <title>Show the internal state of user manager</title>
279
280 <programlisting>$ systemd-analyze --user dump
281Timestamp userspace: Thu 2019-03-14 23:28:07 CET
282Timestamp finish: Thu 2019-03-14 23:28:07 CET
283Timestamp generators-start: Thu 2019-03-14 23:28:07 CET
284Timestamp generators-finish: Thu 2019-03-14 23:28:07 CET
285Timestamp units-load-start: Thu 2019-03-14 23:28:07 CET
286Timestamp units-load-finish: Thu 2019-03-14 23:28:07 CET
287-> Unit proc-timer_list.mount:
288 Description: /proc/timer_list
289 ...
290-> Unit default.target:
291 Description: Main user target
292...
293</programlisting>
294 </example>
295 </refsect2>
296
f50535af
LB
297 <refsect2>
298 <title><command>systemd-analyze malloc [<replaceable>D-Bus service</replaceable>…]</command></title>
299
300 <para>This command can be used to request the output of the internal memory state (as returned by
301 <citerefentry><refentrytitle>malloc_info</refentrytitle><manvolnum>3</manvolnum></citerefentry>) of
302 a D-Bus service implementing this pattern. If no service is specified, the command will be sent to
303 <filename>org.freedesktop.systemd1</filename> (the system or user service manager). The output format
304 is subject to change without notice and should not be parsed by applications.</para>
305 </refsect2>
306
d323a990
ZJS
307 <refsect2>
308 <title><command>systemd-analyze plot</command></title>
309
dc57a338 310 <para>This command prints either an SVG graphic, detailing which system services have been started at what
311 time, highlighting the time they spent on initialization, or the raw time data in JSON or table format.</para>
d323a990
ZJS
312
313 <example>
314 <title><command>Plot a bootchart</command></title>
315
316 <programlisting>$ systemd-analyze plot >bootup.svg
317$ eog bootup.svg&amp;
318</programlisting>
319 </example>
c96ec630
LP
320
321 <para>Note that this plot is based on the most recent per-unit timing data of loaded units. This means
322 that if a unit gets started, then stopped and then started again the information shown will cover the
323 most recent start cycle, not the first one. Thus it's recommended to consult this information only
324 shortly after boot, so that this distinction doesn't matter. Moreover, units that are not referenced by
325 any other unit through a dependency might be unloaded by the service manager once they terminate (and
326 did not fail). Such units will not show up in the plot.</para>
d323a990
ZJS
327 </refsect2>
328
329 <refsect2>
330 <title><command>systemd-analyze dot [<replaceable>pattern</replaceable>...]</command></title>
331
332 <para>This command generates textual dependency graph description in dot format for further processing
333 with the GraphViz
334 <citerefentry project='die-net'><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
335 tool. Use a command line like <command>systemd-analyze dot | dot -Tsvg >systemd.svg</command> to
336 generate a graphical dependency tree. Unless <option>--order</option> or <option>--require</option> is
337 passed, the generated graph will show both ordering and requirement dependencies. Optional pattern
338 globbing style specifications (e.g. <filename>*.target</filename>) may be given at the end. A unit
339 dependency is included in the graph if any of these patterns match either the origin or destination
340 node.</para>
341
342 <example>
343 <title>Plot all dependencies of any unit whose name starts with <literal>avahi-daemon</literal>
344 </title>
345
346 <programlisting>$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg >avahi.svg
347$ eog avahi.svg</programlisting>
348 </example>
349
350 <example>
351 <title>Plot the dependencies between all known target units</title>
352
353 <programlisting>$ systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' \
354 | dot -Tsvg >targets.svg
355$ eog targets.svg</programlisting>
356 </example>
357 </refsect2>
358
359 <refsect2>
360 <title><command>systemd-analyze unit-paths</command></title>
361
362 <para>This command outputs a list of all directories from which unit files, <filename>.d</filename>
363 overrides, and <filename>.wants</filename>, <filename>.requires</filename> symlinks may be
364 loaded. Combine with <option>--user</option> to retrieve the list for the user manager instance, and
365 <option>--global</option> for the global configuration of user manager instances.</para>
366
367 <example>
368 <title><command>Show all paths for generated units</command></title>
369
370 <programlisting>$ systemd-analyze unit-paths | grep '^/run'
371/run/systemd/system.control
372/run/systemd/transient
373/run/systemd/generator.early
374/run/systemd/system
375/run/systemd/system.attached
376/run/systemd/generator
377/run/systemd/generator.late
378</programlisting>
379 </example>
380
381 <para>Note that this verb prints the list that is compiled into <command>systemd-analyze</command>
5238e957 382 itself, and does not communicate with the running manager. Use
d323a990
ZJS
383 <programlisting>systemctl [--user] [--global] show -p UnitPath --value</programlisting>
384 to retrieve the actual list that the manager uses, with any empty directories omitted.</para>
385 </refsect2>
386
76ed04d9 387 <refsect2>
5238d9a8 388 <title><command>systemd-analyze exit-status <optional><replaceable>STATUS</replaceable>...</optional></command></title>
76ed04d9 389
5238d9a8 390 <para>This command prints a list of exit statuses along with their "class", i.e. the source of the
76ed04d9
ZJS
391 definition (one of <literal>glibc</literal>, <literal>systemd</literal>, <literal>LSB</literal>, or
392 <literal>BSD</literal>), see the Process Exit Codes section in
393 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
fa027117 394 If no additional arguments are specified, all known statuses are shown. Otherwise, only the
76ed04d9
ZJS
395 definitions for the specified codes are shown.</para>
396
397 <example>
5238d9a8
LP
398 <title><command>Show some example exit status names</command></title>
399
400 <programlisting>$ systemd-analyze exit-status 0 1 {63..65}
401NAME STATUS CLASS
402SUCCESS 0 glibc
403FAILURE 1 glibc
404- 63 -
405USAGE 64 BSD
406DATAERR 65 BSD
76ed04d9
ZJS
407</programlisting>
408 </example>
409 </refsect2>
410
b2af819b
LP
411 <refsect2>
412 <title><command>systemd-analyze capability <optional><replaceable>CAPABILITY</replaceable>...</optional></command></title>
413
414 <para>This command prints a list of Linux capabilities along with their numeric IDs. See <citerefentry
415 project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
416 for details. If no argument is specified the full list of capabilities known to the service manager and
417 the kernel is shown. Capabilities defined by the kernel but not known to the service manager are shown
418 as <literal>cap_???</literal>. Optionally, if arguments are specified they may refer to specific
419 cabilities by name or numeric ID, in which case only the indicated capabilities are shown in the
420 table.</para>
421
422 <example>
423 <title><command>Show some example capability names</command></title>
424
425 <programlisting>$ systemd-analyze capability 0 1 {30..32}
426NAME NUMBER
427cap_chown 0
428cap_dac_override 1
429cap_audit_control 30
430cap_setfcap 31
431cap_mac_override 32</programlisting>
432 </example>
433 </refsect2>
434
edfea9fe
ZJS
435 <refsect2>
436 <title><command>systemd-analyze condition <replaceable>CONDITION</replaceable>...</command></title>
437
b0343f8c
ZJS
438 <para>This command will evaluate <varname index="false">Condition*=...</varname> and
439 <varname index="false">Assert*=...</varname> assignments, and print their values, and
edfea9fe
ZJS
440 the resulting value of the combined condition set. See
441 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
442 for a list of available conditions and asserts.</para>
443
444 <example>
445 <title>Evaluate conditions that check kernel versions</title>
446
447 <programlisting>$ systemd-analyze condition 'ConditionKernelVersion = ! &lt;4.0' \
448 'ConditionKernelVersion = &gt;=5.1' \
449 'ConditionACPower=|false' \
450 'ConditionArchitecture=|!arm' \
451 'AssertPathExists=/etc/os-release'
452test.service: AssertPathExists=/etc/os-release succeeded.
453Asserts succeeded.
454test.service: ConditionArchitecture=|!arm succeeded.
455test.service: ConditionACPower=|false failed.
456test.service: ConditionKernelVersion=&gt;=5.1 succeeded.
457test.service: ConditionKernelVersion=!&lt;4.0 succeeded.
458Conditions succeeded.</programlisting>
459 </example>
460 </refsect2>
461
d323a990
ZJS
462 <refsect2>
463 <title><command>systemd-analyze syscall-filter <optional><replaceable>SET</replaceable>...</optional></command></title>
464
465 <para>This command will list system calls contained in the specified system call set
466 <replaceable>SET</replaceable>, or all known sets if no sets are specified. Argument
467 <replaceable>SET</replaceable> must include the <literal>@</literal> prefix.</para>
468 </refsect2>
469
20080622
ILG
470 <refsect2>
471 <title><command>systemd-analyze filesystems <optional><replaceable>SET</replaceable>...</optional></command></title>
472
473 <para>This command will list filesystems in the specified filesystem set
474 <replaceable>SET</replaceable>, or all known sets if no sets are specified. Argument
475 <replaceable>SET</replaceable> must include the <literal>@</literal> prefix.</para>
476 </refsect2>
477
d323a990
ZJS
478 <refsect2>
479 <title><command>systemd-analyze calendar <replaceable>EXPRESSION</replaceable>...</command></title>
480
481 <para>This command will parse and normalize repetitive calendar time events, and will calculate when
482 they elapse next. This takes the same input as the <varname>OnCalendar=</varname> setting in
483 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
484 following the syntax described in
485 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>. By
486 default, only the next time the calendar expression will elapse is shown; use
487 <option>--iterations=</option> to show the specified number of next times the expression
2cae4711
ZJS
488 elapses. Each time the expression elapses forms a timestamp, see the <command>timestamp</command>
489 verb below.</para>
d323a990
ZJS
490
491 <example>
492 <title>Show leap days in the near future</title>
493
494 <programlisting>$ systemd-analyze calendar --iterations=5 '*-2-29 0:0:0'
495 Original form: *-2-29 0:0:0
496Normalized form: *-02-29 00:00:00
497 Next elapse: Sat 2020-02-29 00:00:00 UTC
498 From now: 11 months 15 days left
499 Iter. #2: Thu 2024-02-29 00:00:00 UTC
500 From now: 4 years 11 months left
501 Iter. #3: Tue 2028-02-29 00:00:00 UTC
502 From now: 8 years 11 months left
503 Iter. #4: Sun 2032-02-29 00:00:00 UTC
504 From now: 12 years 11 months left
505 Iter. #5: Fri 2036-02-29 00:00:00 UTC
506 From now: 16 years 11 months left
507</programlisting>
508 </example>
509 </refsect2>
510
2cae4711
ZJS
511 <refsect2>
512 <title><command>systemd-analyze timestamp <replaceable>TIMESTAMP</replaceable>...</command></title>
513
514 <para>This command parses a timestamp (i.e. a single point in time) and outputs the normalized form and
515 the difference between this timestamp and now. The timestamp should adhere to the syntax documented in
516 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
517 section "PARSING TIMESTAMPS".</para>
518
519 <example>
520 <title>Show parsing of timestamps</title>
521
522 <programlisting>$ systemd-analyze timestamp yesterday now tomorrow
523 Original form: yesterday
ea62aa24
ZJS
524Normalized form: Mon 2019-05-20 00:00:00 CEST
525 (in UTC): Sun 2019-05-19 22:00:00 UTC
526 UNIX seconds: @15583032000
2cae4711
ZJS
527 From now: 1 day 9h ago
528
529 Original form: now
ea62aa24
ZJS
530Normalized form: Tue 2019-05-21 09:48:39 CEST
531 (in UTC): Tue 2019-05-21 07:48:39 UTC
532 UNIX seconds: @1558424919.659757
533 From now: 43us ago
2cae4711
ZJS
534
535 Original form: tomorrow
ea62aa24
ZJS
536Normalized form: Wed 2019-05-22 00:00:00 CEST
537 (in UTC): Tue 2019-05-21 22:00:00 UTC
538 UNIX seconds: @15584760000
2cae4711
ZJS
539 From now: 14h left
540</programlisting>
541 </example>
542 </refsect2>
543
d323a990
ZJS
544 <refsect2>
545 <title><command>systemd-analyze timespan <replaceable>EXPRESSION</replaceable>...</command></title>
546
2cae4711
ZJS
547 <para>This command parses a time span (i.e. a difference between two timestamps) and outputs the
548 normalized form and the equivalent value in microseconds. The time span should adhere to the syntax
549 documented in
550 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
551 section "PARSING TIME SPANS". Values without units are parsed as seconds.</para>
d323a990
ZJS
552
553 <example>
554 <title>Show parsing of timespans</title>
555
556 <programlisting>$ systemd-analyze timespan 1s 300s '1year 0.000001s'
557Original: 1s
558 μs: 1000000
559 Human: 1s
560
561Original: 300s
562 μs: 300000000
563 Human: 5min
564
565Original: 1year 0.000001s
566 μs: 31557600000001
567 Human: 1y 1us
568</programlisting>
569 </example>
570 </refsect2>
571
572 <refsect2>
573 <title><command>systemd-analyze cat-config</command>
574 <replaceable>NAME</replaceable>|<replaceable>PATH</replaceable>...</title>
575
576 <para>This command is similar to <command>systemctl cat</command>, but operates on config files. It
577 will copy the contents of a config file and any drop-ins to standard output, using the usual systemd
578 set of directories and rules for precedence. Each argument must be either an absolute path including
579 the prefix (such as <filename>/etc/systemd/logind.conf</filename> or
580 <filename>/usr/lib/systemd/logind.conf</filename>), or a name relative to the prefix (such as
581 <filename>systemd/logind.conf</filename>).</para>
582
583 <example>
584 <title>Showing logind configuration</title>
585 <programlisting>$ systemd-analyze cat-config systemd/logind.conf
854a42fb 586# /etc/systemd/logind.conf
854a42fb
ZJS
587...
588[Login]
589NAutoVTs=8
590...
591
592# /usr/lib/systemd/logind.conf.d/20-test.conf
593... some override from another package
594
595# /etc/systemd/logind.conf.d/50-override.conf
1b2ad5d9 596... some administrator override
d323a990
ZJS
597 </programlisting>
598 </example>
599 </refsect2>
ee93c1e6 600
bc012a3e
ZJS
601 <refsect2>
602 <title><command>systemd-analyze compare-versions
603 <replaceable>VERSION1</replaceable>
604 <optional><replaceable>OP</replaceable></optional>
605 <replaceable>VERSION2</replaceable></command></title>
606
607 <para>This command has two distinct modes of operation, depending on whether the operator
608 <replaceable>OP</replaceable> is specified.</para>
609
610 <para>In the first mode — when <replaceable>OP</replaceable> is not specified — it will compare the two
611 version strings and print either <literal><replaceable>VERSION1</replaceable> &lt;
612 <replaceable>VERSION2</replaceable></literal>, or <literal><replaceable>VERSION1</replaceable> ==
613 <replaceable>VERSION2</replaceable></literal>, or <literal><replaceable>VERSION1</replaceable> &gt;
614 <replaceable>VERSION2</replaceable></literal> as appropriate.</para>
615
616 <para>The exit status is <constant>0</constant> if the versions are equal, <constant>11</constant> if
617 the version of the right is smaller, and <constant>12</constant> if the version of the left is
618 smaller. (This matches the convention used by <command>rpmdev-vercmp</command>.)</para>
619
620 <para>In the second mode — when <replaceable>OP</replaceable> is specified — it will compare the two
621 version strings using the operation <replaceable>OP</replaceable> and return <constant>0</constant>
622 (success) if they condition is satisfied, and <constant>1</constant> (failure)
623 otherwise. <constant>OP</constant> may be <command>lt</command>, <command>le</command>,
624 <command>eq</command>, <command>ne</command>, <command>ge</command>, <command>gt</command>. In this
625 mode, no output is printed.
626 (This matches the convention used by
627 <citerefentry project='die-net'><refentrytitle>dpkg</refentrytitle><manvolnum>1</manvolnum></citerefentry>
628 <option>--compare-versions</option>.)</para>
629
630 <example>
631 <title>Compare versions of a package</title>
632
633 <programlisting>
634$ systemd-analyze compare-versions systemd-250~rc1.fc36.aarch64 systemd-251.fc36.aarch64
635systemd-250~rc1.fc36.aarch64 &lt; systemd-251.fc36.aarch64
636$ echo $?
63712
638
639$ systemd-analyze compare-versions 1 lt 2; echo $?
6400
641$ systemd-analyze compare-versions 1 ge 2; echo $?
6421
643 </programlisting>
644 </example>
645 </refsect2>
646
d323a990
ZJS
647 <refsect2>
648 <title><command>systemd-analyze verify <replaceable>FILE</replaceable>...</command></title>
649
650 <para>This command will load unit files and print warnings if any errors are detected. Files specified
da845dab
AB
651 on the command line will be loaded, but also any other units referenced by them. A unit's name on disk
652 can be overridden by specifying an alias after a colon; see below for an example. The full unit search
d323a990 653 path is formed by combining the directories for all command line arguments, and the usual unit load
e9dd6984 654 paths. The variable <varname>$SYSTEMD_UNIT_PATH</varname> is supported, and may be used to replace or
d323a990 655 augment the compiled in set of unit load paths; see
e9dd6984 656 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. All
d323a990
ZJS
657 units files present in the directories containing the command line arguments will be used in preference
658 to the other paths.</para>
798d3a52 659
d323a990
ZJS
660 <para>The following errors are currently detected:</para>
661 <itemizedlist>
662 <listitem><para>unknown sections and directives,</para></listitem>
663
664 <listitem><para>missing dependencies which are required to start the given unit,</para></listitem>
665
666 <listitem><para>man pages listed in <varname>Documentation=</varname> which are not found in the
667 system,</para></listitem>
668
669 <listitem><para>commands listed in <varname>ExecStart=</varname> and similar which are not found in
670 the system or not executable.</para></listitem>
671 </itemizedlist>
672
673 <example>
674 <title>Misspelt directives</title>
675
676 <programlisting>$ cat ./user.slice
677[Unit]
678WhatIsThis=11
679Documentation=man:nosuchfile(1)
680Requires=different.service
681
682[Service]
683Description=x
684
685$ systemd-analyze verify ./user.slice
686[./user.slice:9] Unknown lvalue 'WhatIsThis' in section 'Unit'
687[./user.slice:13] Unknown section 'Service'. Ignoring.
688Error: org.freedesktop.systemd1.LoadFailed:
689 Unit different.service failed to load:
690 No such file or directory.
691Failed to create user.slice/start: Invalid argument
692user.slice: man nosuchfile(1) command failed with code 16
693 </programlisting>
694 </example>
695
696 <example>
697 <title>Missing service units</title>
698
699 <programlisting>$ tail ./a.socket ./b.socket
700==> ./a.socket &lt;==
701[Socket]
702ListenStream=100
703
704==> ./b.socket &lt;==
705[Socket]
706ListenStream=100
707Accept=yes
708
709$ systemd-analyze verify ./a.socket ./b.socket
710Service a.service not loaded, a.socket cannot be started.
711Service b@0.service not loaded, b.socket cannot be started.
712 </programlisting>
713 </example>
da845dab
AB
714
715 <example>
716 <title>Aliasing a unit</title>
717
718 <programlisting>$ cat /tmp/source
719[Unit]
720Description=Hostname printer
721
722[Service]
723Type=simple
724ExecStart=/usr/bin/echo %H
725MysteryKey=true
726
727$ systemd-analyze verify /tmp/source
728Failed to prepare filename /tmp/source: Invalid argument
729
730$ systemd-analyze verify /tmp/source:alias.service
731/tmp/systemd-analyze-XXXXXX/alias.service:7: Unknown key name 'MysteryKey' in section 'Service', ignoring.
732 </programlisting>
733 </example>
734
d323a990
ZJS
735 </refsect2>
736
737 <refsect2>
738 <title><command>systemd-analyze security <optional><replaceable>UNIT</replaceable>...</optional></command></title>
739
740 <para>This command analyzes the security and sandboxing settings of one or more specified service
741 units. If at least one unit name is specified the security settings of the specified service units are
742 inspected and a detailed analysis is shown. If no unit name is specified, all currently loaded,
743 long-running service units are inspected and a terse table with results shown. The command checks for
744 various security-related service settings, assigning each a numeric "exposure level" value, depending
745 on how important a setting is. It then calculates an overall exposure level for the whole unit, which
746 is an estimation in the range 0.0…10.0 indicating how exposed a service is security-wise. High exposure
747 levels indicate very little applied sandboxing. Low exposure levels indicate tight sandboxing and
748 strongest security restrictions. Note that this only analyzes the per-service security features systemd
749 itself implements. This means that any additional security mechanisms applied by the service code
750 itself are not accounted for. The exposure level determined this way should not be misunderstood: a
751 high exposure level neither means that there is no effective sandboxing applied by the service code
752 itself, nor that the service is actually vulnerable to remote or local attacks. High exposure levels do
753 indicate however that most likely the service might benefit from additional settings applied to
754 them.</para>
755
756 <para>Please note that many of the security and sandboxing settings individually can be circumvented —
757 unless combined with others. For example, if a service retains the privilege to establish or undo mount
758 points many of the sandboxing options can be undone by the service code itself. Due to that is
759 essential that each service uses the most comprehensive and strict sandboxing and security settings
760 possible. The tool will take into account some of these combinations and relationships between the
761 settings, but not all. Also note that the security and sandboxing settings analyzed here only apply to
762 the operations executed by the service code itself. If a service has access to an IPC system (such as
763 D-Bus) it might request operations from other services that are not subject to the same
764 restrictions. Any comprehensive security and sandboxing analysis is hence incomplete if the IPC access
765 policy is not validated too.</para>
766
767 <example>
b0343f8c 768 <title>Analyze <filename index="false">systemd-logind.service</filename></title>
d323a990
ZJS
769
770 <programlisting>$ systemd-analyze security --no-pager systemd-logind.service
771 NAME DESCRIPTION EXPOSURE
772✗ PrivateNetwork= Service has access to the host's network 0.5
773✗ User=/DynamicUser= Service runs as root user 0.4
774✗ DeviceAllow= Service has no device ACL 0.2
775✓ IPAddressDeny= Service blocks all IP address ranges
776...
777→ Overall exposure level for systemd-logind.service: 4.1 OK 🙂
778</programlisting>
779 </example>
780 </refsect2>
917e6554
LB
781
782 <refsect2>
783 <title><command>systemd-analyze inspect-elf <replaceable>FILE</replaceable>...</command></title>
784
0923b425 785 <para>This command will load the specified files, and if they are ELF objects (executables,
917e6554
LB
786 libraries, core files, etc.) it will parse the embedded packaging metadata, if any, and print
787 it in a table or json format. See the <ulink url="https://systemd.io/COREDUMP_PACKAGE_METADATA/">
788 Packaging Metadata</ulink> documentation for more information.</para>
789
790 <example>
791 <title>Table output</title>
792
793 <programlisting>$ systemd-analyze inspect-elf --json=pretty /tmp/core.fsverity.1000.f77dac5dc161402aa44e15b7dd9dcf97.58561.1637106137000000
794{
795 "elfType" : "coredump",
796 "elfArchitecture" : "AMD x86-64",
797 "/home/bluca/git/fsverity-utils/fsverity" : {
798 "type" : "deb",
799 "name" : "fsverity-utils",
800 "version" : "1.3-1",
801 "buildId" : "7c895ecd2a271f93e96268f479fdc3c64a2ec4ee"
802 },
803 "/home/bluca/git/fsverity-utils/libfsverity.so.0" : {
804 "type" : "deb",
805 "name" : "fsverity-utils",
806 "version" : "1.3-1",
807 "buildId" : "b5e428254abf14237b0ae70ed85fffbb98a78f88"
808 }
809}
810 </programlisting>
811 </example>
5f43c97c
LP
812 </refsect2>
813
814 <refsect2>
815 <title><command>systemd-analyze fdstore <optional><replaceable>UNIT</replaceable>...</optional></command></title>
816
817 <para>Lists the current contents of the specified service unit's file descriptor store. This shows
818 names, inode types, device numbers, inode numbers, paths and open modes of the open file
819 descriptors. The specified units must have <varname>FileDescriptorStoreMax=</varname> enabled, see
820 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
821 details.</para>
822
823 <example>
824 <title>Table output</title>
825 <programlisting>$ systemd-analyze fdstore systemd-journald.service
826FDNAME TYPE DEVNO INODE RDEVNO PATH FLAGS
827stored sock 0:8 4218620 - socket:[4218620] ro
828stored sock 0:8 4213198 - socket:[4213198] ro
829stored sock 0:8 4213190 - socket:[4213190] ro
830…</programlisting>
831 </example>
917e6554 832
5f43c97c
LP
833 <para>Note: the "DEVNO" column refers to the major/minor numbers of the device node backing the file
834 system the file descriptor's inode is on. The "RDEVNO" column refers to the major/minor numbers of the
835 device node itself if the file descriptor refers to one. Compare with corresponding
836 <varname>.st_dev</varname> and <varname>.st_rdev</varname> fields in <type>struct stat</type> (see
837 <citerefentry
838 project='man-pages'><refentrytitle>stat</refentrytitle><manvolnum>2</manvolnum></citerefentry> for
839 details). The listed inode numbers in the "INODE" column are on the file system indicated by
840 "DEVNO".</para>
917e6554 841 </refsect2>
5f43c97c 842
798d3a52
ZJS
843 </refsect1>
844
845 <refsect1>
846 <title>Options</title>
847
848 <para>The following options are understood:</para>
849
850 <variablelist>
28b35ef2
ZJS
851 <varlistentry>
852 <term><option>--system</option></term>
853
854 <listitem><para>Operates on the system systemd instance. This
855 is the implied default.</para></listitem>
856 </varlistentry>
857
798d3a52
ZJS
858 <varlistentry>
859 <term><option>--user</option></term>
860
861 <listitem><para>Operates on the user systemd
862 instance.</para></listitem>
863 </varlistentry>
864
865 <varlistentry>
28b35ef2 866 <term><option>--global</option></term>
798d3a52 867
28b35ef2
ZJS
868 <listitem><para>Operates on the system-wide configuration for
869 user systemd instance.</para></listitem>
798d3a52
ZJS
870 </varlistentry>
871
872 <varlistentry>
873 <term><option>--order</option></term>
874 <term><option>--require</option></term>
875
876 <listitem><para>When used in conjunction with the
877 <command>dot</command> command (see above), selects which
878 dependencies are shown in the dependency graph. If
879 <option>--order</option> is passed, only dependencies of type
880 <varname>After=</varname> or <varname>Before=</varname> are
881 shown. If <option>--require</option> is passed, only
882 dependencies of type <varname>Requires=</varname>,
798d3a52 883 <varname>Requisite=</varname>,
798d3a52
ZJS
884 <varname>Wants=</varname> and <varname>Conflicts=</varname>
885 are shown. If neither is passed, this shows dependencies of
886 all these types.</para></listitem>
887 </varlistentry>
888
889 <varlistentry>
890 <term><option>--from-pattern=</option></term>
891 <term><option>--to-pattern=</option></term>
892
893 <listitem><para>When used in conjunction with the
894 <command>dot</command> command (see above), this selects which
6ecb6cec
ZJS
895 relationships are shown in the dependency graph. Both options
896 require a
b7a47345 897 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
6ecb6cec
ZJS
898 pattern as an argument, which will be matched against the
899 left-hand and the right-hand, respectively, nodes of a
900 relationship.</para>
901
902 <para>Each of these can be used more than once, in which case
903 the unit name must match one of the values. When tests for
904 both sides of the relation are present, a relation must pass
905 both tests to be shown. When patterns are also specified as
906 positional arguments, they must match at least one side of the
907 relation. In other words, patterns specified with those two
908 options will trim the list of edges matched by the positional
909 arguments, if any are given, and fully determine the list of
910 edges shown otherwise.</para></listitem>
798d3a52
ZJS
911 </varlistentry>
912
913 <varlistentry>
914 <term><option>--fuzz=</option><replaceable>timespan</replaceable></term>
915
916 <listitem><para>When used in conjunction with the
917 <command>critical-chain</command> command (see above), also
918 show units, which finished <replaceable>timespan</replaceable>
919 earlier, than the latest unit in the same level. The unit of
920 <replaceable>timespan</replaceable> is seconds unless
921 specified with a different unit, e.g.
922 "50ms".</para></listitem>
923 </varlistentry>
924
925 <varlistentry>
641c0fd1 926 <term><option>--man=no</option></term>
798d3a52 927
e9dd6984
ZJS
928 <listitem><para>Do not invoke
929 <citerefentry project='man-pages'><refentrytitle>man</refentrytitle><manvolnum>1</manvolnum></citerefentry>
930 to verify the existence of man pages listed in <varname>Documentation=</varname>.</para></listitem>
798d3a52
ZJS
931 </varlistentry>
932
641c0fd1
ZJS
933 <varlistentry>
934 <term><option>--generators</option></term>
935
936 <listitem><para>Invoke unit generators, see
937 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
06815764
ZJS
938 Some generators require root privileges. Under a normal user, running with
939 generators enabled will generally result in some warnings.</para></listitem>
641c0fd1
ZJS
940 </varlistentry>
941
3cc3dc77
MG
942 <varlistentry>
943 <term><option>--recursive-errors=<replaceable>MODE</replaceable></option></term>
944
945 <listitem><para>Control verification of units and their dependencies and whether
946 <command>systemd-analyze verify</command> exits with a non-zero process exit status or not. With
947 <command>yes</command>, return a non-zero process exit status when warnings arise during verification
cae7c282
DDM
948 of either the specified unit or any of its associated dependencies. With <command>no</command>,
949 return a non-zero process exit status when warnings arise during verification of only the specified
950 unit. With <command>one</command>, return a non-zero process exit status when warnings arise during
951 verification of either the specified unit or its immediate dependencies. If this option is not
952 specified, zero is returned as the exit status regardless whether warnings arise during verification
953 or not.</para></listitem>
3cc3dc77
MG
954 </varlistentry>
955
46d8646a
ZJS
956 <varlistentry>
957 <term><option>--root=<replaceable>PATH</replaceable></option></term>
958
2a7cf953
MG
959 <listitem><para>With <command>cat-files</command> and <command>verify</command>,
960 operate on files underneath the specified root path <replaceable>PATH</replaceable>.</para></listitem>
46d8646a
ZJS
961 </varlistentry>
962
e5ea5c3a
MG
963 <varlistentry>
964 <term><option>--image=<replaceable>PATH</replaceable></option></term>
965
966 <listitem><para>With <command>cat-files</command> and <command>verify</command>,
967 operate on files inside the specified image path <replaceable>PATH</replaceable>.</para></listitem>
968 </varlistentry>
969
bb43d853
MG
970 <varlistentry>
971 <term><option>--offline=<replaceable>BOOL</replaceable></option></term>
972
973 <listitem><para>With <command>security</command>, perform an offline security review
0923b425 974 of the specified unit files, i.e. does not have to rely on PID 1 to acquire security
bb43d853
MG
975 information for the files like the <command>security</command> verb when used by itself does.
976 This means that <option>--offline=</option> can be used with <option>--root=</option> and
977 <option>--image=</option> as well. If a unit's overall exposure level is above that set by
978 <option>--threshold=</option> (default value is 100), <option>--offline=</option> will return
979 an error.</para></listitem>
980 </varlistentry>
981
04469211
LB
982 <varlistentry>
983 <term><option>--profile=<replaceable>PATH</replaceable></option></term>
984
985 <listitem><para>With <command>security</command> <option>--offline=</option>, takes into
0923b425 986 consideration the specified portable profile when assessing unit settings.
04469211
LB
987 The profile can be passed by name, in which case the well-known system locations will
988 be searched, or it can be the full path to a specific drop-in file.</para></listitem>
989 </varlistentry>
990
dfbda879
MG
991 <varlistentry>
992 <term><option>--threshold=<replaceable>NUMBER</replaceable></option></term>
993
994 <listitem><para>With <command>security</command>, allow the user to set a custom value
0923b425 995 to compare the overall exposure level with, for the specified unit files. If a unit's
dfbda879
MG
996 overall exposure level, is greater than that set by the user, <command>security</command>
997 will return an error. <option>--threshold=</option> can be used with <option>--offline=</option>
998 as well and its default value is 100.</para></listitem>
999 </varlistentry>
1000
ecfd082b
MG
1001 <varlistentry>
1002 <term><option>--security-policy=<replaceable>PATH</replaceable></option></term>
1003
1004 <listitem><para>With <command>security</command>, allow the user to define a custom set of
1005 requirements formatted as a JSON file against which to compare the specified unit file(s)
1006 and determine their overall exposure level to security threats.</para>
1007
1008 <table>
1009 <title>Accepted Assessment Test Identifiers</title>
1010
1011 <tgroup cols='1'>
1012 <colspec colname='directive' />
1013 <thead>
1014 <row>
1015 <entry>Assessment Test Identifier</entry>
1016 </row>
1017 </thead>
1018 <tbody>
1019 <row>
1020 <entry>UserOrDynamicUser</entry>
1021 </row>
1022 <row>
1023 <entry>SupplementaryGroups</entry>
1024 </row>
1025 <row>
1026 <entry>PrivateMounts</entry>
1027 </row>
1028 <row>
1029 <entry>PrivateDevices</entry>
1030 </row>
1031 <row>
1032 <entry>PrivateTmp</entry>
1033 </row>
1034 <row>
1035 <entry>PrivateNetwork</entry>
1036 </row>
1037 <row>
1038 <entry>PrivateUsers</entry>
1039 </row>
1040 <row>
1041 <entry>ProtectControlGroups</entry>
1042 </row>
1043 <row>
1044 <entry>ProtectKernelModules</entry>
1045 </row>
1046 <row>
1047 <entry>ProtectKernelTunables</entry>
1048 </row>
1049 <row>
1050 <entry>ProtectKernelLogs</entry>
1051 </row>
1052 <row>
1053 <entry>ProtectClock</entry>
1054 </row>
1055 <row>
1056 <entry>ProtectHome</entry>
1057 </row>
1058 <row>
1059 <entry>ProtectHostname</entry>
1060 </row>
1061 <row>
1062 <entry>ProtectSystem</entry>
1063 </row>
1064 <row>
1065 <entry>RootDirectoryOrRootImage</entry>
1066 </row>
1067 <row>
1068 <entry>LockPersonality</entry>
1069 </row>
1070 <row>
1071 <entry>MemoryDenyWriteExecute</entry>
1072 </row>
1073 <row>
1074 <entry>NoNewPrivileges</entry>
1075 </row>
1076 <row>
1077 <entry>CapabilityBoundingSet_CAP_SYS_ADMIN</entry>
1078 </row>
1079 <row>
1080 <entry>CapabilityBoundingSet_CAP_SET_UID_GID_PCAP</entry>
1081 </row>
1082 <row>
1083 <entry>CapabilityBoundingSet_CAP_SYS_PTRACE</entry>
1084 </row>
1085 <row>
1086 <entry>CapabilityBoundingSet_CAP_SYS_TIME</entry>
1087 </row>
1088 <row>
1089 <entry>CapabilityBoundingSet_CAP_NET_ADMIN</entry>
1090 </row>
1091 <row>
1092 <entry>CapabilityBoundingSet_CAP_SYS_RAWIO</entry>
1093 </row>
1094 <row>
1095 <entry>CapabilityBoundingSet_CAP_SYS_MODULE</entry>
1096 </row>
1097 <row>
1098 <entry>CapabilityBoundingSet_CAP_AUDIT</entry>
1099 </row>
1100 <row>
1101 <entry>CapabilityBoundingSet_CAP_SYSLOG</entry>
1102 </row>
1103 <row>
1104 <entry>CapabilityBoundingSet_CAP_SYS_NICE_RESOURCE</entry>
1105 </row>
1106 <row>
1107 <entry>CapabilityBoundingSet_CAP_MKNOD</entry>
1108 </row>
1109 <row>
1110 <entry>CapabilityBoundingSet_CAP_CHOWN_FSETID_SETFCAP</entry>
1111 </row>
1112 <row>
1113 <entry>CapabilityBoundingSet_CAP_DAC_FOWNER_IPC_OWNER</entry>
1114 </row>
1115 <row>
1116 <entry>CapabilityBoundingSet_CAP_KILL</entry>
1117 </row>
1118 <row>
1119 <entry>CapabilityBoundingSet_CAP_NET_BIND_SERVICE_BROADCAST_RAW</entry>
1120 </row>
1121 <row>
1122 <entry>CapabilityBoundingSet_CAP_SYS_BOOT</entry>
1123 </row>
1124 <row>
1125 <entry>CapabilityBoundingSet_CAP_MAC</entry>
1126 </row>
1127 <row>
1128 <entry>CapabilityBoundingSet_CAP_LINUX_IMMUTABLE</entry>
1129 </row>
1130 <row>
1131 <entry>CapabilityBoundingSet_CAP_IPC_LOCK</entry>
1132 </row>
1133 <row>
1134 <entry>CapabilityBoundingSet_CAP_SYS_CHROOT</entry>
1135 </row>
1136 <row>
1137 <entry>CapabilityBoundingSet_CAP_BLOCK_SUSPEND</entry>
1138 </row>
1139 <row>
1140 <entry>CapabilityBoundingSet_CAP_WAKE_ALARM</entry>
1141 </row>
1142 <row>
1143 <entry>CapabilityBoundingSet_CAP_LEASE</entry>
1144 </row>
1145 <row>
1146 <entry>CapabilityBoundingSet_CAP_SYS_TTY_CONFIG</entry>
1147 </row>
1148 <row>
1149 <entry>UMask</entry>
1150 </row>
1151 <row>
1152 <entry>KeyringMode</entry>
1153 </row>
1154 <row>
1155 <entry>ProtectProc</entry>
1156 </row>
1157 <row>
1158 <entry>ProcSubset</entry>
1159 </row>
1160 <row>
1161 <entry>NotifyAccess</entry>
1162 </row>
1163 <row>
1164 <entry>RemoveIPC</entry>
1165 </row>
1166 <row>
1167 <entry>Delegate</entry>
1168 </row>
1169 <row>
1170 <entry>RestrictRealtime</entry>
1171 </row>
1172 <row>
1173 <entry>RestrictSUIDSGID</entry>
1174 </row>
1175 <row>
c1e6f215 1176 <entry>RestrictNamespaces_user</entry>
ecfd082b
MG
1177 </row>
1178 <row>
c1e6f215 1179 <entry>RestrictNamespaces_mnt</entry>
ecfd082b
MG
1180 </row>
1181 <row>
c1e6f215 1182 <entry>RestrictNamespaces_ipc</entry>
ecfd082b
MG
1183 </row>
1184 <row>
c1e6f215 1185 <entry>RestrictNamespaces_pid</entry>
ecfd082b
MG
1186 </row>
1187 <row>
c1e6f215 1188 <entry>RestrictNamespaces_cgroup</entry>
ecfd082b
MG
1189 </row>
1190 <row>
c1e6f215 1191 <entry>RestrictNamespaces_uts</entry>
ecfd082b
MG
1192 </row>
1193 <row>
c1e6f215 1194 <entry>RestrictNamespaces_net</entry>
ecfd082b
MG
1195 </row>
1196 <row>
1197 <entry>RestrictAddressFamilies_AF_INET_INET6</entry>
1198 </row>
1199 <row>
1200 <entry>RestrictAddressFamilies_AF_UNIX</entry>
1201 </row>
1202 <row>
1203 <entry>RestrictAddressFamilies_AF_NETLINK</entry>
1204 </row>
1205 <row>
1206 <entry>RestrictAddressFamilies_AF_PACKET</entry>
1207 </row>
1208 <row>
1209 <entry>RestrictAddressFamilies_OTHER</entry>
1210 </row>
1211 <row>
1212 <entry>SystemCallArchitectures</entry>
1213 </row>
1214 <row>
1215 <entry>SystemCallFilter_swap</entry>
1216 </row>
1217 <row>
1218 <entry>SystemCallFilter_obsolete</entry>
1219 </row>
1220 <row>
1221 <entry>SystemCallFilter_clock</entry>
1222 </row>
1223 <row>
1224 <entry>SystemCallFilter_cpu_emulation</entry>
1225 </row>
1226 <row>
1227 <entry>SystemCallFilter_debug</entry>
1228 </row>
1229 <row>
1230 <entry>SystemCallFilter_mount</entry>
1231 </row>
1232 <row>
1233 <entry>SystemCallFilter_module</entry>
1234 </row>
1235 <row>
1236 <entry>SystemCallFilter_raw_io</entry>
1237 </row>
1238 <row>
1239 <entry>SystemCallFilter_reboot</entry>
1240 </row>
1241 <row>
1242 <entry>SystemCallFilter_privileged</entry>
1243 </row>
1244 <row>
1245 <entry>SystemCallFilter_resources</entry>
1246 </row>
1247 <row>
1248 <entry>IPAddressDeny</entry>
1249 </row>
1250 <row>
1251 <entry>DeviceAllow</entry>
1252 </row>
1253 <row>
1254 <entry>AmbientCapabilities</entry>
1255 </row>
1256 </tbody>
1257 </tgroup>
1258 </table>
1259
e6ce1951 1260 <para>See example "JSON Policy" below.</para></listitem>
ecfd082b
MG
1261 </varlistentry>
1262
4b4a8ef7
MG
1263 <varlistentry>
1264 <term><option>--json=<replaceable>MODE</replaceable></option></term>
1265
1266 <listitem><para>With the <command>security</command> command, generate a JSON formatted
1267 output of the security analysis table. The format is a JSON array with objects
1268 containing the following fields: <varname>set</varname> which indicates if the setting has
1269 been enabled or not, <varname>name</varname> which is what is used to refer to the setting,
1270 <varname>json_field</varname> which is the JSON compatible identifier of the setting,
1271 <varname>description</varname> which is an outline of the setting state, and
1272 <varname>exposure</varname> which is a number in the range 0.0…10.0, where a higher value
1273 corresponds to a higher security threat. The JSON version of the table is printed to standard
1274 output. The <replaceable>MODE</replaceable> passed to the option can be one of three:
1275 <option>off</option> which is the default, <option>pretty</option> and <option>short</option>
dc57a338 1276 which respectively output a prettified or shorted JSON version of the security table.
1277
d09df6b9 1278 With the <command>plot</command> command, generate a JSON formatted output of the raw time data.
dc57a338 1279 The format is a JSON array with objects containing the following fields: <varname>name</varname>
1280 which is the unit name, <varname>activated</varname> which is the time after startup the
1281 service was activated, <varname>activating</varname> which is how long after startup the service
1282 was initially started, <varname>time</varname> which is how long the service took to activate
1283 from when it was initially started, <varname>deactivated</varname> which is the time after startup
d09df6b9 1284 that the service was deactivated, <varname>deactivating</varname> which is the time after startup
dc57a338 1285 that the service was initially told to deactivate.
1286 </para></listitem>
4b4a8ef7
MG
1287 </varlistentry>
1288
f2ccf832
LP
1289 <varlistentry>
1290 <term><option>--iterations=<replaceable>NUMBER</replaceable></option></term>
1291
1292 <listitem><para>When used with the <command>calendar</command> command, show the specified number of
1293 iterations the specified calendar expression will elapse next. Defaults to 1.</para></listitem>
1294 </varlistentry>
1295
92e6a99d
LP
1296 <varlistentry>
1297 <term><option>--base-time=<replaceable>TIMESTAMP</replaceable></option></term>
1298
1299 <listitem><para>When used with the <command>calendar</command> command, show next iterations relative
1300 to the specified point in time. If not specified defaults to the current time.</para></listitem>
1301 </varlistentry>
1302
8de7929d
DDM
1303 <varlistentry>
1304 <term><option>--unit=<replaceable>UNIT</replaceable></option></term>
1305
1306 <listitem><para>When used with the <command>condition</command> command, evaluate all the
1307 <varname index="false">Condition*=...</varname> and <varname index="false">Assert*=...</varname>
1308 assignments in the specified unit file. The full unit search path is formed by combining the
1309 directories for the specified unit with the usual unit load paths. The variable
1310 <varname>$SYSTEMD_UNIT_PATH</varname> is supported, and may be used to replace or augment the
1311 compiled in set of unit load paths; see
1312 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. All
1313 units files present in the directory containing the specified unit will be used in preference to the
1314 other paths.</para></listitem>
1315 </varlistentry>
1316
dc57a338 1317 <varlistentry>
1318 <term><option>--table</option></term>
1319
1320 <listitem><para>When used with the <command>plot</command> command, the raw time data is output in a table.
1321 </para></listitem>
1322 </varlistentry>
1323
1324 <varlistentry>
1325 <term><option>--no-legend</option></term>
1326
1327 <listitem><para>When used with the <command>plot</command> command in combination with either
1328 <option>--table</option> or <option>--json=</option>, no legends or hints are included in the output.
1329 </para></listitem>
1330 </varlistentry>
1331
798d3a52
ZJS
1332 <xi:include href="user-system-options.xml" xpointer="host" />
1333 <xi:include href="user-system-options.xml" xpointer="machine" />
1334
52117f5a
ZJS
1335 <varlistentry>
1336 <term><option>--quiet</option></term>
1337
1338 <listitem><para>Suppress hints and other non-essential output.</para></listitem>
1339 </varlistentry>
1340
798d3a52
ZJS
1341 <xi:include href="standard-options.xml" xpointer="help" />
1342 <xi:include href="standard-options.xml" xpointer="version" />
1343 <xi:include href="standard-options.xml" xpointer="no-pager" />
1344 </variablelist>
1345
1346 </refsect1>
1347
1348 <refsect1>
1349 <title>Exit status</title>
1350
bc012a3e
ZJS
1351 <para>For most commands, 0 is returned on success, and a non-zero failure code otherwise.</para>
1352
1353 <para>With the verb <command>compare-versions</command>, in the two-argument form,
1354 <constant>12</constant>, <constant>0</constant>, <constant>11</constant> is returned if the second
1355 version string is respectively larger, equal, or smaller to the first. In the three-argument form,
1356 <constant>0</constant> or <constant>1</constant> if the condition is respectively true or false.</para>
798d3a52
ZJS
1357 </refsect1>
1358
4ef3ca34 1359 <xi:include href="common-variables.xml" />
798d3a52 1360
e6ce1951
ZJS
1361 <refsect1>
1362 <title>Examples</title>
1363
1364 <example>
1365 <title>JSON Policy</title>
1366
1367 <para>The JSON file passed as a path parameter to <option>--security-policy=</option> has a top-level
1368 JSON object, with keys being the assessment test identifiers mentioned above. The values in the file
1369 should be JSON objects with one or more of the following fields: <option>description_na</option>
1370 (string), <option>description_good</option> (string), <option>description_bad</option> (string),
1371 <option>weight</option> (unsigned integer), and <option>range</option> (unsigned integer). If any of
1372 these fields corresponding to a specific id of the unit file is missing from the JSON object, the
1373 default built-in field value corresponding to that same id is used for security analysis as default.
1374 The weight and range fields are used in determining the overall exposure level of the unit files: the
1375 value of each setting is assigned a badness score, which is multiplied by the policy weight and divided
1376 by the policy range to determine the overall exposure that the setting implies. The computed badness is
1377 summed across all settings in the unit file, normalized to the 1…100 range, and used to determine the
1378 overall exposure level of the unit. By allowing users to manipulate these fields, the 'security' verb
1379 gives them the option to decide for themself which ids are more important and hence should have a
1380 greater effect on the exposure level. A weight of <literal>0</literal> means the setting will not be
1381 checked.</para>
1382
1383 <programlisting>
1384{
1385 "PrivateDevices":
1386 {
1387 "description_good": "Service has no access to hardware devices",
1388 "description_bad": "Service potentially has access to hardware devices",
1389 "weight": 1000,
1390 "range": 1
1391 },
1392 "PrivateMounts":
1393 {
1394 "description_good": "Service cannot install system mounts",
1395 "description_bad": "Service may install system mounts",
1396 "weight": 1000,
1397 "range": 1
1398 },
1399 "PrivateNetwork":
1400 {
1401 "description_good": "Service has no access to the host's network",
1402 "description_bad": "Service has access to the host's network",
1403 "weight": 2500,
1404 "range": 1
1405 },
1406 "PrivateTmp":
1407 {
1408 "description_good": "Service has no access to other software's temporary files",
1409 "description_bad": "Service has access to other software's temporary files",
1410 "weight": 1000,
1411 "range": 1
1412 },
1413 "PrivateUsers":
1414 {
1415 "description_good": "Service does not have access to other users",
1416 "description_bad": "Service has access to other users",
1417 "weight": 1000,
1418 "range": 1
1419 }
1420}
1421 </programlisting>
1422 </example>
1423 </refsect1>
1424
798d3a52
ZJS
1425 <refsect1>
1426 <title>See Also</title>
1427 <para>
1428 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1429 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1430 </para>
1431 </refsect1>
359deb60
LP
1432
1433</refentry>