1SYSTEMD-ANALYZE(1) systemd-analyze SYSTEMD-ANALYZE(1)
2
3
4
6 systemd-analyze - Analyze and debug system manager
7
9 systemd-analyze [OPTIONS...] [time]
10
11 systemd-analyze [OPTIONS...] blame
12
13 systemd-analyze [OPTIONS...] critical-chain [UNIT...]
14
15 systemd-analyze [OPTIONS...] dump
16
17 systemd-analyze [OPTIONS...] plot [>file.svg]
18
19 systemd-analyze [OPTIONS...] dot [PATTERN...] [>file.dot]
20
21 systemd-analyze [OPTIONS...] unit-paths
22
23 systemd-analyze [OPTIONS...] exit-status [STATUS...]
24
25 systemd-analyze [OPTIONS...] capability [CAPABILITY...]
26
27 systemd-analyze [OPTIONS...] condition CONDITION...
28
29 systemd-analyze [OPTIONS...] syscall-filter [SET...]
30
31 systemd-analyze [OPTIONS...] filesystems [SET...]
32
33 systemd-analyze [OPTIONS...] calendar SPEC...
34
35 systemd-analyze [OPTIONS...] timestamp TIMESTAMP...
36
37 systemd-analyze [OPTIONS...] timespan SPAN...
38
39 systemd-analyze [OPTIONS...] cat-config NAME|PATH...
40
41 systemd-analyze [OPTIONS...] verify [FILE...]
42
43 systemd-analyze [OPTIONS...] security UNIT...
44
46 systemd-analyze may be used to determine system boot-up performance
47 statistics and retrieve other state and tracing information from the
48 system and service manager, and to verify the correctness of unit
49 files. It is also used to access special functions useful for advanced
50 system manager debugging.
51
52 If no command is passed, systemd-analyze time is implied.
53
54 systemd-analyze time
55 This command prints the time spent in the kernel before userspace has
56 been reached, the time spent in the initial RAM disk (initrd) before
57 normal system userspace has been reached, and the time normal system
58 userspace took to initialize. Note that these measurements simply
59 measure the time passed up to the point where all system services have
60 been spawned, but not necessarily until they fully finished
61 initialization or the disk is idle.
62
63 Example 1. Show how long the boot took
64
65 # in a container
66 $ systemd-analyze time
67 Startup finished in 296ms (userspace)
68 multi-user.target reached after 275ms in userspace
69
70 # on a real machine
71 $ systemd-analyze time
72 Startup finished in 2.584s (kernel) + 19.176s (initrd) + 47.847s (userspace) = 1min 9.608s
73 multi-user.target reached after 47.820s in userspace
74
75 systemd-analyze blame
76 This command prints a list of all running units, ordered by the time
77 they took to initialize. This information may be used to optimize
78 boot-up times. Note that the output might be misleading as the
79 initialization of one service might be slow simply because it waits for
80 the initialization of another service to complete. Also note:
81 systemd-analyze blame doesn't display results for services with
82 Type=simple, because systemd considers such services to be started
83 immediately, hence no measurement of the initialization delays can be
84 done. Also note that this command only shows the time units took for
85 starting up, it does not show how long unit jobs spent in the execution
86 queue. In particular it shows the time units spent in "activating"
87 state, which is not defined for units such as device units that
88 transition directly from "inactive" to "active". This command hence
89 gives an impression of the performance of program code, but cannot
90 accurately reflect latency introduced by waiting for hardware and
91 similar events.
92
93 Example 2. Show which units took the most time during boot
94
95 $ systemd-analyze blame
96 32.875s pmlogger.service
97 20.905s systemd-networkd-wait-online.service
98 13.299s dev-vda1.device
99 ...
100 23ms sysroot.mount
101 11ms initrd-udevadm-cleanup-db.service
102 3ms sys-kernel-config.mount
103
104
105 systemd-analyze critical-chain [UNIT...]
106 This command prints a tree of the time-critical chain of units (for
107 each of the specified UNITs or for the default target otherwise). The
108 time after the unit is active or started is printed after the "@"
109 character. The time the unit takes to start is printed after the "+"
110 character. Note that the output might be misleading as the
111 initialization of services might depend on socket activation and
112 because of the parallel execution of units. Also, similar to the blame
113 command, this only takes into account the time units spent in
114 "activating" state, and hence does not cover units that never went
115 through an "activating" state (such as device units that transition
116 directly from "inactive" to "active"). Moreover it does not show
117 information on jobs (and in particular not jobs that timed out).
118
119 Example 3. systemd-analyze critical-chain
120
121 $ systemd-analyze critical-chain
122 multi-user.target @47.820s
123 └─pmie.service @35.968s +548ms
124 └─pmcd.service @33.715s +2.247s
125 └─network-online.target @33.712s
126 └─systemd-networkd-wait-online.service @12.804s +20.905s
127 └─systemd-networkd.service @11.109s +1.690s
128 └─systemd-udevd.service @9.201s +1.904s
129 └─systemd-tmpfiles-setup-dev.service @7.306s +1.776s
130 └─kmod-static-nodes.service @6.976s +177ms
131 └─systemd-journald.socket
132 └─system.slice
133 └─-.slice
134
135 systemd-analyze dump
136 This command outputs a (usually very long) human-readable serialization
137 of the complete server state. Its format is subject to change without
138 notice and should not be parsed by applications.
139
140 Example 4. Show the internal state of user manager
141
142 $ systemd-analyze --user dump
143 Timestamp userspace: Thu 2019-03-14 23:28:07 CET
144 Timestamp finish: Thu 2019-03-14 23:28:07 CET
145 Timestamp generators-start: Thu 2019-03-14 23:28:07 CET
146 Timestamp generators-finish: Thu 2019-03-14 23:28:07 CET
147 Timestamp units-load-start: Thu 2019-03-14 23:28:07 CET
148 Timestamp units-load-finish: Thu 2019-03-14 23:28:07 CET
149 -> Unit proc-timer_list.mount:
150 Description: /proc/timer_list
151 ...
152 -> Unit default.target:
153 Description: Main user target
154 ...
155
156 systemd-analyze plot
157 This command prints an SVG graphic detailing which system services have
158 been started at what time, highlighting the time they spent on
159 initialization.
160
161 Example 5. Plot a bootchart
162
163 $ systemd-analyze plot >bootup.svg
164 $ eog bootup.svg&
165
166 systemd-analyze dot [pattern...]
167 This command generates textual dependency graph description in dot
168 format for further processing with the GraphViz dot(1) tool. Use a
169 command line like systemd-analyze dot | dot -Tsvg >systemd.svg to
170 generate a graphical dependency tree. Unless --order or --require is
171 passed, the generated graph will show both ordering and requirement
172 dependencies. Optional pattern globbing style specifications (e.g.
173 *.target) may be given at the end. A unit dependency is included in the
174 graph if any of these patterns match either the origin or destination
175 node.
176
177 Example 6. Plot all dependencies of any unit whose name starts with
178 "avahi-daemon"
179
180 $ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg >avahi.svg
181 $ eog avahi.svg
182
183 Example 7. Plot the dependencies between all known target units
184
185 $ systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' \
186 | dot -Tsvg >targets.svg
187 $ eog targets.svg
188
189 systemd-analyze unit-paths
190 This command outputs a list of all directories from which unit files,
191 .d overrides, and .wants, .requires symlinks may be loaded. Combine
192 with --user to retrieve the list for the user manager instance, and
193 --global for the global configuration of user manager instances.
194
195 Example 8. Show all paths for generated units
196
197 $ systemd-analyze unit-paths | grep '^/run'
198 /run/systemd/system.control
199 /run/systemd/transient
200 /run/systemd/generator.early
201 /run/systemd/system
202 /run/systemd/system.attached
203 /run/systemd/generator
204 /run/systemd/generator.late
205
206 Note that this verb prints the list that is compiled into
207 systemd-analyze itself, and does not communicate with the running
208 manager. Use
209
210 systemctl [--user] [--global] show -p UnitPath --value
211
212 to retrieve the actual list that the manager uses, with any empty
213 directories omitted.
214
215 systemd-analyze exit-status [STATUS...]
216 This command prints a list of exit statuses along with their "class",
217 i.e. the source of the definition (one of "glibc", "systemd", "LSB", or
218 "BSD"), see the Process Exit Codes section in systemd.exec(5). If no
219 additional arguments are specified, all known statuses are shown.
220 Otherwise, only the definitions for the specified codes are shown.
221
222 Example 9. Show some example exit status names
223
224 $ systemd-analyze exit-status 0 1 {63..65}
225 NAME STATUS CLASS
226 SUCCESS 0 glibc
227 FAILURE 1 glibc
228 - 63 -
229 USAGE 64 BSD
230 DATAERR 65 BSD
231
232 systemd-analyze capability [CAPABILITY...]
233 This command prints a list of Linux capabilities along with their
234 numeric IDs. See capabilities(7) for details. If no argument is
235 specified the full list of capabilities known to the service manager
236 and the kernel is shown. Capabilities defined by the kernel but not
237 known to the service manager are shown as "cap_???". Optionally, if
238 arguments are specified they may refer to specific cabilities by name
239 or numeric ID, in which case only the indicated capabilities are shown
240 in the table.
241
242 Example 10. Show some example capability names
243
244 $ systemd-analyze capability 0 1 {30..32}
245 NAME NUMBER
246 cap_chown 0
247 cap_dac_override 1
248 cap_audit_control 30
249 cap_setfcap 31
250 cap_mac_override 32
251
252 systemd-analyze condition CONDITION...
253 This command will evaluate Condition*=... and Assert*=...
254 assignments, and print their values, and the resulting value of the
255 combined condition set. See systemd.unit(5) for a list of available
256 conditions and asserts.
257
258 Example 11. Evaluate conditions that check kernel versions
259
260 $ systemd-analyze condition 'ConditionKernelVersion = ! <4.0' \
261 'ConditionKernelVersion = >=5.1' \
262 'ConditionACPower=|false' \
263 'ConditionArchitecture=|!arm' \
264 'AssertPathExists=/etc/os-release'
265 test.service: AssertPathExists=/etc/os-release succeeded.
266 Asserts succeeded.
267 test.service: ConditionArchitecture=|!arm succeeded.
268 test.service: ConditionACPower=|false failed.
269 test.service: ConditionKernelVersion=>=5.1 succeeded.
270 test.service: ConditionKernelVersion=!<4.0 succeeded.
271 Conditions succeeded.
272
273 systemd-analyze syscall-filter [SET...]
274 This command will list system calls contained in the specified system
275 call set SET, or all known sets if no sets are specified. Argument SET
276 must include the "@" prefix.
277
278 systemd-analyze filesystems [SET...]
279 This command will list filesystems in the specified filesystem set SET,
280 or all known sets if no sets are specified. Argument SET must include
281 the "@" prefix.
282
283 systemd-analyze calendar EXPRESSION...
284 This command will parse and normalize repetitive calendar time events,
285 and will calculate when they elapse next. This takes the same input as
286 the OnCalendar= setting in systemd.timer(5), following the syntax
287 described in systemd.time(7). By default, only the next time the
288 calendar expression will elapse is shown; use --iterations= to show the
289 specified number of next times the expression elapses. Each time the
290 expression elapses forms a timestamp, see the timestamp verb below.
291
292 Example 12. Show leap days in the near future
293
294 $ systemd-analyze calendar --iterations=5 '*-2-29 0:0:0'
295 Original form: *-2-29 0:0:0
296 Normalized form: *-02-29 00:00:00
297 Next elapse: Sat 2020-02-29 00:00:00 UTC
298 From now: 11 months 15 days left
299 Iter. #2: Thu 2024-02-29 00:00:00 UTC
300 From now: 4 years 11 months left
301 Iter. #3: Tue 2028-02-29 00:00:00 UTC
302 From now: 8 years 11 months left
303 Iter. #4: Sun 2032-02-29 00:00:00 UTC
304 From now: 12 years 11 months left
305 Iter. #5: Fri 2036-02-29 00:00:00 UTC
306 From now: 16 years 11 months left
307
308 systemd-analyze timestamp TIMESTAMP...
309 This command parses a timestamp (i.e. a single point in time) and
310 outputs the normalized form and the difference between this timestamp
311 and now. The timestamp should adhere to the syntax documented in
312 systemd.time(7), section "PARSING TIMESTAMPS".
313
314 Example 13. Show parsing of timestamps
315
316 $ systemd-analyze timestamp yesterday now tomorrow
317 Original form: yesterday
318 Normalized form: Mon 2019-05-20 00:00:00 CEST
319 (in UTC): Sun 2019-05-19 22:00:00 UTC
320 UNIX seconds: @15583032000
321 From now: 1 day 9h ago
322
323 Original form: now
324 Normalized form: Tue 2019-05-21 09:48:39 CEST
325 (in UTC): Tue 2019-05-21 07:48:39 UTC
326 UNIX seconds: @1558424919.659757
327 From now: 43us ago
328
329 Original form: tomorrow
330 Normalized form: Wed 2019-05-22 00:00:00 CEST
331 (in UTC): Tue 2019-05-21 22:00:00 UTC
332 UNIX seconds: @15584760000
333 From now: 14h left
334
335 systemd-analyze timespan EXPRESSION...
336 This command parses a time span (i.e. a difference between two
337 timestamps) and outputs the normalized form and the equivalent value in
338 microseconds. The time span should adhere to the syntax documented in
339 systemd.time(7), section "PARSING TIME SPANS". Values without units are
340 parsed as seconds.
341
342 Example 14. Show parsing of timespans
343
344 $ systemd-analyze timespan 1s 300s '1year 0.000001s'
345 Original: 1s
346 μs: 1000000
347 Human: 1s
348
349 Original: 300s
350 μs: 300000000
351 Human: 5min
352
353 Original: 1year 0.000001s
354 μs: 31557600000001
355 Human: 1y 1us
356
357 systemd-analyze cat-config NAME|PATH...
358 This command is similar to systemctl cat, but operates on config files.
359 It will copy the contents of a config file and any drop-ins to standard
360 output, using the usual systemd set of directories and rules for
361 precedence. Each argument must be either an absolute path including the
362 prefix (such as /etc/systemd/logind.conf or
363 /usr/lib/systemd/logind.conf), or a name relative to the prefix (such
364 as systemd/logind.conf).
365
366 Example 15. Showing logind configuration
367
368 $ systemd-analyze cat-config systemd/logind.conf
369 # /etc/systemd/logind.conf
370 ...
371 [Login]
372 NAutoVTs=8
373 ...
374
375 # /usr/lib/systemd/logind.conf.d/20-test.conf
376 ... some override from another package
377
378 # /etc/systemd/logind.conf.d/50-override.conf
379 ... some administrator override
380
381
382 systemd-analyze verify FILE...
383 This command will load unit files and print warnings if any errors are
384 detected. Files specified on the command line will be loaded, but also
385 any other units referenced by them. A unit's name on disk can be
386 overridden by specifying an alias after a colon; see below for an
387 example. The full unit search path is formed by combining the
388 directories for all command line arguments, and the usual unit load
389 paths. The variable $SYSTEMD_UNIT_PATH is supported, and may be used to
390 replace or augment the compiled in set of unit load paths; see
391 systemd.unit(5). All units files present in the directories containing
392 the command line arguments will be used in preference to the other
393 paths.
394
395 The following errors are currently detected:
396
397 • unknown sections and directives,
398
399 • missing dependencies which are required to start the given unit,
400
401 • man pages listed in Documentation= which are not found in the
402 system,
403
404 • commands listed in ExecStart= and similar which are not found in
405 the system or not executable.
406
407 Example 16. Misspelt directives
408
409 $ cat ./user.slice
410 [Unit]
411 WhatIsThis=11
412 Documentation=man:nosuchfile(1)
413 Requires=different.service
414
415 [Service]
416 Description=x
417
418 $ systemd-analyze verify ./user.slice
419 [./user.slice:9] Unknown lvalue 'WhatIsThis' in section 'Unit'
420 [./user.slice:13] Unknown section 'Service'. Ignoring.
421 Error: org.freedesktop.systemd1.LoadFailed:
422 Unit different.service failed to load:
423 No such file or directory.
424 Failed to create user.slice/start: Invalid argument
425 user.slice: man nosuchfile(1) command failed with code 16
426
427
428 Example 17. Missing service units
429
430 $ tail ./a.socket ./b.socket
431 ==> ./a.socket <==
432 [Socket]
433 ListenStream=100
434
435 ==> ./b.socket <==
436 [Socket]
437 ListenStream=100
438 Accept=yes
439
440 $ systemd-analyze verify ./a.socket ./b.socket
441 Service a.service not loaded, a.socket cannot be started.
442 Service b@0.service not loaded, b.socket cannot be started.
443
444
445 Example 18. Aliasing a unit
446
447 $ cat /tmp/source
448 [Unit]
449 Description=Hostname printer
450
451 [Service]
452 Type=simple
453 ExecStart=/usr/bin/echo %H
454 MysteryKey=true
455
456 $ systemd-analyze verify /tmp/source
457 Failed to prepare filename /tmp/source: Invalid argument
458
459 $ systemd-analyze verify /tmp/source:alias.service
460 /tmp/systemd-analyze-XXXXXX/alias.service:7: Unknown key name 'MysteryKey' in section 'Service', ignoring.
461
462
463 systemd-analyze security [UNIT...]
464 This command analyzes the security and sandboxing settings of one or
465 more specified service units. If at least one unit name is specified
466 the security settings of the specified service units are inspected and
467 a detailed analysis is shown. If no unit name is specified, all
468 currently loaded, long-running service units are inspected and a terse
469 table with results shown. The command checks for various
470 security-related service settings, assigning each a numeric "exposure
471 level" value, depending on how important a setting is. It then
472 calculates an overall exposure level for the whole unit, which is an
473 estimation in the range 0.0...10.0 indicating how exposed a service is
474 security-wise. High exposure levels indicate very little applied
475 sandboxing. Low exposure levels indicate tight sandboxing and strongest
476 security restrictions. Note that this only analyzes the per-service
477 security features systemd itself implements. This means that any
478 additional security mechanisms applied by the service code itself are
479 not accounted for. The exposure level determined this way should not be
480 misunderstood: a high exposure level neither means that there is no
481 effective sandboxing applied by the service code itself, nor that the
482 service is actually vulnerable to remote or local attacks. High
483 exposure levels do indicate however that most likely the service might
484 benefit from additional settings applied to them.
485
486 Please note that many of the security and sandboxing settings
487 individually can be circumvented — unless combined with others. For
488 example, if a service retains the privilege to establish or undo mount
489 points many of the sandboxing options can be undone by the service code
490 itself. Due to that is essential that each service uses the most
491 comprehensive and strict sandboxing and security settings possible. The
492 tool will take into account some of these combinations and
493 relationships between the settings, but not all. Also note that the
494 security and sandboxing settings analyzed here only apply to the
495 operations executed by the service code itself. If a service has access
496 to an IPC system (such as D-Bus) it might request operations from other
497 services that are not subject to the same restrictions. Any
498 comprehensive security and sandboxing analysis is hence incomplete if
499 the IPC access policy is not validated too.
500
501 Example 19. Analyze systemd-logind.service
502
503 $ systemd-analyze security --no-pager systemd-logind.service
504 NAME DESCRIPTION EXPOSURE
505 ✗ PrivateNetwork= Service has access to the host's network 0.5
506 ✗ User=/DynamicUser= Service runs as root user 0.4
507 ✗ DeviceAllow= Service has no device ACL 0.2
508 ✓ IPAddressDeny= Service blocks all IP address ranges
509 ...
510 → Overall exposure level for systemd-logind.service: 4.1 OK 🙂
511
512 systemd-analyze inspect-elf FILE...
513 This command will load the specified file(s), and if they are ELF
514 objects (executables, libraries, core files, etc.) it will parse the
515 embedded packaging metadata, if any, and print it in a table or json
516 format. See the Packaging Metadata[1] documentation for more
517 information.
518
519 Example 20. Table output
520
521 $ systemd-analyze inspect-elf --json=pretty /tmp/core.fsverity.1000.f77dac5dc161402aa44e15b7dd9dcf97.58561.1637106137000000
522 {
523 "elfType" : "coredump",
524 "elfArchitecture" : "AMD x86-64",
525 "/home/bluca/git/fsverity-utils/fsverity" : {
526 "type" : "deb",
527 "name" : "fsverity-utils",
528 "version" : "1.3-1",
529 "buildId" : "7c895ecd2a271f93e96268f479fdc3c64a2ec4ee"
530 },
531 "/home/bluca/git/fsverity-utils/libfsverity.so.0" : {
532 "type" : "deb",
533 "name" : "fsverity-utils",
534 "version" : "1.3-1",
535 "buildId" : "b5e428254abf14237b0ae70ed85fffbb98a78f88"
536 }
537 }
538
539
541 The following options are understood:
542
543 --system
544 Operates on the system systemd instance. This is the implied
545 default.
546
547 --user
548 Operates on the user systemd instance.
549
550 --global
551 Operates on the system-wide configuration for user systemd
552 instance.
553
554 --order, --require
555 When used in conjunction with the dot command (see above), selects
556 which dependencies are shown in the dependency graph. If --order is
557 passed, only dependencies of type After= or Before= are shown. If
558 --require is passed, only dependencies of type Requires=,
559 Requisite=, Wants= and Conflicts= are shown. If neither is passed,
560 this shows dependencies of all these types.
561
562 --from-pattern=, --to-pattern=
563 When used in conjunction with the dot command (see above), this
564 selects which relationships are shown in the dependency graph. Both
565 options require a glob(7) pattern as an argument, which will be
566 matched against the left-hand and the right-hand, respectively,
567 nodes of a relationship.
568
569 Each of these can be used more than once, in which case the unit
570 name must match one of the values. When tests for both sides of the
571 relation are present, a relation must pass both tests to be shown.
572 When patterns are also specified as positional arguments, they must
573 match at least one side of the relation. In other words, patterns
574 specified with those two options will trim the list of edges
575 matched by the positional arguments, if any are given, and fully
576 determine the list of edges shown otherwise.
577
578 --fuzz=timespan
579 When used in conjunction with the critical-chain command (see
580 above), also show units, which finished timespan earlier, than the
581 latest unit in the same level. The unit of timespan is seconds
582 unless specified with a different unit, e.g. "50ms".
583
584 --man=no
585 Do not invoke man(1) to verify the existence of man pages listed in
586 Documentation=.
587
588 --generators
589 Invoke unit generators, see systemd.generator(7). Some generators
590 require root privileges. Under a normal user, running with
591 generators enabled will generally result in some warnings.
592
593 --recursive-errors=MODE
594 Control verification of units and their dependencies and whether
595 systemd-analyze verify exits with a non-zero process exit status or
596 not. With yes, return a non-zero process exit status when warnings
597 arise during verification of either the specified unit or any of
598 its associated dependencies. With no, return a non-zero process
599 exit status when warnings arise during verification of only the
600 specified unit. With one, return a non-zero process exit status
601 when warnings arise during verification of either the specified
602 unit or its immediate dependencies. If this option is not
603 specified, zero is returned as the exit status regardless whether
604 warnings arise during verification or not.
605
606 --root=PATH
607 With cat-files and verify, operate on files underneath the
608 specified root path PATH.
609
610 --image=PATH
611 With cat-files and verify, operate on files inside the specified
612 image path PATH.
613
614 --offline=BOOL
615 With security, perform an offline security review of the specified
616 unit file(s), i.e. does not have to rely on PID 1 to acquire
617 security information for the files like the security verb when used
618 by itself does. This means that --offline= can be used with --root=
619 and --image= as well. If a unit's overall exposure level is above
620 that set by --threshold= (default value is 100), --offline= will
621 return an error.
622
623 --profile=PATH
624 With security --offline=, takes into consideration the specified
625 portable profile when assessing the unit(s) settings. The profile
626 can be passed by name, in which case the well-known system
627 locations will be searched, or it can be the full path to a
628 specific drop-in file.
629
630 --threshold=NUMBER
631 With security, allow the user to set a custom value to compare the
632 overall exposure level with, for the specified unit file(s). If a
633 unit's overall exposure level, is greater than that set by the
634 user, security will return an error. --threshold= can be used with
635 --offline= as well and its default value is 100.
636
637 --security-policy=PATH
638 With security, allow the user to define a custom set of
639 requirements formatted as a JSON file against which to compare the
640 specified unit file(s) and determine their overall exposure level
641 to security threats.
642
643 Table 1. Accepted Assessment Test Identifiers
644 ┌─────────────────────────────────────────────────────────┐
645 │Assessment Test Identifier │
646 ├─────────────────────────────────────────────────────────┤
647 │UserOrDynamicUser │
648 ├─────────────────────────────────────────────────────────┤
649 │SupplementaryGroups │
650 ├─────────────────────────────────────────────────────────┤
651 │PrivateMounts │
652 ├─────────────────────────────────────────────────────────┤
653 │PrivateDevices │
654 ├─────────────────────────────────────────────────────────┤
655 │PrivateTmp │
656 ├─────────────────────────────────────────────────────────┤
657 │PrivateNetwork │
658 ├─────────────────────────────────────────────────────────┤
659 │PrivateUsers │
660 ├─────────────────────────────────────────────────────────┤
661 │ProtectControlGroups │
662 ├─────────────────────────────────────────────────────────┤
663 │ProtectKernelModules │
664 ├─────────────────────────────────────────────────────────┤
665 │ProtectKernelTunables │
666 ├─────────────────────────────────────────────────────────┤
667 │ProtectKernelLogs │
668 ├─────────────────────────────────────────────────────────┤
669 │ProtectClock │
670 ├─────────────────────────────────────────────────────────┤
671 │ProtectHome │
672 ├─────────────────────────────────────────────────────────┤
673 │ProtectHostname │
674 ├─────────────────────────────────────────────────────────┤
675 │ProtectSystem │
676 ├─────────────────────────────────────────────────────────┤
677 │RootDirectoryOrRootImage │
678 ├─────────────────────────────────────────────────────────┤
679 │LockPersonality │
680 ├─────────────────────────────────────────────────────────┤
681 │MemoryDenyWriteExecute │
682 ├─────────────────────────────────────────────────────────┤
683 │NoNewPrivileges │
684 ├─────────────────────────────────────────────────────────┤
685 │CapabilityBoundingSet_CAP_SYS_ADMIN │
686 ├─────────────────────────────────────────────────────────┤
687 │CapabilityBoundingSet_CAP_SET_UID_GID_PCAP │
688 ├─────────────────────────────────────────────────────────┤
689 │CapabilityBoundingSet_CAP_SYS_PTRACE │
690 ├─────────────────────────────────────────────────────────┤
691 │CapabilityBoundingSet_CAP_SYS_TIME │
692 ├─────────────────────────────────────────────────────────┤
693 │CapabilityBoundingSet_CAP_NET_ADMIN │
694 ├─────────────────────────────────────────────────────────┤
695 │CapabilityBoundingSet_CAP_SYS_RAWIO │
696 ├─────────────────────────────────────────────────────────┤
697 │CapabilityBoundingSet_CAP_SYS_MODULE │
698 ├─────────────────────────────────────────────────────────┤
699 │CapabilityBoundingSet_CAP_AUDIT │
700 ├─────────────────────────────────────────────────────────┤
701 │CapabilityBoundingSet_CAP_SYSLOG │
702 ├─────────────────────────────────────────────────────────┤
703 │CapabilityBoundingSet_CAP_SYS_NICE_RESOURCE │
704 ├─────────────────────────────────────────────────────────┤
705 │CapabilityBoundingSet_CAP_MKNOD │
706 ├─────────────────────────────────────────────────────────┤
707 │CapabilityBoundingSet_CAP_CHOWN_FSETID_SETFCAP │
708 ├─────────────────────────────────────────────────────────┤
709 │CapabilityBoundingSet_CAP_DAC_FOWNER_IPC_OWNER │
710 ├─────────────────────────────────────────────────────────┤
711 │CapabilityBoundingSet_CAP_KILL │
712 ├─────────────────────────────────────────────────────────┤
713 │CapabilityBoundingSet_CAP_NET_BIND_SERVICE_BROADCAST_RAW │
714 ├─────────────────────────────────────────────────────────┤
715 │CapabilityBoundingSet_CAP_SYS_BOOT │
716 ├─────────────────────────────────────────────────────────┤
717 │CapabilityBoundingSet_CAP_MAC │
718 ├─────────────────────────────────────────────────────────┤
719 │CapabilityBoundingSet_CAP_LINUX_IMMUTABLE │
720 ├─────────────────────────────────────────────────────────┤
721 │CapabilityBoundingSet_CAP_IPC_LOCK │
722 ├─────────────────────────────────────────────────────────┤
723 │CapabilityBoundingSet_CAP_SYS_CHROOT │
724 ├─────────────────────────────────────────────────────────┤
725 │CapabilityBoundingSet_CAP_BLOCK_SUSPEND │
726 ├─────────────────────────────────────────────────────────┤
727 │CapabilityBoundingSet_CAP_WAKE_ALARM │
728 ├─────────────────────────────────────────────────────────┤
729 │CapabilityBoundingSet_CAP_LEASE │
730 ├─────────────────────────────────────────────────────────┤
731 │CapabilityBoundingSet_CAP_SYS_TTY_CONFIG │
732 ├─────────────────────────────────────────────────────────┤
733 │UMask │
734 ├─────────────────────────────────────────────────────────┤
735 │KeyringMode │
736 ├─────────────────────────────────────────────────────────┤
737 │ProtectProc │
738 ├─────────────────────────────────────────────────────────┤
739 │ProcSubset │
740 ├─────────────────────────────────────────────────────────┤
741 │NotifyAccess │
742 ├─────────────────────────────────────────────────────────┤
743 │RemoveIPC │
744 ├─────────────────────────────────────────────────────────┤
745 │Delegate │
746 ├─────────────────────────────────────────────────────────┤
747 │RestrictRealtime │
748 ├─────────────────────────────────────────────────────────┤
749 │RestrictSUIDSGID │
750 ├─────────────────────────────────────────────────────────┤
751 │RestrictNamespaces_user │
752 ├─────────────────────────────────────────────────────────┤
753 │RestrictNamespaces_mnt │
754 ├─────────────────────────────────────────────────────────┤
755 │RestrictNamespaces_ipc │
756 ├─────────────────────────────────────────────────────────┤
757 │RestrictNamespaces_pid │
758 ├─────────────────────────────────────────────────────────┤
759 │RestrictNamespaces_cgroup │
760 ├─────────────────────────────────────────────────────────┤
761 │RestrictNamespaces_uts │
762 ├─────────────────────────────────────────────────────────┤
763 │RestrictNamespaces_net │
764 ├─────────────────────────────────────────────────────────┤
765 │RestrictAddressFamilies_AF_INET_INET6 │
766 ├─────────────────────────────────────────────────────────┤
767 │RestrictAddressFamilies_AF_UNIX │
768 ├─────────────────────────────────────────────────────────┤
769 │RestrictAddressFamilies_AF_NETLINK │
770 ├─────────────────────────────────────────────────────────┤
771 │RestrictAddressFamilies_AF_PACKET │
772 ├─────────────────────────────────────────────────────────┤
773 │RestrictAddressFamilies_OTHER │
774 ├─────────────────────────────────────────────────────────┤
775 │SystemCallArchitectures │
776 ├─────────────────────────────────────────────────────────┤
777 │SystemCallFilter_swap │
778 ├─────────────────────────────────────────────────────────┤
779 │SystemCallFilter_obsolete │
780 ├─────────────────────────────────────────────────────────┤
781 │SystemCallFilter_clock │
782 ├─────────────────────────────────────────────────────────┤
783 │SystemCallFilter_cpu_emulation │
784 ├─────────────────────────────────────────────────────────┤
785 │SystemCallFilter_debug │
786 ├─────────────────────────────────────────────────────────┤
787 │SystemCallFilter_mount │
788 ├─────────────────────────────────────────────────────────┤
789 │SystemCallFilter_module │
790 ├─────────────────────────────────────────────────────────┤
791 │SystemCallFilter_raw_io │
792 ├─────────────────────────────────────────────────────────┤
793 │SystemCallFilter_reboot │
794 ├─────────────────────────────────────────────────────────┤
795 │SystemCallFilter_privileged │
796 ├─────────────────────────────────────────────────────────┤
797 │SystemCallFilter_resources │
798 ├─────────────────────────────────────────────────────────┤
799 │IPAddressDeny │
800 ├─────────────────────────────────────────────────────────┤
801 │DeviceAllow │
802 ├─────────────────────────────────────────────────────────┤
803 │AmbientCapabilities │
804 └─────────────────────────────────────────────────────────┘
805 See example "JSON Policy" below.
806
807 --json=MODE
808 With the security command, generate a JSON formatted output of the
809 security analysis table. The format is a JSON array with objects
810 containing the following fields: set which indicates if the setting
811 has been enabled or not, name which is what is used to refer to the
812 setting, json_field which is the JSON compatible identifier of the
813 setting, description which is an outline of the setting state, and
814 exposure which is a number in the range 0.0...10.0, where a higher
815 value corresponds to a higher security threat. The JSON version of
816 the table is printed to standard output. The MODE passed to the
817 option can be one of three: off which is the default, pretty and
818 short which respectively output a prettified or shorted JSON
819 version of the security table.
820
821 --iterations=NUMBER
822 When used with the calendar command, show the specified number of
823 iterations the specified calendar expression will elapse next.
824 Defaults to 1.
825
826 --base-time=TIMESTAMP
827 When used with the calendar command, show next iterations relative
828 to the specified point in time. If not specified defaults to the
829 current time.
830
831 --unit=UNIT
832 When used with the condition command, evaluate all the
833 Condition*=... and Assert*=... assignments in the specified unit
834 file. The full unit search path is formed by combining the
835 directories for the specified unit with the usual unit load paths.
836 The variable $SYSTEMD_UNIT_PATH is supported, and may be used to
837 replace or augment the compiled in set of unit load paths; see
838 systemd.unit(5). All units files present in the directory
839 containing the specified unit will be used in preference to the
840 other paths.
841
842 -H, --host=
843 Execute the operation remotely. Specify a hostname, or a username
844 and hostname separated by "@", to connect to. The hostname may
845 optionally be suffixed by a port ssh is listening on, separated by
846 ":", and then a container name, separated by "/", which connects
847 directly to a specific container on the specified host. This will
848 use SSH to talk to the remote machine manager instance. Container
849 names may be enumerated with machinectl -H HOST. Put IPv6 addresses
850 in brackets.
851
852 -M, --machine=
853 Execute operation on a local container. Specify a container name to
854 connect to, optionally prefixed by a user name to connect as and a
855 separating "@" character. If the special string ".host" is used in
856 place of the container name, a connection to the local system is
857 made (which is useful to connect to a specific user's user bus:
858 "--user --machine=lennart@.host"). If the "@" syntax is not used,
859 the connection is made as root user. If the "@" syntax is used
860 either the left hand side or the right hand side may be omitted
861 (but not both) in which case the local user name and ".host" are
862 implied.
863
864 --quiet
865 Suppress hints and other non-essential output.
866
867 -h, --help
868 Print a short help text and exit.
869
870 --version
871 Print a short version string and exit.
872
873 --no-pager
874 Do not pipe output into a pager.
875
877 On success, 0 is returned, a non-zero failure code otherwise.
878
880 $SYSTEMD_LOG_LEVEL
881 The maximum log level of emitted messages (messages with a higher
882 log level, i.e. less important ones, will be suppressed). Either
883 one of (in order of decreasing importance) emerg, alert, crit, err,
884 warning, notice, info, debug, or an integer in the range 0...7. See
885 syslog(3) for more information.
886
887 $SYSTEMD_LOG_COLOR
888 A boolean. If true, messages written to the tty will be colored
889 according to priority.
890
891 This setting is only useful when messages are written directly to
892 the terminal, because journalctl(1) and other tools that display
893 logs will color messages based on the log level on their own.
894
895 $SYSTEMD_LOG_TIME
896 A boolean. If true, console log messages will be prefixed with a
897 timestamp.
898
899 This setting is only useful when messages are written directly to
900 the terminal or a file, because journalctl(1) and other tools that
901 display logs will attach timestamps based on the entry metadata on
902 their own.
903
904 $SYSTEMD_LOG_LOCATION
905 A boolean. If true, messages will be prefixed with a filename and
906 line number in the source code where the message originates.
907
908 Note that the log location is often attached as metadata to journal
909 entries anyway. Including it directly in the message text can
910 nevertheless be convenient when debugging programs.
911
912 $SYSTEMD_LOG_TID
913 A boolean. If true, messages will be prefixed with the current
914 numerical thread ID (TID).
915
916 Note that the this information is attached as metadata to journal
917 entries anyway. Including it directly in the message text can
918 nevertheless be convenient when debugging programs.
919
920 $SYSTEMD_LOG_TARGET
921 The destination for log messages. One of console (log to the
922 attached tty), console-prefixed (log to the attached tty but with
923 prefixes encoding the log level and "facility", see syslog(3), kmsg
924 (log to the kernel circular log buffer), journal (log to the
925 journal), journal-or-kmsg (log to the journal if available, and to
926 kmsg otherwise), auto (determine the appropriate log target
927 automatically, the default), null (disable log output).
928
929 $SYSTEMD_PAGER
930 Pager to use when --no-pager is not given; overrides $PAGER. If
931 neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
932 pager implementations are tried in turn, including less(1) and
933 more(1), until one is found. If no pager implementation is
934 discovered no pager is invoked. Setting this environment variable
935 to an empty string or the value "cat" is equivalent to passing
936 --no-pager.
937
938 Note: if $SYSTEMD_PAGERSECURE is not set, $SYSTEMD_PAGER (as well
939 as $PAGER) will be silently ignored.
940
941 $SYSTEMD_LESS
942 Override the options passed to less (by default "FRSXMK").
943
944 Users might want to change two options in particular:
945
946 K
947 This option instructs the pager to exit immediately when Ctrl+C
948 is pressed. To allow less to handle Ctrl+C itself to switch
949 back to the pager command prompt, unset this option.
950
951 If the value of $SYSTEMD_LESS does not include "K", and the
952 pager that is invoked is less, Ctrl+C will be ignored by the
953 executable, and needs to be handled by the pager.
954
955 X
956 This option instructs the pager to not send termcap
957 initialization and deinitialization strings to the terminal. It
958 is set by default to allow command output to remain visible in
959 the terminal even after the pager exits. Nevertheless, this
960 prevents some pager functionality from working, in particular
961 paged output cannot be scrolled with the mouse.
962
963 See less(1) for more discussion.
964
965 $SYSTEMD_LESSCHARSET
966 Override the charset passed to less (by default "utf-8", if the
967 invoking terminal is determined to be UTF-8 compatible).
968
969 $SYSTEMD_PAGERSECURE
970 Takes a boolean argument. When true, the "secure" mode of the pager
971 is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set
972 at all, secure mode is enabled if the effective UID is not the same
973 as the owner of the login session, see geteuid(2) and
974 sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set
975 when invoking the pager, and the pager shall disable commands that
976 open or create new files or start new subprocesses. When
977 $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known
978 to implement secure mode will not be used. (Currently only less(1)
979 implements secure mode.)
980
981 Note: when commands are invoked with elevated privileges, for
982 example under sudo(8) or pkexec(1), care must be taken to ensure
983 that unintended interactive features are not enabled. "Secure" mode
984 for the pager may be enabled automatically as describe above.
985 Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited
986 environment allows the user to invoke arbitrary commands. Note that
987 if the $SYSTEMD_PAGER or $PAGER variables are to be honoured,
988 $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to
989 completely disable the pager using --no-pager instead.
990
991 $SYSTEMD_COLORS
992 Takes a boolean argument. When true, systemd and related utilities
993 will use colors in their output, otherwise the output will be
994 monochrome. Additionally, the variable can take one of the
995 following special values: "16", "256" to restrict the use of colors
996 to the base 16 or 256 ANSI colors, respectively. This can be
997 specified to override the automatic decision based on $TERM and
998 what the console is connected to.
999
1000 $SYSTEMD_URLIFY
1001 The value must be a boolean. Controls whether clickable links
1002 should be generated in the output for terminal emulators supporting
1003 this. This can be specified to override the decision that systemd
1004 makes based on $TERM and other conditions.
1005
1007 Example 21. JSON Policy
1008
1009 The JSON file passed as a path parameter to --security-policy= has a
1010 top-level JSON object, with keys being the assessment test identifiers
1011 mentioned above. The values in the file should be JSON objects with one
1012 or more of the following fields: description_na (string),
1013 description_good (string), description_bad (string), weight (unsigned
1014 integer), and range (unsigned integer). If any of these fields
1015 corresponding to a specific id of the unit file is missing from the
1016 JSON object, the default built-in field value corresponding to that
1017 same id is used for security analysis as default. The weight and range
1018 fields are used in determining the overall exposure level of the unit
1019 files: the value of each setting is assigned a badness score, which is
1020 multiplied by the policy weight and divided by the policy range to
1021 determine the overall exposure that the setting implies. The computed
1022 badness is summed across all settings in the unit file, normalized to
1023 the 1...100 range, and used to determine the overall exposure level of
1024 the unit. By allowing users to manipulate these fields, the 'security'
1025 verb gives them the option to decide for themself which ids are more
1026 important and hence should have a greater effect on the exposure level.
1027 A weight of "0" means the setting will not be checked.
1028
1029 {
1030 "PrivateDevices":
1031 {
1032 "description_good": "Service has no access to hardware devices",
1033 "description_bad": "Service potentially has access to hardware devices",
1034 "weight": 1000,
1035 "range": 1
1036 },
1037 "PrivateMounts":
1038 {
1039 "description_good": "Service cannot install system mounts",
1040 "description_bad": "Service may install system mounts",
1041 "weight": 1000,
1042 "range": 1
1043 },
1044 "PrivateNetwork":
1045 {
1046 "description_good": "Service has no access to the host's network",
1047 "description_bad": "Service has access to the host's network",
1048 "weight": 2500,
1049 "range": 1
1050 },
1051 "PrivateTmp":
1052 {
1053 "description_good": "Service has no access to other software's temporary files",
1054 "description_bad": "Service has access to other software's temporary files",
1055 "weight": 1000,
1056 "range": 1
1057 },
1058 "PrivateUsers":
1059 {
1060 "description_good": "Service does not have access to other users",
1061 "description_bad": "Service has access to other users",
1062 "weight": 1000,
1063 "range": 1
1064 }
1065 }
1066
1067
1069 systemd(1), systemctl(1)
1070
1072 1. Packaging Metadata
1073 https://systemd.io/COREDUMP_PACKAGE_METADATA/
1074
1075
1076
1077systemd 251 SYSTEMD-ANALYZE(1)