| 1 |
<?xml version='1.0'?> <!--*-nxml-*--> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="systemd-analyze" conditional='ENABLE_ANALYZE' |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>systemd-analyze</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>systemd-analyze</refentrytitle> |
| 16 |
<manvolnum>1</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>systemd-analyze</refname> |
| 21 |
<refpurpose>Analyze and debug system manager</refpurpose> |
| 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> |
| 41 |
|
| 42 |
<cmdsynopsis> |
| 43 |
<command>systemd-analyze</command> |
| 44 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 45 |
<arg choice="plain">dump</arg> |
| 46 |
<arg choice="opt" rep="repeat"><replaceable>PATTERN</replaceable></arg> |
| 47 |
</cmdsynopsis> |
| 48 |
|
| 49 |
<cmdsynopsis> |
| 50 |
<command>systemd-analyze</command> |
| 51 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 52 |
<arg choice="plain">plot</arg> |
| 53 |
<arg choice="opt">>file.svg</arg> |
| 54 |
</cmdsynopsis> |
| 55 |
<cmdsynopsis> |
| 56 |
<command>systemd-analyze</command> |
| 57 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 58 |
<arg choice="plain">dot</arg> |
| 59 |
<arg choice="opt" rep="repeat"><replaceable>PATTERN</replaceable></arg> |
| 60 |
<arg choice="opt">>file.dot</arg> |
| 61 |
</cmdsynopsis> |
| 62 |
|
| 63 |
<cmdsynopsis> |
| 64 |
<command>systemd-analyze</command> |
| 65 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 66 |
<arg choice="plain">unit-files</arg> |
| 67 |
</cmdsynopsis> |
| 68 |
<cmdsynopsis> |
| 69 |
<command>systemd-analyze</command> |
| 70 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 71 |
<arg choice="plain">unit-gdb</arg> |
| 72 |
<arg choice="plain"><replaceable>SERVICE</replaceable></arg> |
| 73 |
</cmdsynopsis> |
| 74 |
<cmdsynopsis> |
| 75 |
<command>systemd-analyze</command> |
| 76 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 77 |
<arg choice="plain">unit-paths</arg> |
| 78 |
</cmdsynopsis> |
| 79 |
<cmdsynopsis> |
| 80 |
<command>systemd-analyze</command> |
| 81 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 82 |
<arg choice="plain">unit-shell</arg> |
| 83 |
<arg choice="plain"><replaceable>SERVICE</replaceable></arg> |
| 84 |
<arg choice="opt" rep="repeat"><replaceable>COMMAND</replaceable></arg> |
| 85 |
</cmdsynopsis> |
| 86 |
<cmdsynopsis> |
| 87 |
<command>systemd-analyze</command> |
| 88 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 89 |
<arg choice="plain">exit-status</arg> |
| 90 |
<arg choice="opt" rep="repeat"><replaceable>STATUS</replaceable></arg> |
| 91 |
</cmdsynopsis> |
| 92 |
<cmdsynopsis> |
| 93 |
<command>systemd-analyze</command> |
| 94 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 95 |
<arg choice="plain">capability</arg> |
| 96 |
<group choice="opt"> |
| 97 |
<arg choice="plain" rep="repeat"><replaceable>CAPABILITY</replaceable></arg> |
| 98 |
<arg choice="plain"> |
| 99 |
<group choice="req"> |
| 100 |
<arg choice="plain">-m</arg> |
| 101 |
<arg choice="plain">--mask</arg> |
| 102 |
</group> |
| 103 |
<replaceable>MASK</replaceable> |
| 104 |
</arg> |
| 105 |
</group> |
| 106 |
</cmdsynopsis> |
| 107 |
<cmdsynopsis> |
| 108 |
<command>systemd-analyze</command> |
| 109 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 110 |
<arg choice="plain">condition</arg> |
| 111 |
<arg choice="plain"><replaceable>CONDITION</replaceable>…</arg> |
| 112 |
</cmdsynopsis> |
| 113 |
<cmdsynopsis> |
| 114 |
<command>systemd-analyze</command> |
| 115 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 116 |
<arg choice="plain">syscall-filter</arg> |
| 117 |
<arg choice="opt"><replaceable>SET</replaceable>…</arg> |
| 118 |
</cmdsynopsis> |
| 119 |
<cmdsynopsis> |
| 120 |
<command>systemd-analyze</command> |
| 121 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 122 |
<arg choice="plain">filesystems</arg> |
| 123 |
<arg choice="opt"><replaceable>SET</replaceable>…</arg> |
| 124 |
</cmdsynopsis> |
| 125 |
<cmdsynopsis> |
| 126 |
<command>systemd-analyze</command> |
| 127 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 128 |
<arg choice="plain">calendar</arg> |
| 129 |
<arg choice="plain" rep="repeat"><replaceable>SPEC</replaceable></arg> |
| 130 |
</cmdsynopsis> |
| 131 |
<cmdsynopsis> |
| 132 |
<command>systemd-analyze</command> |
| 133 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 134 |
<arg choice="plain">timestamp</arg> |
| 135 |
<arg choice="plain" rep="repeat"><replaceable>TIMESTAMP</replaceable></arg> |
| 136 |
</cmdsynopsis> |
| 137 |
<cmdsynopsis> |
| 138 |
<command>systemd-analyze</command> |
| 139 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 140 |
<arg choice="plain">timespan</arg> |
| 141 |
<arg choice="plain" rep="repeat"><replaceable>SPAN</replaceable></arg> |
| 142 |
</cmdsynopsis> |
| 143 |
<cmdsynopsis> |
| 144 |
<command>systemd-analyze</command> |
| 145 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 146 |
<arg choice="plain">cat-config</arg> |
| 147 |
<arg choice="plain" rep="repeat"><replaceable>NAME</replaceable>|<replaceable>PATH</replaceable></arg> |
| 148 |
</cmdsynopsis> |
| 149 |
<cmdsynopsis> |
| 150 |
<command>systemd-analyze</command> |
| 151 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 152 |
<arg choice="plain">compare-versions</arg> |
| 153 |
<arg choice="plain"><replaceable>VERSION1</replaceable></arg> |
| 154 |
<arg choice="opt"><replaceable>OP</replaceable></arg> |
| 155 |
<arg choice="plain"><replaceable>VERSION2</replaceable></arg> |
| 156 |
</cmdsynopsis> |
| 157 |
<cmdsynopsis> |
| 158 |
<command>systemd-analyze</command> |
| 159 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 160 |
<arg choice="plain">verify</arg> |
| 161 |
<arg choice="plain" rep="repeat"><replaceable>FILE</replaceable></arg> |
| 162 |
</cmdsynopsis> |
| 163 |
<cmdsynopsis> |
| 164 |
<command>systemd-analyze</command> |
| 165 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 166 |
<arg choice="plain">security</arg> |
| 167 |
<arg choice="opt" rep="repeat"><replaceable>UNIT</replaceable></arg> |
| 168 |
</cmdsynopsis> |
| 169 |
<cmdsynopsis> |
| 170 |
<command>systemd-analyze</command> |
| 171 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 172 |
<arg choice="plain">inspect-elf</arg> |
| 173 |
<arg choice="plain" rep="repeat"><replaceable>FILE</replaceable></arg> |
| 174 |
</cmdsynopsis> |
| 175 |
<cmdsynopsis> |
| 176 |
<command>systemd-analyze</command> |
| 177 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 178 |
<arg choice="plain">malloc</arg> |
| 179 |
<arg choice="opt" rep="repeat"><replaceable>D-BUS SERVICE</replaceable></arg> |
| 180 |
</cmdsynopsis> |
| 181 |
<cmdsynopsis> |
| 182 |
<command>systemd-analyze</command> |
| 183 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 184 |
<arg choice="plain">fdstore</arg> |
| 185 |
<arg choice="plain" rep="repeat"><replaceable>UNIT</replaceable></arg> |
| 186 |
</cmdsynopsis> |
| 187 |
<cmdsynopsis> |
| 188 |
<command>systemd-analyze</command> |
| 189 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 190 |
<arg choice="plain">image-policy</arg> |
| 191 |
<arg choice="plain" rep="repeat"><replaceable>POLICY</replaceable></arg> |
| 192 |
</cmdsynopsis> |
| 193 |
<cmdsynopsis> |
| 194 |
<command>systemd-analyze</command> |
| 195 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 196 |
<arg choice="plain">has-tpm2</arg> |
| 197 |
</cmdsynopsis> |
| 198 |
<cmdsynopsis> |
| 199 |
<command>systemd-analyze</command> |
| 200 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 201 |
<arg choice="plain">identify-tpm2</arg> |
| 202 |
</cmdsynopsis> |
| 203 |
<cmdsynopsis> |
| 204 |
<command>systemd-analyze</command> |
| 205 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 206 |
<arg choice="plain">pcrs</arg> |
| 207 |
<arg choice="opt" rep="repeat"><replaceable>PCR</replaceable></arg> |
| 208 |
</cmdsynopsis> |
| 209 |
<cmdsynopsis> |
| 210 |
<command>systemd-analyze</command> |
| 211 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 212 |
<arg choice="plain">nvpcrs</arg> |
| 213 |
<arg choice="opt" rep="repeat"><replaceable>NVPCR</replaceable></arg> |
| 214 |
</cmdsynopsis> |
| 215 |
<cmdsynopsis> |
| 216 |
<command>systemd-analyze</command> |
| 217 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 218 |
<arg choice="plain">srk</arg> |
| 219 |
<arg choice="opt"><replaceable>>FILE</replaceable></arg> |
| 220 |
</cmdsynopsis> |
| 221 |
<cmdsynopsis> |
| 222 |
<command>systemd-analyze</command> |
| 223 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 224 |
<arg choice="plain">architectures</arg> |
| 225 |
<arg choice="opt" rep="repeat"><replaceable>NAME</replaceable></arg> |
| 226 |
</cmdsynopsis> |
| 227 |
<cmdsynopsis> |
| 228 |
<command>systemd-analyze</command> |
| 229 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 230 |
<arg choice="plain">smbios11</arg> |
| 231 |
</cmdsynopsis> |
| 232 |
<cmdsynopsis> |
| 233 |
<command>systemd-analyze</command> |
| 234 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 235 |
<arg choice="plain">chid</arg> |
| 236 |
</cmdsynopsis> |
| 237 |
<cmdsynopsis> |
| 238 |
<command>systemd-analyze</command> |
| 239 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 240 |
<arg choice="plain">transient-settings</arg> |
| 241 |
<arg choice="plain" rep="repeat"><replaceable>TYPE</replaceable></arg> |
| 242 |
</cmdsynopsis> |
| 243 |
</refsynopsisdiv> |
| 244 |
|
| 245 |
<refsect1> |
| 246 |
<title>Description</title> |
| 247 |
|
| 248 |
<para><command>systemd-analyze</command> may be used to determine |
| 249 |
system boot-up performance statistics and retrieve other state and |
| 250 |
tracing information from the system and service manager, and to |
| 251 |
verify the correctness of unit files. It is also used to access |
| 252 |
special functions useful for advanced system manager debugging.</para> |
| 253 |
|
| 254 |
<para>If no command is passed, <command>systemd-analyze |
| 255 |
time</command> is implied.</para> |
| 256 |
|
| 257 |
<refsect2> |
| 258 |
<title><command>systemd-analyze time</command></title> |
| 259 |
|
| 260 |
<para>This command prints the time spent in the kernel before userspace has been reached, the time |
| 261 |
spent in the initrd before normal system userspace has been reached, and the time normal system |
| 262 |
userspace took to initialize. Note that these measurements simply measure the time passed up to the |
| 263 |
point where all system services have been spawned, but not necessarily until they fully finished |
| 264 |
initialization or the disk is idle.</para> |
| 265 |
|
| 266 |
<example> |
| 267 |
<title><command>Show how long the boot took</command></title> |
| 268 |
|
| 269 |
<programlisting># in a container |
| 270 |
$ systemd-analyze time |
| 271 |
Startup finished in 296ms (userspace) |
| 272 |
multi-user.target reached after 275ms in userspace |
| 273 |
|
| 274 |
# on a real machine |
| 275 |
$ systemd-analyze time |
| 276 |
Startup finished in 2.584s (kernel) + 19.176s (initrd) + 47.847s (userspace) = 1min 9.608s |
| 277 |
multi-user.target reached after 47.820s in userspace |
| 278 |
</programlisting> |
| 279 |
</example> |
| 280 |
</refsect2> |
| 281 |
|
| 282 |
<refsect2> |
| 283 |
<title><command>systemd-analyze blame</command></title> |
| 284 |
|
| 285 |
<para>This command prints a list of all running units, ordered by the time they took to initialize. |
| 286 |
This information may be used to optimize boot-up times. Note that the output might be misleading as the |
| 287 |
initialization of one service might be slow simply because it waits for the initialization of another |
| 288 |
service to complete. Also note: <command>systemd-analyze blame</command> does not display results for |
| 289 |
services with <varname>Type=simple</varname>, because systemd considers such services to be started |
| 290 |
immediately, hence no measurement of the initialization delays can be done. Also note that this command |
| 291 |
only shows the time units took for starting up, it does not show how long unit jobs spent in the |
| 292 |
execution queue. In particular it shows the time units spent in <literal>activating</literal> state, |
| 293 |
which is not defined for units such as device units that transition directly from |
| 294 |
<literal>inactive</literal> to <literal>active</literal>. This command hence gives an impression of the |
| 295 |
performance of program code, but cannot accurately reflect latency introduced by waiting for |
| 296 |
hardware and similar events.</para> |
| 297 |
|
| 298 |
<example> |
| 299 |
<title><command>Show which units took the most time during boot</command></title> |
| 300 |
|
| 301 |
<programlisting>$ systemd-analyze blame |
| 302 |
32.875s pmlogger.service |
| 303 |
20.905s systemd-networkd-wait-online.service |
| 304 |
13.299s dev-vda1.device |
| 305 |
... |
| 306 |
23ms sysroot.mount |
| 307 |
11ms initrd-udevadm-cleanup-db.service |
| 308 |
3ms sys-kernel-config.mount |
| 309 |
</programlisting> |
| 310 |
</example> |
| 311 |
</refsect2> |
| 312 |
|
| 313 |
<refsect2> |
| 314 |
<title><command>systemd-analyze critical-chain <optional><replaceable>UNIT</replaceable>...</optional></command></title> |
| 315 |
|
| 316 |
<para>This command prints a tree of the time-critical chain of units (for each of the specified |
| 317 |
<replaceable>UNIT</replaceable>s or for the default target otherwise). The time after the unit is |
| 318 |
active or started is printed after the "@" character. The time the unit takes to start is printed after |
| 319 |
the "+" character. Note that the output might be misleading as the initialization of services might |
| 320 |
depend on socket activation and because of the parallel execution of units. Also, similarly to the |
| 321 |
<command>blame</command> command, this only takes into account the time units spent in |
| 322 |
<literal>activating</literal> state, and hence does not cover units that never went through an |
| 323 |
<literal>activating</literal> state (such as device units that transition directly from |
| 324 |
<literal>inactive</literal> to <literal>active</literal>). Moreover, it does not show information on |
| 325 |
jobs (and in particular not jobs that timed out).</para> |
| 326 |
|
| 327 |
<example> |
| 328 |
<title><command>systemd-analyze critical-chain</command></title> |
| 329 |
|
| 330 |
<programlisting>$ systemd-analyze critical-chain |
| 331 |
multi-user.target @47.820s |
| 332 |
└─pmie.service @35.968s +548ms |
| 333 |
└─pmcd.service @33.715s +2.247s |
| 334 |
└─network-online.target @33.712s |
| 335 |
└─systemd-networkd-wait-online.service @12.804s +20.905s |
| 336 |
└─systemd-networkd.service @11.109s +1.690s |
| 337 |
└─systemd-udevd.service @9.201s +1.904s |
| 338 |
└─systemd-tmpfiles-setup-dev.service @7.306s +1.776s |
| 339 |
└─kmod-static-nodes.service @6.976s +177ms |
| 340 |
└─systemd-journald.socket |
| 341 |
└─system.slice |
| 342 |
└─-.slice |
| 343 |
</programlisting> |
| 344 |
</example> |
| 345 |
</refsect2> |
| 346 |
|
| 347 |
<refsect2> |
| 348 |
<title><command>systemd-analyze dump [<replaceable>pattern</replaceable>…]</command></title> |
| 349 |
|
| 350 |
<para>Without any parameter, this command outputs a (usually very long) human-readable serialization of |
| 351 |
the complete service manager state. Optional glob pattern may be specified, causing the output to be |
| 352 |
limited to units whose names match one of the patterns. The output format is subject to change without |
| 353 |
notice and should not be parsed by applications. This command is rate limited for unprivileged users.</para> |
| 354 |
|
| 355 |
<example> |
| 356 |
<title>Show the internal state of user manager</title> |
| 357 |
|
| 358 |
<programlisting>$ systemd-analyze --user dump |
| 359 |
Timestamp userspace: Thu 2019-03-14 23:28:07 CET |
| 360 |
Timestamp finish: Thu 2019-03-14 23:28:07 CET |
| 361 |
Timestamp generators-start: Thu 2019-03-14 23:28:07 CET |
| 362 |
Timestamp generators-finish: Thu 2019-03-14 23:28:07 CET |
| 363 |
Timestamp units-load-start: Thu 2019-03-14 23:28:07 CET |
| 364 |
Timestamp units-load-finish: Thu 2019-03-14 23:28:07 CET |
| 365 |
-> Unit proc-timer_list.mount: |
| 366 |
Description: /proc/timer_list |
| 367 |
... |
| 368 |
-> Unit default.target: |
| 369 |
Description: Main user target |
| 370 |
... |
| 371 |
</programlisting> |
| 372 |
</example> |
| 373 |
</refsect2> |
| 374 |
|
| 375 |
<refsect2> |
| 376 |
<title><command>systemd-analyze malloc [<replaceable>D-Bus service</replaceable>…]</command></title> |
| 377 |
|
| 378 |
<para>This command can be used to request the output of the internal memory state (as returned by |
| 379 |
<citerefentry project='man-pages'><refentrytitle>malloc_info</refentrytitle><manvolnum>3</manvolnum></citerefentry>) |
| 380 |
of a D-Bus service. If no service is specified, the query will be sent to |
| 381 |
<filename>org.freedesktop.systemd1</filename> (the system or user service manager). The output format |
| 382 |
is not guaranteed to be stable and should not be parsed by applications.</para> |
| 383 |
|
| 384 |
<para>The service must implement the <filename>org.freedesktop.MemoryAllocation1</filename> interface. |
| 385 |
In the systemd suite, it is currently only implemented by the manager.</para> |
| 386 |
</refsect2> |
| 387 |
|
| 388 |
<refsect2> |
| 389 |
<title><command>systemd-analyze plot</command></title> |
| 390 |
|
| 391 |
<para>This command prints either an SVG graphic, detailing which system services have been started at what |
| 392 |
time, highlighting the time they spent on initialization, or the raw time data in JSON or table format.</para> |
| 393 |
|
| 394 |
<example> |
| 395 |
<title><command>Plot a bootchart</command></title> |
| 396 |
|
| 397 |
<programlisting>$ systemd-analyze plot >bootup.svg |
| 398 |
$ eog bootup.svg& |
| 399 |
</programlisting> |
| 400 |
</example> |
| 401 |
|
| 402 |
<para>Note that this plot is based on the most recent per-unit timing data of loaded units. This means |
| 403 |
that if a unit gets started, then stopped and then started again the information shown will cover the |
| 404 |
most recent start cycle, not the first one. Thus it is recommended to consult this information only |
| 405 |
shortly after boot, so that this distinction does not matter. Moreover, units that are not referenced by |
| 406 |
any other unit through a dependency might be unloaded by the service manager once they terminate (and |
| 407 |
did not fail). Such units will not show up in the plot.</para> |
| 408 |
</refsect2> |
| 409 |
|
| 410 |
<refsect2> |
| 411 |
<title><command>systemd-analyze dot [<replaceable>pattern</replaceable>...]</command></title> |
| 412 |
|
| 413 |
<para>This command generates textual dependency graph description in dot format for further processing |
| 414 |
with the GraphViz |
| 415 |
<citerefentry project='die-net'><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 416 |
tool. Use a command line like <command>systemd-analyze dot | dot -Tsvg >systemd.svg</command> to |
| 417 |
generate a graphical dependency tree. Unless <option>--order</option> or <option>--require</option> is |
| 418 |
passed, the generated graph will show both ordering and requirement dependencies. Optional pattern |
| 419 |
globbing style specifications (e.g. <filename>*.target</filename>) may be given at the end. A unit |
| 420 |
dependency is included in the graph if any of these patterns match either the origin or destination |
| 421 |
node.</para> |
| 422 |
|
| 423 |
<example> |
| 424 |
<title>Plot all dependencies of any unit whose name starts with <literal>avahi-daemon</literal> |
| 425 |
</title> |
| 426 |
|
| 427 |
<programlisting>$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg >avahi.svg |
| 428 |
$ eog avahi.svg</programlisting> |
| 429 |
</example> |
| 430 |
|
| 431 |
<example> |
| 432 |
<title>Plot the dependencies between all known target units</title> |
| 433 |
|
| 434 |
<programlisting>$ systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' \ |
| 435 |
| dot -Tsvg >targets.svg |
| 436 |
$ eog targets.svg</programlisting> |
| 437 |
</example> |
| 438 |
</refsect2> |
| 439 |
|
| 440 |
<refsect2> |
| 441 |
<title><command>systemd-analyze unit-paths</command></title> |
| 442 |
|
| 443 |
<para>This command outputs a list of all directories from which unit files, <filename>.d</filename> |
| 444 |
overrides, and <filename>.wants</filename>, <filename>.requires</filename> symlinks may be |
| 445 |
loaded. Combine with <option>--user</option> to retrieve the list for the user manager instance, and |
| 446 |
<option>--global</option> for the global configuration of user manager instances.</para> |
| 447 |
|
| 448 |
<example> |
| 449 |
<title><command>Show all paths for generated units</command></title> |
| 450 |
|
| 451 |
<programlisting>$ systemd-analyze unit-paths | grep '^/run' |
| 452 |
/run/systemd/system.control |
| 453 |
/run/systemd/transient |
| 454 |
/run/systemd/generator.early |
| 455 |
/run/systemd/system |
| 456 |
/run/systemd/system.attached |
| 457 |
/run/systemd/generator |
| 458 |
/run/systemd/generator.late |
| 459 |
</programlisting> |
| 460 |
</example> |
| 461 |
|
| 462 |
<para>Note that this verb prints the list that is compiled into <command>systemd-analyze</command> |
| 463 |
itself, and does not communicate with the running manager. Use |
| 464 |
<programlisting>systemctl [--user] [--global] show -p UnitPath --value</programlisting> |
| 465 |
to retrieve the actual list that the manager uses, with any empty directories omitted.</para> |
| 466 |
</refsect2> |
| 467 |
|
| 468 |
<refsect2> |
| 469 |
<title><command>systemd-analyze exit-status <optional><replaceable>STATUS</replaceable>...</optional></command></title> |
| 470 |
|
| 471 |
<para>This command prints a list of exit statuses along with their "class", i.e. the source of the |
| 472 |
definition (one of <literal>libc</literal>, <literal>systemd</literal>, <literal>LSB</literal>, or |
| 473 |
<literal>BSD</literal>), see the Process Exit Codes section in |
| 474 |
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. |
| 475 |
If no additional arguments are specified, all known statuses are shown. Otherwise, only the |
| 476 |
definitions for the specified codes are shown.</para> |
| 477 |
|
| 478 |
<example> |
| 479 |
<title><command>Show some example exit status names</command></title> |
| 480 |
|
| 481 |
<programlisting>$ systemd-analyze exit-status 0 1 {63..65} |
| 482 |
NAME STATUS CLASS |
| 483 |
SUCCESS 0 libc |
| 484 |
FAILURE 1 libc |
| 485 |
- 63 - |
| 486 |
USAGE 64 BSD |
| 487 |
DATAERR 65 BSD |
| 488 |
</programlisting> |
| 489 |
</example> |
| 490 |
</refsect2> |
| 491 |
|
| 492 |
<refsect2> |
| 493 |
<title> |
| 494 |
<command>systemd-analyze capability |
| 495 |
<group choice="opt"> |
| 496 |
<arg choice="plain" rep="repeat"><replaceable>CAPABILITY</replaceable></arg> |
| 497 |
<arg choice="plain"> |
| 498 |
<group choice="req"> |
| 499 |
<arg choice="plain">-m</arg> |
| 500 |
<arg choice="plain">--mask</arg> |
| 501 |
</group> |
| 502 |
<replaceable>MASK</replaceable> |
| 503 |
</arg> |
| 504 |
</group> |
| 505 |
</command> |
| 506 |
</title> |
| 507 |
|
| 508 |
<para>This command prints a list of Linux capabilities along with their numeric IDs. See <citerefentry |
| 509 |
project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
| 510 |
for details. If no argument is specified the full list of capabilities known to the service manager and |
| 511 |
the kernel is shown. Capabilities defined by the kernel but not known to the service manager are shown |
| 512 |
as <literal>cap_???</literal>. Optionally, if arguments are specified they may refer to specific |
| 513 |
cabilities by name or numeric ID, in which case only the indicated capabilities are shown in the |
| 514 |
table.</para> |
| 515 |
|
| 516 |
<para>Alternatively, if <option>--mask</option> is passed, a single numeric argument must be specified, |
| 517 |
which is interpreted as a hexadecimal capability mask. In this case, only the capabilities present in |
| 518 |
the mask are shown in the table. This mode is intended to aid in decoding capability sets available |
| 519 |
via various debugging interfaces (e.g. <literal>/proc/PID/status</literal>).</para> |
| 520 |
|
| 521 |
<example> |
| 522 |
<title><command>Show some example capability names</command></title> |
| 523 |
|
| 524 |
<programlisting>$ systemd-analyze capability 0 1 {30..32} |
| 525 |
NAME NUMBER |
| 526 |
cap_chown 0 |
| 527 |
cap_dac_override 1 |
| 528 |
cap_audit_control 30 |
| 529 |
cap_setfcap 31 |
| 530 |
cap_mac_override 32</programlisting> |
| 531 |
</example> |
| 532 |
|
| 533 |
<example> |
| 534 |
<title><command>Decode a capability mask extracted from /proc</command></title> |
| 535 |
|
| 536 |
<programlisting>$ systemd-analyze capability -m 0000000000003c00 |
| 537 |
NAME NUMBER |
| 538 |
cap_net_bind_service 10 |
| 539 |
cap_net_broadcast 11 |
| 540 |
cap_net_admin 12 |
| 541 |
cap_net_raw 13 |
| 542 |
</programlisting> |
| 543 |
</example> |
| 544 |
</refsect2> |
| 545 |
|
| 546 |
<refsect2> |
| 547 |
<title><command>systemd-analyze condition <replaceable>CONDITION</replaceable>...</command></title> |
| 548 |
|
| 549 |
<para>This command will evaluate <varname index="false">Condition*=...</varname> and |
| 550 |
<varname index="false">Assert*=...</varname> assignments, and print their values, and |
| 551 |
the resulting value of the combined condition set. See |
| 552 |
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 553 |
for a list of available conditions and asserts.</para> |
| 554 |
|
| 555 |
<example> |
| 556 |
<title>Evaluate conditions that check kernel versions</title> |
| 557 |
|
| 558 |
<programlisting>$ systemd-analyze condition 'ConditionVersion = ! <4.0' \ |
| 559 |
'ConditionVersion = >=5.1' \ |
| 560 |
'ConditionACPower=|false' \ |
| 561 |
'ConditionArchitecture=|!arm' \ |
| 562 |
'AssertPathExists=/etc/os-release' |
| 563 |
test.service: AssertPathExists=/etc/os-release succeeded. |
| 564 |
Asserts succeeded. |
| 565 |
test.service: ConditionArchitecture=|!arm succeeded. |
| 566 |
test.service: ConditionACPower=|false failed. |
| 567 |
test.service: ConditionVersion=>=5.1 succeeded. |
| 568 |
test.service: ConditionVersion=!<4.0 succeeded. |
| 569 |
Conditions succeeded.</programlisting> |
| 570 |
</example> |
| 571 |
</refsect2> |
| 572 |
|
| 573 |
<refsect2> |
| 574 |
<title><command>systemd-analyze syscall-filter <optional><replaceable>SET</replaceable>...</optional></command></title> |
| 575 |
|
| 576 |
<para>This command will list system calls contained in the specified system call set |
| 577 |
<replaceable>SET</replaceable>, or all known sets if no sets are specified. Argument |
| 578 |
<replaceable>SET</replaceable> must include the <literal>@</literal> prefix.</para> |
| 579 |
</refsect2> |
| 580 |
|
| 581 |
<refsect2> |
| 582 |
<title><command>systemd-analyze filesystems <optional><replaceable>SET</replaceable>...</optional></command></title> |
| 583 |
|
| 584 |
<para>This command will list filesystems in the specified filesystem set |
| 585 |
<replaceable>SET</replaceable>, or all known sets if no sets are specified. Argument |
| 586 |
<replaceable>SET</replaceable> must include the <literal>@</literal> prefix.</para> |
| 587 |
</refsect2> |
| 588 |
|
| 589 |
<refsect2> |
| 590 |
<title><command>systemd-analyze calendar <replaceable>EXPRESSION</replaceable>...</command></title> |
| 591 |
|
| 592 |
<para>This command will parse and normalize repetitive calendar time events, and will calculate when |
| 593 |
they elapse next. This takes the same input as the <varname>OnCalendar=</varname> setting in |
| 594 |
<citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
| 595 |
following the syntax described in |
| 596 |
<citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>. By |
| 597 |
default, only the next time the calendar expression will elapse is shown; use |
| 598 |
<option>--iterations=</option> to show the specified number of next times the expression |
| 599 |
elapses. Each time the expression elapses forms a timestamp, see the <command>timestamp</command> |
| 600 |
verb below.</para> |
| 601 |
|
| 602 |
<example> |
| 603 |
<title>Show leap days in the near future</title> |
| 604 |
|
| 605 |
<programlisting>$ systemd-analyze calendar --iterations=5 '*-2-29 0:0:0' |
| 606 |
Original form: *-2-29 0:0:0 |
| 607 |
Normalized form: *-02-29 00:00:00 |
| 608 |
Next elapse: Sat 2020-02-29 00:00:00 UTC |
| 609 |
From now: 11 months 15 days left |
| 610 |
Iter. #2: Thu 2024-02-29 00:00:00 UTC |
| 611 |
From now: 4 years 11 months left |
| 612 |
Iter. #3: Tue 2028-02-29 00:00:00 UTC |
| 613 |
From now: 8 years 11 months left |
| 614 |
Iter. #4: Sun 2032-02-29 00:00:00 UTC |
| 615 |
From now: 12 years 11 months left |
| 616 |
Iter. #5: Fri 2036-02-29 00:00:00 UTC |
| 617 |
From now: 16 years 11 months left |
| 618 |
</programlisting> |
| 619 |
</example> |
| 620 |
</refsect2> |
| 621 |
|
| 622 |
<refsect2> |
| 623 |
<title><command>systemd-analyze timestamp <replaceable>TIMESTAMP</replaceable>...</command></title> |
| 624 |
|
| 625 |
<para>This command parses a timestamp (i.e. a single point in time) and outputs the normalized form and |
| 626 |
the difference between this timestamp and now. The timestamp should adhere to the syntax documented in |
| 627 |
<citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>, |
| 628 |
section "PARSING TIMESTAMPS".</para> |
| 629 |
|
| 630 |
<example> |
| 631 |
<title>Show parsing of timestamps</title> |
| 632 |
|
| 633 |
<programlisting>$ systemd-analyze timestamp yesterday now tomorrow |
| 634 |
Original form: yesterday |
| 635 |
Normalized form: Mon 2019-05-20 00:00:00 CEST |
| 636 |
(in UTC): Sun 2019-05-19 22:00:00 UTC |
| 637 |
UNIX seconds: @15583032000 |
| 638 |
From now: 1 day 9h ago |
| 639 |
|
| 640 |
Original form: now |
| 641 |
Normalized form: Tue 2019-05-21 09:48:39 CEST |
| 642 |
(in UTC): Tue 2019-05-21 07:48:39 UTC |
| 643 |
UNIX seconds: @1558424919.659757 |
| 644 |
From now: 43us ago |
| 645 |
|
| 646 |
Original form: tomorrow |
| 647 |
Normalized form: Wed 2019-05-22 00:00:00 CEST |
| 648 |
(in UTC): Tue 2019-05-21 22:00:00 UTC |
| 649 |
UNIX seconds: @15584760000 |
| 650 |
From now: 14h left |
| 651 |
</programlisting> |
| 652 |
</example> |
| 653 |
</refsect2> |
| 654 |
|
| 655 |
<refsect2> |
| 656 |
<title><command>systemd-analyze timespan <replaceable>EXPRESSION</replaceable>...</command></title> |
| 657 |
|
| 658 |
<para>This command parses a time span (i.e. a difference between two timestamps) and outputs the |
| 659 |
normalized form and the equivalent value in microseconds. The time span should adhere to the syntax |
| 660 |
documented in |
| 661 |
<citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>, |
| 662 |
section "PARSING TIME SPANS". Values without units are parsed as seconds.</para> |
| 663 |
|
| 664 |
<example> |
| 665 |
<title>Show parsing of timespans</title> |
| 666 |
|
| 667 |
<programlisting>$ systemd-analyze timespan 1s 300s '1year 0.000001s' |
| 668 |
Original: 1s |
| 669 |
μs: 1000000 |
| 670 |
Human: 1s |
| 671 |
|
| 672 |
Original: 300s |
| 673 |
μs: 300000000 |
| 674 |
Human: 5min |
| 675 |
|
| 676 |
Original: 1year 0.000001s |
| 677 |
μs: 31557600000001 |
| 678 |
Human: 1y 1us |
| 679 |
</programlisting> |
| 680 |
</example> |
| 681 |
</refsect2> |
| 682 |
|
| 683 |
<refsect2> |
| 684 |
<title><command>systemd-analyze cat-config</command> |
| 685 |
<replaceable>NAME</replaceable>|<replaceable>PATH</replaceable>...</title> |
| 686 |
|
| 687 |
<para>This command is similar to <command>systemctl cat</command>, but operates on config files. It |
| 688 |
will copy the contents of a config file and any drop-ins to standard output, using the usual systemd |
| 689 |
set of directories and rules for precedence. Each argument must be either an absolute path including |
| 690 |
the prefix (such as <filename>/etc/systemd/logind.conf</filename> or |
| 691 |
<filename>/usr/lib/systemd/logind.conf</filename>), or a name relative to the prefix (such as |
| 692 |
<filename>systemd/logind.conf</filename>).</para> |
| 693 |
|
| 694 |
<example> |
| 695 |
<title>Showing logind configuration</title> |
| 696 |
<programlisting>$ systemd-analyze cat-config systemd/logind.conf |
| 697 |
# /etc/systemd/logind.conf |
| 698 |
... |
| 699 |
[Login] |
| 700 |
NAutoVTs=8 |
| 701 |
... |
| 702 |
|
| 703 |
# /usr/lib/systemd/logind.conf.d/20-test.conf |
| 704 |
... some override from another package |
| 705 |
|
| 706 |
# /etc/systemd/logind.conf.d/50-override.conf |
| 707 |
... some administrator override |
| 708 |
</programlisting> |
| 709 |
</example> |
| 710 |
</refsect2> |
| 711 |
|
| 712 |
<refsect2> |
| 713 |
<title><command>systemd-analyze compare-versions |
| 714 |
<replaceable>VERSION1</replaceable> |
| 715 |
<optional><replaceable>OP</replaceable></optional> |
| 716 |
<replaceable>VERSION2</replaceable></command></title> |
| 717 |
|
| 718 |
<para>This command has two distinct modes of operation, depending on whether the operator |
| 719 |
<replaceable>OP</replaceable> is specified.</para> |
| 720 |
|
| 721 |
<para>In the first mode — when <replaceable>OP</replaceable> is not specified —, it will compare the two |
| 722 |
version strings and print either <literal><replaceable>VERSION1</replaceable> < |
| 723 |
<replaceable>VERSION2</replaceable></literal>, or <literal><replaceable>VERSION1</replaceable> == |
| 724 |
<replaceable>VERSION2</replaceable></literal>, or <literal><replaceable>VERSION1</replaceable> > |
| 725 |
<replaceable>VERSION2</replaceable></literal> as appropriate.</para> |
| 726 |
|
| 727 |
<para>The exit status is <constant>0</constant> if the versions are equal, <constant>11</constant> if |
| 728 |
the version of the right is smaller, and <constant>12</constant> if the version of the left is |
| 729 |
smaller. (This matches the convention used by <command>rpmdev-vercmp</command>.)</para> |
| 730 |
|
| 731 |
<para>In the second mode — when <replaceable>OP</replaceable> is specified — it will compare the two |
| 732 |
version strings using the operation <replaceable>OP</replaceable> and return <constant>0</constant> |
| 733 |
(success) if they condition is satisfied, and <constant>1</constant> (failure) |
| 734 |
otherwise. <constant>OP</constant> may be <command>lt</command>, <command>le</command>, |
| 735 |
<command>eq</command>, <command>ne</command>, <command>ge</command>, <command>gt</command>. In this |
| 736 |
mode, no output is printed. |
| 737 |
(This matches the convention used by |
| 738 |
<citerefentry project='die-net'><refentrytitle>dpkg</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 739 |
<option>--compare-versions</option>.)</para> |
| 740 |
|
| 741 |
<example> |
| 742 |
<title>Compare versions of a package</title> |
| 743 |
|
| 744 |
<programlisting> |
| 745 |
$ systemd-analyze compare-versions systemd-250~rc1.fc36.aarch64 systemd-251.fc36.aarch64 |
| 746 |
systemd-250~rc1.fc36.aarch64 < systemd-251.fc36.aarch64 |
| 747 |
$ echo $? |
| 748 |
12 |
| 749 |
|
| 750 |
$ systemd-analyze compare-versions 1 lt 2; echo $? |
| 751 |
0 |
| 752 |
$ systemd-analyze compare-versions 1 ge 2; echo $? |
| 753 |
1 |
| 754 |
</programlisting> |
| 755 |
</example> |
| 756 |
</refsect2> |
| 757 |
|
| 758 |
<refsect2> |
| 759 |
<title><command>systemd-analyze verify <replaceable>FILE</replaceable>...</command></title> |
| 760 |
|
| 761 |
<para>This command will load unit files and print warnings if any errors are detected. Files specified |
| 762 |
on the command line will be loaded, but also any other units referenced by them. A unit's name on disk |
| 763 |
can be overridden by specifying an alias after a colon; see below for an example. The full unit search |
| 764 |
path is formed by combining the directories for all command line arguments, and the usual unit load |
| 765 |
paths. The variable <varname>$SYSTEMD_UNIT_PATH</varname> is supported, and may be used to replace or |
| 766 |
augment the compiled in set of unit load paths; see |
| 767 |
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. All |
| 768 |
units files present in the directories containing the command line arguments will be used in preference |
| 769 |
to the other paths. If a template unit without an instance name is specified (e.g. |
| 770 |
<filename>[email protected]</filename>), <literal>test_instance</literal> will be used as the instance |
| 771 |
name, which can be controlled by <option>--instance=</option> option.</para> |
| 772 |
|
| 773 |
<para>The following errors are currently detected:</para> |
| 774 |
<itemizedlist> |
| 775 |
<listitem><para>unknown sections and directives,</para></listitem> |
| 776 |
|
| 777 |
<listitem><para>missing dependencies which are required to start the given unit,</para></listitem> |
| 778 |
|
| 779 |
<listitem><para>man pages listed in <varname>Documentation=</varname> which are not found in the |
| 780 |
system,</para></listitem> |
| 781 |
|
| 782 |
<listitem><para>commands listed in <varname>ExecStart=</varname> and similar which are not found in |
| 783 |
the system or not executable.</para></listitem> |
| 784 |
</itemizedlist> |
| 785 |
|
| 786 |
<example> |
| 787 |
<title>Misspelt directives</title> |
| 788 |
|
| 789 |
<programlisting>$ cat ./user.slice |
| 790 |
[Unit] |
| 791 |
WhatIsThis=11 |
| 792 |
Documentation=man:nosuchfile(1) |
| 793 |
Requires=different.service |
| 794 |
|
| 795 |
[Service] |
| 796 |
Description=x |
| 797 |
|
| 798 |
$ systemd-analyze verify ./user.slice |
| 799 |
[./user.slice:9] Unknown lvalue 'WhatIsThis' in section 'Unit' |
| 800 |
[./user.slice:13] Unknown section 'Service'. Ignoring. |
| 801 |
Error: org.freedesktop.systemd1.LoadFailed: |
| 802 |
Unit different.service failed to load: |
| 803 |
No such file or directory. |
| 804 |
Failed to create user.slice/start: Invalid argument |
| 805 |
user.slice: man nosuchfile(1) command failed with code 16 |
| 806 |
</programlisting> |
| 807 |
</example> |
| 808 |
|
| 809 |
<example> |
| 810 |
<title>Missing service units</title> |
| 811 |
|
| 812 |
<programlisting>$ tail ./a.socket ./b.socket |
| 813 |
==> ./a.socket <== |
| 814 |
[Socket] |
| 815 |
ListenStream=100 |
| 816 |
|
| 817 |
==> ./b.socket <== |
| 818 |
[Socket] |
| 819 |
ListenStream=100 |
| 820 |
Accept=yes |
| 821 |
|
| 822 |
$ systemd-analyze verify ./a.socket ./b.socket |
| 823 |
Service a.service not loaded, a.socket cannot be started. |
| 824 |
Service [email protected] not loaded, b.socket cannot be started. |
| 825 |
</programlisting> |
| 826 |
</example> |
| 827 |
|
| 828 |
<example> |
| 829 |
<title>Aliasing a unit</title> |
| 830 |
|
| 831 |
<programlisting>$ cat /tmp/source |
| 832 |
[Unit] |
| 833 |
Description=Hostname printer |
| 834 |
|
| 835 |
[Service] |
| 836 |
Type=simple |
| 837 |
ExecStart=/usr/bin/echo %H |
| 838 |
MysteryKey=true |
| 839 |
|
| 840 |
$ systemd-analyze verify /tmp/source |
| 841 |
Failed to prepare filename /tmp/source: Invalid argument |
| 842 |
|
| 843 |
$ systemd-analyze verify /tmp/source:alias.service |
| 844 |
alias.service:7: Unknown key name 'MysteryKey' in section 'Service', ignoring. |
| 845 |
</programlisting> |
| 846 |
</example> |
| 847 |
|
| 848 |
</refsect2> |
| 849 |
|
| 850 |
<refsect2> |
| 851 |
<title><command>systemd-analyze security <optional><replaceable>UNIT</replaceable>...</optional></command></title> |
| 852 |
|
| 853 |
<para>This command analyzes the security and sandboxing settings of one or more specified service |
| 854 |
units. If at least one unit name is specified the security settings of the specified service units are |
| 855 |
inspected and a detailed analysis is shown. If no unit name is specified, all currently loaded, |
| 856 |
long-running service units are inspected and a terse table with results shown. The command checks for |
| 857 |
various security-related service settings, assigning each a numeric "exposure level" value, depending |
| 858 |
on how important a setting is. It then calculates an overall exposure level for the whole unit, which |
| 859 |
is an estimation in the range 0.0…10.0 indicating how exposed a service is security-wise. High exposure |
| 860 |
levels indicate very little applied sandboxing. Low exposure levels indicate tight sandboxing and |
| 861 |
strongest security restrictions. Note that this only analyzes the per-service security features systemd |
| 862 |
itself implements. This means that any additional security mechanisms applied by the service code |
| 863 |
itself are not accounted for. The exposure level determined this way should not be misunderstood: a |
| 864 |
high exposure level neither means that there is no effective sandboxing applied by the service code |
| 865 |
itself, nor that the service is actually vulnerable to remote or local attacks. High exposure levels do |
| 866 |
indicate however that most likely the service might benefit from additional settings applied to |
| 867 |
them.</para> |
| 868 |
|
| 869 |
<para>Please note that many of the security and sandboxing settings individually can be circumvented — |
| 870 |
unless combined with others. For example, if a service retains the privilege to establish or undo mount |
| 871 |
points many of the sandboxing options can be undone by the service code itself. Due to that is |
| 872 |
essential that each service uses the most comprehensive and strict sandboxing and security settings |
| 873 |
possible. The tool will take into account some of these combinations and relationships between the |
| 874 |
settings, but not all. Also note that the security and sandboxing settings analyzed here only apply to |
| 875 |
the operations executed by the service code itself. If a service has access to an IPC system (such as |
| 876 |
D-Bus) it might request operations from other services that are not subject to the same |
| 877 |
restrictions. Any comprehensive security and sandboxing analysis is hence incomplete if the IPC access |
| 878 |
policy is not validated too.</para> |
| 879 |
|
| 880 |
<example> |
| 881 |
<title>Analyze <filename index="false">systemd-logind.service</filename></title> |
| 882 |
|
| 883 |
<programlisting>$ systemd-analyze security --no-pager systemd-logind.service |
| 884 |
NAME DESCRIPTION EXPOSURE |
| 885 |
✗ PrivateNetwork= Service has access to the host's network 0.5 |
| 886 |
✗ User=/DynamicUser= Service runs as root user 0.4 |
| 887 |
✗ DeviceAllow= Service has no device ACL 0.2 |
| 888 |
✓ IPAddressDeny= Service blocks all IP address ranges |
| 889 |
... |
| 890 |
→ Overall exposure level for systemd-logind.service: 4.1 OK 🙂 |
| 891 |
</programlisting> |
| 892 |
</example> |
| 893 |
</refsect2> |
| 894 |
|
| 895 |
<refsect2> |
| 896 |
<title><command>systemd-analyze inspect-elf <replaceable>FILE</replaceable>...</command></title> |
| 897 |
|
| 898 |
<para>This command will load the specified files, and if they are ELF objects (executables, |
| 899 |
libraries, core files, etc.) it will parse the embedded packaging metadata, if any, and print |
| 900 |
it in a table or json format. See the |
| 901 |
<ulink url="https://systemd.io/PACKAGE_METADATA_FOR_EXECUTABLE_FILES/"> |
| 902 |
Package Metadata for Executable Files</ulink> document for more information.</para> |
| 903 |
|
| 904 |
<example> |
| 905 |
<title>Print information about a core file as JSON</title> |
| 906 |
|
| 907 |
<programlisting>$ systemd-analyze inspect-elf --json=pretty \ |
| 908 |
core.fsverity.1000.f77dac5dc161402aa44e15b7dd9dcf97.58561.1637106137000000 |
| 909 |
{ |
| 910 |
"elfType" : "coredump", |
| 911 |
"elfArchitecture" : "AMD x86-64", |
| 912 |
"/home/bluca/git/fsverity-utils/fsverity" : { |
| 913 |
"type" : "deb", |
| 914 |
"name" : "fsverity-utils", |
| 915 |
"version" : "1.3-1", |
| 916 |
"buildId" : "7c895ecd2a271f93e96268f479fdc3c64a2ec4ee" |
| 917 |
}, |
| 918 |
"/home/bluca/git/fsverity-utils/libfsverity.so.0" : { |
| 919 |
"type" : "deb", |
| 920 |
"name" : "fsverity-utils", |
| 921 |
"version" : "1.3-1", |
| 922 |
"buildId" : "b5e428254abf14237b0ae70ed85fffbb98a78f88" |
| 923 |
} |
| 924 |
} |
| 925 |
</programlisting> |
| 926 |
</example> |
| 927 |
</refsect2> |
| 928 |
|
| 929 |
<refsect2> |
| 930 |
<title><command>systemd-analyze dlopen-metadata <replaceable>FILE</replaceable></command></title> |
| 931 |
|
| 932 |
<para>This command will load the specified file, and if it is an ELF object (executables, |
| 933 |
libraries, core files, etc.) it will parse the embedded dlopen metadata, if any, and print |
| 934 |
it in a table or json format. See the |
| 935 |
<ulink url="https://systemd.io/ELF_DLOPEN_METADATA/"> |
| 936 |
dlopen() Metadata for ELF Files</ulink> document for more information.</para> |
| 937 |
</refsect2> |
| 938 |
|
| 939 |
<refsect2> |
| 940 |
<title><command>systemd-analyze fdstore <replaceable>UNIT</replaceable>...</command></title> |
| 941 |
|
| 942 |
<para>Lists the current contents of the specified service unit's file descriptor store. This shows |
| 943 |
names, inode types, device numbers, inode numbers, paths and open modes of the open file |
| 944 |
descriptors. The specified units must have <varname>FileDescriptorStoreMax=</varname> enabled, see |
| 945 |
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry> for |
| 946 |
details.</para> |
| 947 |
|
| 948 |
<example> |
| 949 |
<title>Table output</title> |
| 950 |
<programlisting>$ systemd-analyze fdstore systemd-journald.service |
| 951 |
FDNAME TYPE DEVNO INODE RDEVNO PATH FLAGS |
| 952 |
stored sock 0:8 4218620 - socket:[4218620] ro |
| 953 |
stored sock 0:8 4213198 - socket:[4213198] ro |
| 954 |
stored sock 0:8 4213190 - socket:[4213190] ro |
| 955 |
…</programlisting> |
| 956 |
</example> |
| 957 |
|
| 958 |
<para>Note: the "DEVNO" column refers to the major/minor numbers of the device node backing the file |
| 959 |
system the file descriptor's inode is on. The "RDEVNO" column refers to the major/minor numbers of the |
| 960 |
device node itself if the file descriptor refers to one. Compare with corresponding |
| 961 |
<varname>.st_dev</varname> and <varname>.st_rdev</varname> fields in <type>struct stat</type> (see |
| 962 |
<citerefentry |
| 963 |
project='man-pages'><refentrytitle>stat</refentrytitle><manvolnum>2</manvolnum></citerefentry> for |
| 964 |
details). The listed inode numbers in the "INODE" column are on the file system indicated by |
| 965 |
"DEVNO".</para> |
| 966 |
</refsect2> |
| 967 |
|
| 968 |
<refsect2> |
| 969 |
<title><command>systemd-analyze image-policy <replaceable>POLICY</replaceable>…</command></title> |
| 970 |
|
| 971 |
<para>This command analyzes the specified image policy string, as per |
| 972 |
<citerefentry><refentrytitle>systemd.image-policy</refentrytitle><manvolnum>7</manvolnum></citerefentry>. The |
| 973 |
policy is normalized and simplified. For each currently defined partition identifier (as per the <ulink |
| 974 |
url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">UAPI.2 Discoverable |
| 975 |
Partitions Specification</ulink>) the effect of the image policy string is shown in tabular form.</para> |
| 976 |
|
| 977 |
<example> |
| 978 |
<title>Example Output</title> |
| 979 |
|
| 980 |
<programlisting>$ systemd-analyze image-policy swap=encrypted:usr=read-only-on+verity:root=encrypted |
| 981 |
Analyzing policy: root=encrypted:usr=verity+read-only-on:swap=encrypted |
| 982 |
Long form: root=encrypted:usr=verity+read-only-on:swap=encrypted:=unused+absent |
| 983 |
|
| 984 |
PARTITION MODE READ-ONLY GROWFS |
| 985 |
root encrypted - - |
| 986 |
usr verity yes - |
| 987 |
home ignore - - |
| 988 |
srv ignore - - |
| 989 |
esp ignore - - |
| 990 |
xbootldr ignore - - |
| 991 |
swap encrypted - - |
| 992 |
root-verity ignore - - |
| 993 |
usr-verity unprotected yes - |
| 994 |
root-verity-sig ignore - - |
| 995 |
usr-verity-sig ignore - - |
| 996 |
tmp ignore - - |
| 997 |
var ignore - - |
| 998 |
default ignore - -</programlisting> |
| 999 |
</example> |
| 1000 |
</refsect2> |
| 1001 |
|
| 1002 |
<refsect2> |
| 1003 |
<title><command>systemd-analyze has-tpm2</command></title> |
| 1004 |
|
| 1005 |
<para>Reports whether the system is equipped with a usable TPM2 device. If a TPM2 device has been |
| 1006 |
discovered, is supported, and is being used by firmware, by the OS kernel drivers and by userspace |
| 1007 |
(i.e. systemd) this prints <literal>yes</literal> and exits with exit status zero. If no such device is |
| 1008 |
discovered/supported/used, prints <literal>no</literal>. Otherwise, prints |
| 1009 |
<literal>partial</literal>. In either of these two cases exits with non-zero exit status. It also shows |
| 1010 |
five lines indicating separately whether firmware, drivers, the system, the kernel and libraries |
| 1011 |
discovered/support/use TPM2. Currently, required libraries are <filename>libtss2-esys.so.0</filename>, |
| 1012 |
<filename>libtss2-rc.so.0</filename>, and <filename>libtss2-mu.so.0</filename>. The requirement may be |
| 1013 |
changed in the future release.</para> |
| 1014 |
|
| 1015 |
<para>Note, this checks for TPM 2.0 devices only, and does not consider TPM 1.2 at all.</para> |
| 1016 |
|
| 1017 |
<para>Combine with <option>--quiet</option> to suppress the output.</para> |
| 1018 |
|
| 1019 |
<example> |
| 1020 |
<title>Example Output</title> |
| 1021 |
|
| 1022 |
<programlisting>yes |
| 1023 |
+firmware |
| 1024 |
+driver |
| 1025 |
+system |
| 1026 |
+subsystem |
| 1027 |
+libraries |
| 1028 |
+libtss2-esys.so.0 |
| 1029 |
+libtss2-rc.so.0 |
| 1030 |
+libtss2-mu.so.0</programlisting> |
| 1031 |
</example> |
| 1032 |
|
| 1033 |
<xi:include href="version-info.xml" xpointer="v257"/> |
| 1034 |
</refsect2> |
| 1035 |
|
| 1036 |
<refsect2> |
| 1037 |
<title><command>systemd-analyze identify-tpm2</command></title> |
| 1038 |
|
| 1039 |
<para>Shows vendor information about the TPM 2.0 device discovered.</para> |
| 1040 |
|
| 1041 |
<example> |
| 1042 |
<title>Example Output</title> |
| 1043 |
|
| 1044 |
<programlisting> Family Indicator: 2.0 |
| 1045 |
Level: 0 |
| 1046 |
Revision: 1.59 |
| 1047 |
Specification Date: Mon 2023-01-09 |
| 1048 |
Manufacturer: STM |
| 1049 |
Vendor String: ST33KTPM2XSPI |
| 1050 |
Firmware Version: 9.258 |
| 1051 |
Modalias String: fi2.0:lv0:rv1.59:sy2023:sd9:mfSTM:vsST33KTPM2XSPI:ty0:fw9.258.0:</programlisting> |
| 1052 |
</example> |
| 1053 |
|
| 1054 |
<xi:include href="version-info.xml" xpointer="v260"/> |
| 1055 |
</refsect2> |
| 1056 |
|
| 1057 |
<refsect2> |
| 1058 |
<title><command>systemd-analyze pcrs <optional><replaceable>PCR</replaceable>…</optional></command></title> |
| 1059 |
|
| 1060 |
<para>This command shows the known TPM2 PCRs along with their identifying names and current values.</para> |
| 1061 |
|
| 1062 |
<example> |
| 1063 |
<title>Example Output</title> |
| 1064 |
|
| 1065 |
<programlisting>$ systemd-analyze pcrs |
| 1066 |
NR NAME SHA256 |
| 1067 |
0 platform-code bcd2eb527108bbb1f5528409bcbe310aa9b74f687854cc5857605993f3d9eb11 |
| 1068 |
1 platform-config b60622856eb7ce52637b80f30a520e6e87c347daa679f3335f4f1a600681bb01 |
| 1069 |
2 external-code 1471262403e9a62f9c392941300b4807fbdb6f0bfdd50abfab752732087017dd |
| 1070 |
3 external-config 3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969 |
| 1071 |
4 boot-loader-code 939f7fa1458e1f7ce968874d908e524fc0debf890383d355e4ce347b7b78a95c |
| 1072 |
5 boot-loader-config 864c61c5ea5ecbdb6951e6cb6d9c1f4b4eac79772f7fe13b8bece569d83d3768 |
| 1073 |
6 - 3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969 |
| 1074 |
7 secure-boot-policy 9c905bd9b9891bfb889b90a54c4b537b889cfa817c4389cc25754823a9443255 |
| 1075 |
8 - 0000000000000000000000000000000000000000000000000000000000000000 |
| 1076 |
9 kernel-initrd 9caa29b128113ef42aa53d421f03437be57211e5ebafc0fa8b5d4514ee37ff0c |
| 1077 |
10 ima 5ea9e3dab53eb6b483b6ec9e3b2c712bea66bca1b155637841216e0094387400 |
| 1078 |
11 kernel-boot 0000000000000000000000000000000000000000000000000000000000000000 |
| 1079 |
12 kernel-config 627ffa4b405e911902fe1f1a8b0164693b31acab04f805f15bccfe2209c7eace |
| 1080 |
13 sysexts 0000000000000000000000000000000000000000000000000000000000000000 |
| 1081 |
14 shim-policy 0000000000000000000000000000000000000000000000000000000000000000 |
| 1082 |
15 system-identity 0000000000000000000000000000000000000000000000000000000000000000 |
| 1083 |
16 debug 0000000000000000000000000000000000000000000000000000000000000000 |
| 1084 |
17 - ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
| 1085 |
18 - ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
| 1086 |
19 - ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
| 1087 |
20 - ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
| 1088 |
21 - ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
| 1089 |
22 - ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
| 1090 |
23 application-support 0000000000000000000000000000000000000000000000000000000000000000</programlisting> |
| 1091 |
</example> |
| 1092 |
</refsect2> |
| 1093 |
|
| 1094 |
<refsect2> |
| 1095 |
<title><command>systemd-analyze nvpcrs <optional><replaceable>NVPCR</replaceable>…</optional></command></title> |
| 1096 |
|
| 1097 |
<para>This command shows the known TPM2 NvPCRs (additional PCRs stored in TPM2 NV indexes) along with |
| 1098 |
their identifying names and current values.</para> |
| 1099 |
|
| 1100 |
<example> |
| 1101 |
<title>Example Output</title> |
| 1102 |
|
| 1103 |
<programlisting>$ systemd-analyze nvpcrs |
| 1104 |
NAME NVINDEX VALUE |
| 1105 |
cryptsetup 0x1d10201 f400543943cc7215557ce672872ace5382e6d53177cc459078ba9277e41588d9 |
| 1106 |
hardware 0x1d10200 e155474936d7d74c893e6ece1099a2311d572cf23becea159dabf282db754284</programlisting> |
| 1107 |
</example> |
| 1108 |
|
| 1109 |
<xi:include href="version-info.xml" xpointer="v259"/> |
| 1110 |
</refsect2> |
| 1111 |
|
| 1112 |
<refsect2> |
| 1113 |
<title><command>systemd-analyze srk <optional>><replaceable>FILE</replaceable></optional></command></title> |
| 1114 |
|
| 1115 |
<para>This command reads the Storage Root Key (SRK) from the TPM2 device, and writes it in marshalled |
| 1116 |
TPM2B_PUBLIC format to stdout. The output is non-printable data, so it should be redirected to a file |
| 1117 |
or into a pipe.</para> |
| 1118 |
|
| 1119 |
<example> |
| 1120 |
<title>Save the Storage Root Key to <filename>srk.tpm2b_public</filename></title> |
| 1121 |
|
| 1122 |
<programlisting>systemd-analyze srk >srk.tpm2b_public</programlisting> |
| 1123 |
</example> |
| 1124 |
</refsect2> |
| 1125 |
|
| 1126 |
<refsect2> |
| 1127 |
<title><command>systemd-analyze architectures <optional><replaceable>NAME</replaceable>...</optional></command></title> |
| 1128 |
|
| 1129 |
<para>Lists all known CPU architectures, and which ones are native. The listed architecture names are |
| 1130 |
those <varname>ConditionArchitecture=</varname> supports, see |
| 1131 |
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> for |
| 1132 |
details. If architecture names are specified only those specified are listed.</para> |
| 1133 |
|
| 1134 |
<example> |
| 1135 |
<title>Table output</title> |
| 1136 |
<programlisting>$ systemd-analyze architectures |
| 1137 |
NAME SUPPORT |
| 1138 |
alpha foreign |
| 1139 |
arc foreign |
| 1140 |
arc-be foreign |
| 1141 |
arm foreign |
| 1142 |
arm64 foreign |
| 1143 |
… |
| 1144 |
sparc foreign |
| 1145 |
sparc64 foreign |
| 1146 |
tilegx foreign |
| 1147 |
x86 secondary |
| 1148 |
x86-64 native</programlisting> |
| 1149 |
</example> |
| 1150 |
</refsect2> |
| 1151 |
|
| 1152 |
<refsect2> |
| 1153 |
<title><command>systemd-analyze smbios11</command></title> |
| 1154 |
|
| 1155 |
<para>Shows a list of SMBIOS Type #11 strings passed to the system. Also see |
| 1156 |
<citerefentry><refentrytitle>smbios-type-11</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para> |
| 1157 |
|
| 1158 |
<example> |
| 1159 |
<title>Example output</title> |
| 1160 |
<programlisting>$ systemd-analyze smbios11 |
| 1161 |
io.systemd.stub.kernel-cmdline-extra=console=ttyS0 |
| 1162 |
io.systemd.credential.binary:ssh.ephemeral-authorized_keys-all=c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSURGd20xbFp4WlRGclJteG9ZQlozOTYzcE1uYlJCaDMwM1MxVXhLSUM2NmYgbGVubmFydEB6ZXRhCg== |
| 1163 |
io.systemd.credential:vmm.notify_socket=vsock-stream:2:254570042 |
| 1164 |
|
| 1165 |
3 SMBIOS Type #11 strings passed. |
| 1166 |
</programlisting> |
| 1167 |
</example> |
| 1168 |
|
| 1169 |
<xi:include href="version-info.xml" xpointer="v257"/> |
| 1170 |
</refsect2> |
| 1171 |
|
| 1172 |
<refsect2> |
| 1173 |
<title><command>systemd-analyze chid</command></title> |
| 1174 |
|
| 1175 |
<para>Shows a list of Computer Hardware IDs (CHIDs) of the local system. These IDs identify the |
| 1176 |
system's computer hardware, based on SMBIOS data. See <ulink |
| 1177 |
url="https://learn.microsoft.com/en-us/windows-hardware/drivers/dashboard/using-chids">Using Computer |
| 1178 |
Hardware IDs (CHIDs)</ulink> for details about CHIDs.</para> |
| 1179 |
|
| 1180 |
<example> |
| 1181 |
<title>Example output</title> |
| 1182 |
<programlisting>$ systemd-analyze chid |
| 1183 |
TYPE INPUT CHID |
| 1184 |
3 MFPSmp 520537c0-3b59-504f-b062-9682ea236b21 |
| 1185 |
4 MFPS-- edf05dc8-a53d-5b2c-8023-630bca2a2463 |
| 1186 |
5 MFP--- ebc6a4d9-ec48-537a-916b-c69fa4fdd814 |
| 1187 |
6 M--Smp 5ebe4bba-f598-5e90-9ff2-9fd0d3211465 |
| 1188 |
7 M--S-- 1a3fb835-b42a-5f9c-a38c-eff5bfd5c41d |
| 1189 |
8 M-P-mp 2a831dce-8163-5bad-8406-435b8c752dd8 |
| 1190 |
9 M-P--- 7c21c878-4a75-50f7-9816-21e811588da0 |
| 1191 |
10 MF--mp 9a003537-bcc5-500e-b10a-8d8892e4fc64 |
| 1192 |
11 MF---- bb9122bb-8a5c-50d2-a742-a85beb719909 |
| 1193 |
13 M---mp bfc36935-5032-5987-a0a3-6311f01de33a |
| 1194 |
|
| 1195 |
LEGEND: M → sys_vendor (LENOVO) ┄ F → product_family (ThinkPad X1 Carbon Gen 9) ┄ P → product_name (20XW0055GE) |
| 1196 |
S → product_sku (LENOVO_MT_20XW_BU_Think_FM_ThinkPad X1 Carbon Gen 9) ┄ m → board_vendor (LENOVO) |
| 1197 |
p → board_name (20XW0055GE)</programlisting> |
| 1198 |
</example> |
| 1199 |
|
| 1200 |
<xi:include href="version-info.xml" xpointer="v258"/> |
| 1201 |
</refsect2> |
| 1202 |
|
| 1203 |
<refsect2> |
| 1204 |
<title><command>systemd-analyze transient-settings <replaceable>TYPE</replaceable>...</command></title> |
| 1205 |
|
| 1206 |
<para>Lists properties that can be set for various unit types via command line interfaces, in |
| 1207 |
particular |
| 1208 |
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 1209 |
<command>set-property</command> and <option>--property=</option>/<option>--automount-property=</option> |
| 1210 |
options in |
| 1211 |
<citerefentry><refentrytitle>systemd-run</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
| 1212 |
<citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>, and |
| 1213 |
<citerefentry><refentrytitle>systemd-mount</refentrytitle><manvolnum>1</manvolnum></citerefentry>. |
| 1214 |
Those assignments are possible for a subset of the properties that can be set in config files, see |
| 1215 |
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
| 1216 |
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
| 1217 |
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
| 1218 |
and the other unit-type-specific pages. The <replaceable>TYPE</replaceable> argument must be a unit |
| 1219 |
type ("service", "socket", …). The properties that apply to the specific types are listed.</para> |
| 1220 |
|
| 1221 |
<para>Note: D-Bus properties documented in |
| 1222 |
<citerefentry><refentrytitle>org.freedesktop.systemd1</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 1223 |
form a partially overlapping set with the lists generated by this command. Many D-Bus properties and |
| 1224 |
transient settings share the same names, but for example, <varname>LogRateLimitIntervalSec=</varname> |
| 1225 |
is described in |
| 1226 |
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> and |
| 1227 |
would be listed by this command, but the corresponding D-Bus property described in |
| 1228 |
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> is |
| 1229 |
<varname>LogRateLimitIntervalUSec</varname>. |
| 1230 |
</para> |
| 1231 |
|
| 1232 |
<para>This verb is intended primarily for programmatic generation of shell completions.</para> |
| 1233 |
|
| 1234 |
<xi:include href="version-info.xml" xpointer="v258"/> |
| 1235 |
</refsect2> |
| 1236 |
|
| 1237 |
<refsect2> |
| 1238 |
<title><command>systemd-analyze unit-shell <replaceable>SERVICE</replaceable> <optional><replaceable>command</replaceable>...</optional></command></title> |
| 1239 |
|
| 1240 |
<para>The given command runs on the namespace of the specified running service. If no command is given, |
| 1241 |
spawn and attach a shell with the namespace to the service.</para> |
| 1242 |
|
| 1243 |
<example> |
| 1244 |
<title>Example output</title> |
| 1245 |
<programlisting>$ systemd-analyze unit-shell systemd-resolved.service ls |
| 1246 |
bin dev etc home lib lib64 lost+found mnt proc run srv tmp var vmlinuz.old |
| 1247 |
boot efi exitrd init lib32 libx32 media opt root sbin sys usr vmlinuz work</programlisting> |
| 1248 |
</example> |
| 1249 |
|
| 1250 |
<xi:include href="version-info.xml" xpointer="v258"/> |
| 1251 |
</refsect2> |
| 1252 |
|
| 1253 |
<refsect2> |
| 1254 |
<title><command>systemd-analyze unit-gdb <replaceable>SERVICE</replaceable></command></title> |
| 1255 |
|
| 1256 |
<para>Spawn and attach a debugger to the given service. By default, |
| 1257 |
<citerefentry project='man-pages'><refentrytitle>gdb</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 1258 |
will be used. This may be changed using the <option>--debugger=</option> option or the |
| 1259 |
<varname>$SYSTEMD_DEBUGGER</varname> environment variable. Use the <option>--debugger-arguments=</option> option |
| 1260 |
to pass extra command line arguments to the debugger and quote as appropriate |
| 1261 |
when <replaceable>ARGS</replaceable> contain whitespace (See Example).</para> |
| 1262 |
|
| 1263 |
<example> |
| 1264 |
<programlisting>$ systemd-analyze --debugger-arguments="-batch -ex 'info all-registers'" unit-gdb systemd-oomd.service</programlisting> |
| 1265 |
</example> |
| 1266 |
|
| 1267 |
<xi:include href="version-info.xml" xpointer="v258"/> |
| 1268 |
</refsect2> |
| 1269 |
</refsect1> |
| 1270 |
|
| 1271 |
<refsect1> |
| 1272 |
<title>Options</title> |
| 1273 |
|
| 1274 |
<para>The following options are understood:</para> |
| 1275 |
|
| 1276 |
<variablelist> |
| 1277 |
<varlistentry> |
| 1278 |
<term><option>--system</option></term> |
| 1279 |
|
| 1280 |
<listitem><para>Operates on the system systemd instance. This |
| 1281 |
is the implied default.</para> |
| 1282 |
|
| 1283 |
<xi:include href="version-info.xml" xpointer="v209"/></listitem> |
| 1284 |
</varlistentry> |
| 1285 |
|
| 1286 |
<varlistentry> |
| 1287 |
<term><option>--user</option></term> |
| 1288 |
|
| 1289 |
<listitem><para>Operates on the user systemd |
| 1290 |
instance.</para> |
| 1291 |
|
| 1292 |
<xi:include href="version-info.xml" xpointer="v186"/></listitem> |
| 1293 |
</varlistentry> |
| 1294 |
|
| 1295 |
<varlistentry> |
| 1296 |
<term><option>--global</option></term> |
| 1297 |
|
| 1298 |
<listitem><para>Operates on the system-wide configuration for |
| 1299 |
user systemd instance.</para> |
| 1300 |
|
| 1301 |
<xi:include href="version-info.xml" xpointer="v238"/></listitem> |
| 1302 |
</varlistentry> |
| 1303 |
|
| 1304 |
<varlistentry> |
| 1305 |
<term><option>--order</option></term> |
| 1306 |
<term><option>--require</option></term> |
| 1307 |
|
| 1308 |
<listitem><para>When used in conjunction with the <command>dot</command> command (see above), |
| 1309 |
selects which dependencies are shown in the dependency graph. If <option>--order</option> is passed, |
| 1310 |
only dependencies of type <varname>After=</varname> or <varname>Before=</varname> are shown. |
| 1311 |
If <option>--require</option> is passed, only dependencies of type <varname>Requires=</varname>, |
| 1312 |
<varname>Requisite=</varname>, <varname>BindsTo=</varname>, <varname>Wants=</varname>, and |
| 1313 |
<varname>Conflicts=</varname> are shown. If neither is passed, this shows dependencies of |
| 1314 |
all these types.</para> |
| 1315 |
|
| 1316 |
<xi:include href="version-info.xml" xpointer="v198"/></listitem> |
| 1317 |
</varlistentry> |
| 1318 |
|
| 1319 |
<varlistentry> |
| 1320 |
<term><option>--from-pattern=</option></term> |
| 1321 |
<term><option>--to-pattern=</option></term> |
| 1322 |
|
| 1323 |
<listitem><para>When used in conjunction with the |
| 1324 |
<command>dot</command> command (see above), this selects which |
| 1325 |
relationships are shown in the dependency graph. Both options |
| 1326 |
require a |
| 1327 |
<citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
| 1328 |
pattern as an argument, which will be matched against the |
| 1329 |
left-hand and the right-hand, respectively, nodes of a |
| 1330 |
relationship.</para> |
| 1331 |
|
| 1332 |
<para>Each of these can be used more than once, in which case |
| 1333 |
the unit name must match one of the values. When tests for |
| 1334 |
both sides of the relation are present, a relation must pass |
| 1335 |
both tests to be shown. When patterns are also specified as |
| 1336 |
positional arguments, they must match at least one side of the |
| 1337 |
relation. In other words, patterns specified with those two |
| 1338 |
options will trim the list of edges matched by the positional |
| 1339 |
arguments, if any are given, and fully determine the list of |
| 1340 |
edges shown otherwise.</para> |
| 1341 |
|
| 1342 |
<xi:include href="version-info.xml" xpointer="v201"/></listitem> |
| 1343 |
</varlistentry> |
| 1344 |
|
| 1345 |
<varlistentry> |
| 1346 |
<term><option>--fuzz=<replaceable>timespan</replaceable></option></term> |
| 1347 |
|
| 1348 |
<listitem><para>When used in conjunction with the |
| 1349 |
<command>critical-chain</command> command (see above), also |
| 1350 |
show units, which finished <replaceable>timespan</replaceable> |
| 1351 |
earlier, than the latest unit in the same level. The unit of |
| 1352 |
<replaceable>timespan</replaceable> is seconds unless |
| 1353 |
specified with a different unit, e.g. |
| 1354 |
"50ms".</para> |
| 1355 |
|
| 1356 |
<xi:include href="version-info.xml" xpointer="v203"/></listitem> |
| 1357 |
</varlistentry> |
| 1358 |
|
| 1359 |
<varlistentry> |
| 1360 |
<term><option>--man=no</option></term> |
| 1361 |
|
| 1362 |
<listitem><para>Do not invoke |
| 1363 |
<citerefentry project='man-pages'><refentrytitle>man</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 1364 |
to verify the existence of man pages listed in <varname>Documentation=</varname>.</para> |
| 1365 |
|
| 1366 |
<xi:include href="version-info.xml" xpointer="v235"/></listitem> |
| 1367 |
</varlistentry> |
| 1368 |
|
| 1369 |
<varlistentry> |
| 1370 |
<term><option>--generators</option></term> |
| 1371 |
|
| 1372 |
<listitem><para>Invoke unit generators, see |
| 1373 |
<citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>. |
| 1374 |
Some generators require root privileges. Under a normal user, running with |
| 1375 |
generators enabled will generally result in some warnings.</para> |
| 1376 |
|
| 1377 |
<xi:include href="version-info.xml" xpointer="v235"/></listitem> |
| 1378 |
</varlistentry> |
| 1379 |
|
| 1380 |
<varlistentry> |
| 1381 |
<term><option>--instance=NAME</option></term> |
| 1382 |
|
| 1383 |
<listitem> |
| 1384 |
<para>Specifies fallback instance name for template units. This will be used when one or more |
| 1385 |
template units without an instance name (e.g. <filename>[email protected]</filename>) specified for |
| 1386 |
<command>systemd-analyze condition</command> with <option>--unit=</option>, |
| 1387 |
<command>systemd-analyze security</command>, and <command>systemd-analyze verify</command>. |
| 1388 |
If unspecified, <literal>test_instance</literal> will be used.</para> |
| 1389 |
|
| 1390 |
<xi:include href="version-info.xml" xpointer="v257"/> |
| 1391 |
</listitem> |
| 1392 |
</varlistentry> |
| 1393 |
|
| 1394 |
<varlistentry> |
| 1395 |
<term><option>--recursive-errors=<replaceable>MODE</replaceable></option></term> |
| 1396 |
|
| 1397 |
<listitem><para>Control verification of units and their dependencies and whether |
| 1398 |
<command>systemd-analyze verify</command> exits with a non-zero process exit status or not. With |
| 1399 |
<command>yes</command>, return a non-zero process exit status when warnings arise during verification |
| 1400 |
of either the specified unit or any of its associated dependencies. With <command>no</command>, |
| 1401 |
return a non-zero process exit status when warnings arise during verification of only the specified |
| 1402 |
unit. With <command>one</command>, return a non-zero process exit status when warnings arise during |
| 1403 |
verification of either the specified unit or its immediate dependencies. If this option is not |
| 1404 |
specified, zero is returned as the exit status regardless whether warnings arise during verification |
| 1405 |
or not.</para> |
| 1406 |
|
| 1407 |
<xi:include href="version-info.xml" xpointer="v250"/></listitem> |
| 1408 |
</varlistentry> |
| 1409 |
|
| 1410 |
<varlistentry> |
| 1411 |
<term><option>--root=<replaceable>PATH</replaceable></option></term> |
| 1412 |
|
| 1413 |
<listitem><para>With <command>cat-config</command>, <command>verify</command>, |
| 1414 |
<command>condition</command>, <command>unit-gdb</command>, and <command>security</command> when |
| 1415 |
used with <option>--offline=</option>, operate on files underneath the specified root path |
| 1416 |
<replaceable>PATH</replaceable>.</para> |
| 1417 |
|
| 1418 |
<xi:include href="version-info.xml" xpointer="v239"/></listitem> |
| 1419 |
</varlistentry> |
| 1420 |
|
| 1421 |
<varlistentry> |
| 1422 |
<term><option>--image=<replaceable>PATH</replaceable></option></term> |
| 1423 |
|
| 1424 |
<listitem><para>With <command>cat-config</command>, <command>verify</command>, |
| 1425 |
<command>condition</command> and <command>security</command> when used with |
| 1426 |
<option>--offline=</option>, operate on files inside the specified image path |
| 1427 |
<replaceable>PATH</replaceable>.</para> |
| 1428 |
|
| 1429 |
<xi:include href="version-info.xml" xpointer="v250"/></listitem> |
| 1430 |
</varlistentry> |
| 1431 |
|
| 1432 |
<xi:include href="standard-options.xml" xpointer="image-policy-open" /> |
| 1433 |
|
| 1434 |
<varlistentry> |
| 1435 |
<term><option>--offline=<replaceable>BOOL</replaceable></option></term> |
| 1436 |
|
| 1437 |
<listitem><para>With <command>security</command>, perform an offline security review |
| 1438 |
of the specified unit files, i.e. does not have to rely on PID 1 to acquire security |
| 1439 |
information for the files like the <command>security</command> verb when used by itself does. |
| 1440 |
This means that <option>--offline=</option> can be used with <option>--root=</option> and |
| 1441 |
<option>--image=</option> as well. If a unit's overall exposure level is above that set by |
| 1442 |
<option>--threshold=</option> (default value is 100), <option>--offline=</option> will return |
| 1443 |
an error.</para> |
| 1444 |
|
| 1445 |
<xi:include href="version-info.xml" xpointer="v250"/></listitem> |
| 1446 |
</varlistentry> |
| 1447 |
|
| 1448 |
<varlistentry> |
| 1449 |
<term><option>--profile=<replaceable>PATH</replaceable></option></term> |
| 1450 |
|
| 1451 |
<listitem><para>With <command>security</command> <option>--offline=</option>, takes into |
| 1452 |
consideration the specified portable profile when assessing unit settings. |
| 1453 |
The profile can be passed by name, in which case the well-known system locations will |
| 1454 |
be searched, or it can be the full path to a specific drop-in file.</para> |
| 1455 |
|
| 1456 |
<xi:include href="version-info.xml" xpointer="v250"/></listitem> |
| 1457 |
</varlistentry> |
| 1458 |
|
| 1459 |
<varlistentry> |
| 1460 |
<term><option>--threshold=<replaceable>NUMBER</replaceable></option></term> |
| 1461 |
|
| 1462 |
<listitem><para>With <command>security</command>, allow the user to set a custom value |
| 1463 |
to compare the overall exposure level with, for the specified unit files. If a unit's |
| 1464 |
overall exposure level, is greater than that set by the user, <command>security</command> |
| 1465 |
will return an error. <option>--threshold=</option> can be used with <option>--offline=</option> |
| 1466 |
as well and its default value is 100.</para> |
| 1467 |
|
| 1468 |
<xi:include href="version-info.xml" xpointer="v250"/></listitem> |
| 1469 |
</varlistentry> |
| 1470 |
|
| 1471 |
<varlistentry> |
| 1472 |
<term><option>--security-policy=<replaceable>PATH</replaceable></option></term> |
| 1473 |
|
| 1474 |
<listitem><para>With <command>security</command>, allow the user to define a custom set of |
| 1475 |
requirements formatted as a JSON file against which to compare the specified unit file(s) |
| 1476 |
and determine their overall exposure level to security threats.</para> |
| 1477 |
|
| 1478 |
<table> |
| 1479 |
<title>Accepted Assessment Test Identifiers</title> |
| 1480 |
|
| 1481 |
<tgroup cols='1'> |
| 1482 |
<colspec colname='directive' /> |
| 1483 |
<thead> |
| 1484 |
<row> |
| 1485 |
<entry>Assessment Test Identifier</entry> |
| 1486 |
</row> |
| 1487 |
</thead> |
| 1488 |
<tbody> |
| 1489 |
<row> |
| 1490 |
<entry>UserOrDynamicUser</entry> |
| 1491 |
</row> |
| 1492 |
<row> |
| 1493 |
<entry>SupplementaryGroups</entry> |
| 1494 |
</row> |
| 1495 |
<row> |
| 1496 |
<entry>PrivateMounts</entry> |
| 1497 |
</row> |
| 1498 |
<row> |
| 1499 |
<entry>PrivateDevices</entry> |
| 1500 |
</row> |
| 1501 |
<row> |
| 1502 |
<entry>PrivateTmp</entry> |
| 1503 |
</row> |
| 1504 |
<row> |
| 1505 |
<entry>PrivateNetwork</entry> |
| 1506 |
</row> |
| 1507 |
<row> |
| 1508 |
<entry>PrivateUsers</entry> |
| 1509 |
</row> |
| 1510 |
<row> |
| 1511 |
<entry>ProtectControlGroups</entry> |
| 1512 |
</row> |
| 1513 |
<row> |
| 1514 |
<entry>ProtectKernelModules</entry> |
| 1515 |
</row> |
| 1516 |
<row> |
| 1517 |
<entry>ProtectKernelTunables</entry> |
| 1518 |
</row> |
| 1519 |
<row> |
| 1520 |
<entry>ProtectKernelLogs</entry> |
| 1521 |
</row> |
| 1522 |
<row> |
| 1523 |
<entry>ProtectClock</entry> |
| 1524 |
</row> |
| 1525 |
<row> |
| 1526 |
<entry>ProtectHome</entry> |
| 1527 |
</row> |
| 1528 |
<row> |
| 1529 |
<entry>ProtectHostname</entry> |
| 1530 |
</row> |
| 1531 |
<row> |
| 1532 |
<entry>ProtectSystem</entry> |
| 1533 |
</row> |
| 1534 |
<row> |
| 1535 |
<entry>RootDirectoryOrRootImage</entry> |
| 1536 |
</row> |
| 1537 |
<row> |
| 1538 |
<entry>LockPersonality</entry> |
| 1539 |
</row> |
| 1540 |
<row> |
| 1541 |
<entry>MemoryDenyWriteExecute</entry> |
| 1542 |
</row> |
| 1543 |
<row> |
| 1544 |
<entry>NoNewPrivileges</entry> |
| 1545 |
</row> |
| 1546 |
<row> |
| 1547 |
<entry>CapabilityBoundingSet_CAP_SYS_ADMIN</entry> |
| 1548 |
</row> |
| 1549 |
<row> |
| 1550 |
<entry>CapabilityBoundingSet_CAP_SET_UID_GID_PCAP</entry> |
| 1551 |
</row> |
| 1552 |
<row> |
| 1553 |
<entry>CapabilityBoundingSet_CAP_SYS_PTRACE</entry> |
| 1554 |
</row> |
| 1555 |
<row> |
| 1556 |
<entry>CapabilityBoundingSet_CAP_SYS_TIME</entry> |
| 1557 |
</row> |
| 1558 |
<row> |
| 1559 |
<entry>CapabilityBoundingSet_CAP_NET_ADMIN</entry> |
| 1560 |
</row> |
| 1561 |
<row> |
| 1562 |
<entry>CapabilityBoundingSet_CAP_SYS_RAWIO</entry> |
| 1563 |
</row> |
| 1564 |
<row> |
| 1565 |
<entry>CapabilityBoundingSet_CAP_SYS_MODULE</entry> |
| 1566 |
</row> |
| 1567 |
<row> |
| 1568 |
<entry>CapabilityBoundingSet_CAP_AUDIT</entry> |
| 1569 |
</row> |
| 1570 |
<row> |
| 1571 |
<entry>CapabilityBoundingSet_CAP_SYSLOG</entry> |
| 1572 |
</row> |
| 1573 |
<row> |
| 1574 |
<entry>CapabilityBoundingSet_CAP_SYS_NICE_RESOURCE</entry> |
| 1575 |
</row> |
| 1576 |
<row> |
| 1577 |
<entry>CapabilityBoundingSet_CAP_MKNOD</entry> |
| 1578 |
</row> |
| 1579 |
<row> |
| 1580 |
<entry>CapabilityBoundingSet_CAP_CHOWN_FSETID_SETFCAP</entry> |
| 1581 |
</row> |
| 1582 |
<row> |
| 1583 |
<entry>CapabilityBoundingSet_CAP_DAC_FOWNER_IPC_OWNER</entry> |
| 1584 |
</row> |
| 1585 |
<row> |
| 1586 |
<entry>CapabilityBoundingSet_CAP_KILL</entry> |
| 1587 |
</row> |
| 1588 |
<row> |
| 1589 |
<entry>CapabilityBoundingSet_CAP_NET_BIND_SERVICE_BROADCAST_RAW</entry> |
| 1590 |
</row> |
| 1591 |
<row> |
| 1592 |
<entry>CapabilityBoundingSet_CAP_SYS_BOOT</entry> |
| 1593 |
</row> |
| 1594 |
<row> |
| 1595 |
<entry>CapabilityBoundingSet_CAP_MAC</entry> |
| 1596 |
</row> |
| 1597 |
<row> |
| 1598 |
<entry>CapabilityBoundingSet_CAP_LINUX_IMMUTABLE</entry> |
| 1599 |
</row> |
| 1600 |
<row> |
| 1601 |
<entry>CapabilityBoundingSet_CAP_IPC_LOCK</entry> |
| 1602 |
</row> |
| 1603 |
<row> |
| 1604 |
<entry>CapabilityBoundingSet_CAP_SYS_CHROOT</entry> |
| 1605 |
</row> |
| 1606 |
<row> |
| 1607 |
<entry>CapabilityBoundingSet_CAP_BLOCK_SUSPEND</entry> |
| 1608 |
</row> |
| 1609 |
<row> |
| 1610 |
<entry>CapabilityBoundingSet_CAP_WAKE_ALARM</entry> |
| 1611 |
</row> |
| 1612 |
<row> |
| 1613 |
<entry>CapabilityBoundingSet_CAP_LEASE</entry> |
| 1614 |
</row> |
| 1615 |
<row> |
| 1616 |
<entry>CapabilityBoundingSet_CAP_SYS_TTY_CONFIG</entry> |
| 1617 |
</row> |
| 1618 |
<row> |
| 1619 |
<entry>CapabilityBoundingSet_CAP_BPF</entry> |
| 1620 |
</row> |
| 1621 |
<row> |
| 1622 |
<entry>UMask</entry> |
| 1623 |
</row> |
| 1624 |
<row> |
| 1625 |
<entry>KeyringMode</entry> |
| 1626 |
</row> |
| 1627 |
<row> |
| 1628 |
<entry>ProtectProc</entry> |
| 1629 |
</row> |
| 1630 |
<row> |
| 1631 |
<entry>ProcSubset</entry> |
| 1632 |
</row> |
| 1633 |
<row> |
| 1634 |
<entry>NotifyAccess</entry> |
| 1635 |
</row> |
| 1636 |
<row> |
| 1637 |
<entry>RemoveIPC</entry> |
| 1638 |
</row> |
| 1639 |
<row> |
| 1640 |
<entry>Delegate</entry> |
| 1641 |
</row> |
| 1642 |
<row> |
| 1643 |
<entry>RestrictRealtime</entry> |
| 1644 |
</row> |
| 1645 |
<row> |
| 1646 |
<entry>RestrictSUIDSGID</entry> |
| 1647 |
</row> |
| 1648 |
<row> |
| 1649 |
<entry>RestrictNamespaces_user</entry> |
| 1650 |
</row> |
| 1651 |
<row> |
| 1652 |
<entry>RestrictNamespaces_mnt</entry> |
| 1653 |
</row> |
| 1654 |
<row> |
| 1655 |
<entry>RestrictNamespaces_ipc</entry> |
| 1656 |
</row> |
| 1657 |
<row> |
| 1658 |
<entry>RestrictNamespaces_pid</entry> |
| 1659 |
</row> |
| 1660 |
<row> |
| 1661 |
<entry>RestrictNamespaces_cgroup</entry> |
| 1662 |
</row> |
| 1663 |
<row> |
| 1664 |
<entry>RestrictNamespaces_uts</entry> |
| 1665 |
</row> |
| 1666 |
<row> |
| 1667 |
<entry>RestrictNamespaces_net</entry> |
| 1668 |
</row> |
| 1669 |
<row> |
| 1670 |
<entry>RestrictAddressFamilies_AF_INET_INET6</entry> |
| 1671 |
</row> |
| 1672 |
<row> |
| 1673 |
<entry>RestrictAddressFamilies_AF_UNIX</entry> |
| 1674 |
</row> |
| 1675 |
<row> |
| 1676 |
<entry>RestrictAddressFamilies_AF_NETLINK</entry> |
| 1677 |
</row> |
| 1678 |
<row> |
| 1679 |
<entry>RestrictAddressFamilies_AF_PACKET</entry> |
| 1680 |
</row> |
| 1681 |
<row> |
| 1682 |
<entry>RestrictAddressFamilies_OTHER</entry> |
| 1683 |
</row> |
| 1684 |
<row> |
| 1685 |
<entry>SystemCallArchitectures</entry> |
| 1686 |
</row> |
| 1687 |
<row> |
| 1688 |
<entry>SystemCallFilter_swap</entry> |
| 1689 |
</row> |
| 1690 |
<row> |
| 1691 |
<entry>SystemCallFilter_obsolete</entry> |
| 1692 |
</row> |
| 1693 |
<row> |
| 1694 |
<entry>SystemCallFilter_clock</entry> |
| 1695 |
</row> |
| 1696 |
<row> |
| 1697 |
<entry>SystemCallFilter_cpu_emulation</entry> |
| 1698 |
</row> |
| 1699 |
<row> |
| 1700 |
<entry>SystemCallFilter_debug</entry> |
| 1701 |
</row> |
| 1702 |
<row> |
| 1703 |
<entry>SystemCallFilter_mount</entry> |
| 1704 |
</row> |
| 1705 |
<row> |
| 1706 |
<entry>SystemCallFilter_module</entry> |
| 1707 |
</row> |
| 1708 |
<row> |
| 1709 |
<entry>SystemCallFilter_raw_io</entry> |
| 1710 |
</row> |
| 1711 |
<row> |
| 1712 |
<entry>SystemCallFilter_reboot</entry> |
| 1713 |
</row> |
| 1714 |
<row> |
| 1715 |
<entry>SystemCallFilter_privileged</entry> |
| 1716 |
</row> |
| 1717 |
<row> |
| 1718 |
<entry>SystemCallFilter_resources</entry> |
| 1719 |
</row> |
| 1720 |
<row> |
| 1721 |
<entry>IPAddressDeny</entry> |
| 1722 |
</row> |
| 1723 |
<row> |
| 1724 |
<entry>DeviceAllow</entry> |
| 1725 |
</row> |
| 1726 |
<row> |
| 1727 |
<entry>AmbientCapabilities</entry> |
| 1728 |
</row> |
| 1729 |
</tbody> |
| 1730 |
</tgroup> |
| 1731 |
</table> |
| 1732 |
|
| 1733 |
<para>See example "JSON Policy" below.</para> |
| 1734 |
|
| 1735 |
<xi:include href="version-info.xml" xpointer="v250"/></listitem> |
| 1736 |
</varlistentry> |
| 1737 |
|
| 1738 |
<varlistentry> |
| 1739 |
<term><option>--json=<replaceable>MODE</replaceable></option></term> |
| 1740 |
|
| 1741 |
<listitem><para>With the <command>security</command> command, generate a JSON formatted |
| 1742 |
output of the security analysis table. The format is a JSON array with objects |
| 1743 |
containing the following fields: <varname>set</varname> which indicates if the setting has |
| 1744 |
been enabled or not, <varname>name</varname> which is what is used to refer to the setting, |
| 1745 |
<varname>json_field</varname> which is the JSON compatible identifier of the setting, |
| 1746 |
<varname>description</varname> which is an outline of the setting state, and |
| 1747 |
<varname>exposure</varname> which is a number in the range 0.0…10.0, where a higher value |
| 1748 |
corresponds to a higher security threat. The JSON version of the table is printed to standard |
| 1749 |
output. The <replaceable>MODE</replaceable> passed to the option can be one of three: |
| 1750 |
<option>off</option> which is the default, <option>pretty</option> and <option>short</option> |
| 1751 |
which respectively output a prettified or shorted JSON version of the security table. |
| 1752 |
|
| 1753 |
With the <command>plot</command> command, generate a JSON formatted output of the raw time data. |
| 1754 |
The format is a JSON array with objects containing the following fields: <varname>name</varname> |
| 1755 |
which is the unit name, <varname>activated</varname> which is the time after startup the |
| 1756 |
service was activated, <varname>activating</varname> which is how long after startup the service |
| 1757 |
was initially started, <varname>time</varname> which is how long the service took to activate |
| 1758 |
from when it was initially started, <varname>deactivated</varname> which is the time after startup |
| 1759 |
that the service was deactivated, <varname>deactivating</varname> which is the time after startup |
| 1760 |
that the service was initially told to deactivate. |
| 1761 |
</para> |
| 1762 |
|
| 1763 |
<xi:include href="version-info.xml" xpointer="v250"/></listitem> |
| 1764 |
</varlistentry> |
| 1765 |
|
| 1766 |
<varlistentry> |
| 1767 |
<term><option>--iterations=<replaceable>NUMBER</replaceable></option></term> |
| 1768 |
|
| 1769 |
<listitem><para>When used with the <command>calendar</command> command, show the specified number of |
| 1770 |
iterations the specified calendar expression will elapse next. Defaults to 1.</para> |
| 1771 |
|
| 1772 |
<xi:include href="version-info.xml" xpointer="v242"/></listitem> |
| 1773 |
</varlistentry> |
| 1774 |
|
| 1775 |
<varlistentry> |
| 1776 |
<term><option>--base-time=<replaceable>TIMESTAMP</replaceable></option></term> |
| 1777 |
|
| 1778 |
<listitem><para>When used with the <command>calendar</command> command, show next iterations relative |
| 1779 |
to the specified point in time. If not specified, defaults to the current time.</para> |
| 1780 |
|
| 1781 |
<xi:include href="version-info.xml" xpointer="v244"/></listitem> |
| 1782 |
</varlistentry> |
| 1783 |
|
| 1784 |
<varlistentry> |
| 1785 |
<term><option>--unit=<replaceable>UNIT</replaceable></option></term> |
| 1786 |
|
| 1787 |
<listitem><para>When used with the <command>condition</command> command, evaluate all the |
| 1788 |
<varname index="false">Condition*=...</varname> and <varname index="false">Assert*=...</varname> |
| 1789 |
assignments in the specified unit file. The full unit search path is formed by combining the |
| 1790 |
directories for the specified unit with the usual unit load paths. The variable |
| 1791 |
<varname>$SYSTEMD_UNIT_PATH</varname> is supported, and may be used to replace or augment the |
| 1792 |
compiled in set of unit load paths; see |
| 1793 |
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. All |
| 1794 |
units files present in the directory containing the specified unit will be used in preference to the |
| 1795 |
other paths. If a template unit without an instance name is specified (e.g. |
| 1796 |
<filename>[email protected]</filename>), <literal>test_instance</literal> will be used as the instance |
| 1797 |
name, which can be controlled by <option>--instance=</option> option.</para> |
| 1798 |
|
| 1799 |
<xi:include href="version-info.xml" xpointer="v250"/></listitem> |
| 1800 |
</varlistentry> |
| 1801 |
|
| 1802 |
<varlistentry> |
| 1803 |
<term><option>--table</option></term> |
| 1804 |
|
| 1805 |
<listitem><para>When used with the <command>plot</command> command, the raw time data is output in a table. |
| 1806 |
</para> |
| 1807 |
|
| 1808 |
<xi:include href="version-info.xml" xpointer="v253"/></listitem> |
| 1809 |
</varlistentry> |
| 1810 |
|
| 1811 |
<varlistentry> |
| 1812 |
<term><option>--no-legend</option></term> |
| 1813 |
|
| 1814 |
<listitem><para>When used with the <command>plot</command> command in combination with either |
| 1815 |
<option>--table</option> or <option>--json=</option>, no legends or hints are included in the output. |
| 1816 |
</para> |
| 1817 |
|
| 1818 |
<xi:include href="version-info.xml" xpointer="v253"/></listitem> |
| 1819 |
</varlistentry> |
| 1820 |
|
| 1821 |
<xi:include href="user-system-options.xml" xpointer="host" /> |
| 1822 |
<xi:include href="user-system-options.xml" xpointer="machine" /> |
| 1823 |
|
| 1824 |
<varlistentry> |
| 1825 |
<term><option>-q</option></term> |
| 1826 |
<term><option>--quiet</option></term> |
| 1827 |
|
| 1828 |
<listitem><para>Suppress hints and other non-essential output.</para> |
| 1829 |
|
| 1830 |
<xi:include href="version-info.xml" xpointer="v250"/></listitem> |
| 1831 |
</varlistentry> |
| 1832 |
|
| 1833 |
<varlistentry> |
| 1834 |
<term><option>--tldr</option></term> |
| 1835 |
|
| 1836 |
<listitem><para>With <command>cat-config</command>, only print the "interesting" parts of the |
| 1837 |
configuration files, skipping comments and empty lines and section headers followed only by |
| 1838 |
comments and empty lines.</para> |
| 1839 |
|
| 1840 |
<xi:include href="version-info.xml" xpointer="v255"/></listitem> |
| 1841 |
</varlistentry> |
| 1842 |
|
| 1843 |
<varlistentry> |
| 1844 |
<term><option>--scale-svg=<replaceable>FACTOR</replaceable></option></term> |
| 1845 |
|
| 1846 |
<listitem><para>When used with the <command>plot</command> command, the x-axis of the plot |
| 1847 |
can be stretched by FACTOR (default: 1.0).</para> |
| 1848 |
|
| 1849 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 1850 |
</varlistentry> |
| 1851 |
|
| 1852 |
<varlistentry> |
| 1853 |
<term><option>--detailed</option></term> |
| 1854 |
|
| 1855 |
<listitem><para>When used with the <command>plot</command> command, activation timestamps |
| 1856 |
details can be seen in SVG plot.</para> |
| 1857 |
|
| 1858 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 1859 |
</varlistentry> |
| 1860 |
|
| 1861 |
<varlistentry> |
| 1862 |
<term><option>--drm-device=<replaceable>PATH</replaceable></option></term> |
| 1863 |
|
| 1864 |
<listitem><para>When provided with the <command>chid</command> command, use this sysfs path to a DRM |
| 1865 |
device to fetch EDID from. Example: <filename>/sys/class/drm/card1-HDMI-A-1/</filename></para> |
| 1866 |
|
| 1867 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 1868 |
</varlistentry> |
| 1869 |
|
| 1870 |
<varlistentry> |
| 1871 |
<term><option>--debugger=<replaceable>DEBUGGER</replaceable></option></term> |
| 1872 |
|
| 1873 |
<listitem><para>Use the given debugger for the <command>unit-gdb</command> command. If not given and |
| 1874 |
<varname>$SYSTEMD_DEBUGGER</varname> is unset, then |
| 1875 |
<citerefentry project='man-pages'><refentrytitle>gdb</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 1876 |
will be used.</para> |
| 1877 |
|
| 1878 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 1879 |
</varlistentry> |
| 1880 |
|
| 1881 |
<varlistentry> |
| 1882 |
<term><option>-A</option> <replaceable>ARGS</replaceable></term> |
| 1883 |
<term><option>--debugger-arguments=<replaceable>ARGS</replaceable></option></term> |
| 1884 |
|
| 1885 |
<listitem><para>Pass the given <replaceable>ARGS</replaceable> as extra command line arguments to the debugger.</para> |
| 1886 |
|
| 1887 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 1888 |
</varlistentry> |
| 1889 |
|
| 1890 |
<xi:include href="standard-options.xml" xpointer="help" /> |
| 1891 |
<xi:include href="standard-options.xml" xpointer="version" /> |
| 1892 |
<xi:include href="standard-options.xml" xpointer="no-pager" /> |
| 1893 |
</variablelist> |
| 1894 |
|
| 1895 |
</refsect1> |
| 1896 |
|
| 1897 |
<refsect1> |
| 1898 |
<title>Exit status</title> |
| 1899 |
|
| 1900 |
<para>For most verbs, <constant>0</constant> is returned on success, and a non-zero failure code |
| 1901 |
otherwise.</para> |
| 1902 |
|
| 1903 |
<para>For the verb <command>compare-versions</command>, in the two-argument form, |
| 1904 |
<constant>12</constant>, <constant>0</constant>, or <constant>11</constant> are returned if the second |
| 1905 |
version string is respectively larger than, equal to, or smaller than the first. In the three-argument |
| 1906 |
form, <constant>0</constant> or <constant>1</constant> are returned when the condition is respectively |
| 1907 |
true or false.</para> |
| 1908 |
|
| 1909 |
<para>For the verb <command>has-tpm2</command>, <constant>0</constant> is returned if a TPM2 device is |
| 1910 |
discovered, supported, and used by firmware, driver, and userspace (i.e. <command>systemd</command>). |
| 1911 |
Otherwise, the OR combination of the value <constant>1</constant> (in case firmware support is missing), |
| 1912 |
<constant>2</constant> (in case driver support is missing), and <constant>4</constant> (in case userspace |
| 1913 |
support is missing). If no TPM2 support is available at all, value <constant>7</constant> is hence |
| 1914 |
returned.</para> |
| 1915 |
</refsect1> |
| 1916 |
|
| 1917 |
<xi:include href="common-variables.xml" /> |
| 1918 |
|
| 1919 |
<refsect1> |
| 1920 |
<title>Examples</title> |
| 1921 |
|
| 1922 |
<example> |
| 1923 |
<title>JSON Policy</title> |
| 1924 |
|
| 1925 |
<para>The JSON file passed as a path parameter to <option>--security-policy=</option> has a top-level |
| 1926 |
JSON object, with keys being the assessment test identifiers mentioned above. The values in the file |
| 1927 |
should be JSON objects with one or more of the following fields: <option>description_na</option> |
| 1928 |
(string), <option>description_good</option> (string), <option>description_bad</option> (string), |
| 1929 |
<option>weight</option> (unsigned integer), and <option>range</option> (unsigned integer). If any of |
| 1930 |
these fields corresponding to a specific id of the unit file is missing from the JSON object, the |
| 1931 |
default built-in field value corresponding to that same id is used for security analysis as default. |
| 1932 |
The weight and range fields are used in determining the overall exposure level of the unit files: the |
| 1933 |
value of each setting is assigned a badness score, which is multiplied by the policy weight and divided |
| 1934 |
by the policy range to determine the overall exposure that the setting implies. The computed badness is |
| 1935 |
summed across all settings in the unit file, normalized to the 1…100 range, and used to determine the |
| 1936 |
overall exposure level of the unit. By allowing users to manipulate these fields, the 'security' verb |
| 1937 |
gives them the option to decide for themself which ids are more important and hence should have a |
| 1938 |
greater effect on the exposure level. A weight of <literal>0</literal> means the setting will not be |
| 1939 |
checked.</para> |
| 1940 |
|
| 1941 |
<programlisting> |
| 1942 |
{ |
| 1943 |
"PrivateDevices": |
| 1944 |
{ |
| 1945 |
"description_good": "Service has no access to hardware devices", |
| 1946 |
"description_bad": "Service potentially has access to hardware devices", |
| 1947 |
"weight": 1000, |
| 1948 |
"range": 1 |
| 1949 |
}, |
| 1950 |
"PrivateMounts": |
| 1951 |
{ |
| 1952 |
"description_good": "Service cannot install system mounts", |
| 1953 |
"description_bad": "Service may install system mounts", |
| 1954 |
"weight": 1000, |
| 1955 |
"range": 1 |
| 1956 |
}, |
| 1957 |
"PrivateNetwork": |
| 1958 |
{ |
| 1959 |
"description_good": "Service has no access to the host's network", |
| 1960 |
"description_bad": "Service has access to the host's network", |
| 1961 |
"weight": 2500, |
| 1962 |
"range": 1 |
| 1963 |
}, |
| 1964 |
"PrivateTmp": |
| 1965 |
{ |
| 1966 |
"description_good": "Service has no access to other software's temporary files", |
| 1967 |
"description_bad": "Service has access to other software's temporary files", |
| 1968 |
"weight": 1000, |
| 1969 |
"range": 1 |
| 1970 |
}, |
| 1971 |
"PrivateUsers": |
| 1972 |
{ |
| 1973 |
"description_good": "Service does not have access to other users", |
| 1974 |
"description_bad": "Service has access to other users", |
| 1975 |
"weight": 1000, |
| 1976 |
"range": 1 |
| 1977 |
} |
| 1978 |
} |
| 1979 |
</programlisting> |
| 1980 |
</example> |
| 1981 |
</refsect1> |
| 1982 |
|
| 1983 |
<refsect1> |
| 1984 |
<title>See Also</title> |
| 1985 |
<para><simplelist type="inline"> |
| 1986 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 1987 |
<member><citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 1988 |
</simplelist></para> |
| 1989 |
</refsect1> |
| 1990 |
|
| 1991 |
</refentry> |