1SYSTEMD-ANALYZE(1)              systemd-analyze             SYSTEMD-ANALYZE(1)
2
3
4

NAME

6       systemd-analyze - Analyze and debug system manager
7

SYNOPSIS

9       systemd-analyze [OPTIONS...] [time]
10
11       systemd-analyze [OPTIONS...] blame
12
13       systemd-analyze [OPTIONS...] critical-chain [UNIT...]
14
15       systemd-analyze [OPTIONS...] log-level [LEVEL]
16
17       systemd-analyze [OPTIONS...] log-target [TARGET]
18
19       systemd-analyze [OPTIONS...] service-watchdogs [BOOL]
20
21       systemd-analyze [OPTIONS...] dump
22
23       systemd-analyze [OPTIONS...] plot [>file.svg]
24
25       systemd-analyze [OPTIONS...] dot [PATTERN...] [>file.dot]
26
27       systemd-analyze [OPTIONS...] unit-paths
28
29       systemd-analyze [OPTIONS...] exit-status [STATUS...]
30
31       systemd-analyze [OPTIONS...] condition CONDITION...
32
33       systemd-analyze [OPTIONS...] syscall-filter [SET...]
34
35       systemd-analyze [OPTIONS...] calendar SPEC...
36
37       systemd-analyze [OPTIONS...] timestamp TIMESTAMP...
38
39       systemd-analyze [OPTIONS...] timespan SPAN...
40
41       systemd-analyze [OPTIONS...] cat-config NAME|PATH...
42
43       systemd-analyze [OPTIONS...] verify [FILE...]
44
45       systemd-analyze [OPTIONS...] security UNIT...
46

DESCRIPTION

48       systemd-analyze may be used to determine system boot-up performance
49       statistics and retrieve other state and tracing information from the
50       system and service manager, and to verify the correctness of unit
51       files. It is also used to access special functions useful for advanced
52       system manager debugging.
53
54       If no command is passed, systemd-analyze time is implied.
55
56   systemd-analyze time
57       This command prints the time spent in the kernel before userspace has
58       been reached, the time spent in the initial RAM disk (initrd) before
59       normal system userspace has been reached, and the time normal system
60       userspace took to initialize. Note that these measurements simply
61       measure the time passed up to the point where all system services have
62       been spawned, but not necessarily until they fully finished
63       initialization or the disk is idle.
64
65       Example 1. Show how long the boot took
66
67           # in a container
68           $ systemd-analyze time
69           Startup finished in 296ms (userspace)
70           multi-user.target reached after 275ms in userspace
71
72           # on a real machine
73           $ systemd-analyze time
74           Startup finished in 2.584s (kernel) + 19.176s (initrd) + 47.847s (userspace) = 1min 9.608s
75           multi-user.target reached after 47.820s in userspace
76
77   systemd-analyze blame
78       This command prints a list of all running units, ordered by the time
79       they took to initialize. This information may be used to optimize
80       boot-up times. Note that the output might be misleading as the
81       initialization of one service might be slow simply because it waits for
82       the initialization of another service to complete. Also note:
83       systemd-analyze blame doesn't display results for services with
84       Type=simple, because systemd considers such services to be started
85       immediately, hence no measurement of the initialization delays can be
86       done. Also note that this command only shows the time units took for
87       starting up, it does not show how long unit jobs spent in the execution
88       queue. In particular it shows the time units spent in "activating"
89       state, which is not defined for units such as device units that
90       transition directly from "inactive" to "active". This command hence
91       gives an impression of the performance of program code, but cannot
92       accurately reflect latency introduced by waiting for hardware and
93       similar events.
94
95       Example 2. Show which units took the most time during boot
96
97           $ systemd-analyze blame
98                    32.875s pmlogger.service
99                    20.905s systemd-networkd-wait-online.service
100                    13.299s dev-vda1.device
101                    ...
102                       23ms sysroot.mount
103                       11ms initrd-udevadm-cleanup-db.service
104                        3ms sys-kernel-config.mount
105
106
107   systemd-analyze critical-chain [UNIT...]
108       This command prints a tree of the time-critical chain of units (for
109       each of the specified UNITs or for the default target otherwise). The
110       time after the unit is active or started is printed after the "@"
111       character. The time the unit takes to start is printed after the "+"
112       character. Note that the output might be misleading as the
113       initialization of services might depend on socket activation and
114       because of the parallel execution of units. Also, similar to the blame
115       command, this only takes into account the time units spent in
116       "activating" state, and hence does not cover units that never went
117       through an "activating" state (such as device units that transition
118       directly from "inactive" to "active"). Moreover it does not show
119       information on jobs (and in particular not jobs that timed out).
120
121       Example 3. systemd-analyze time
122
123           $ systemd-analyze critical-chain
124           multi-user.target @47.820s
125           └─pmie.service @35.968s +548ms
126             └─pmcd.service @33.715s +2.247s
127               └─network-online.target @33.712s
128                 └─systemd-networkd-wait-online.service @12.804s +20.905s
129                   └─systemd-networkd.service @11.109s +1.690s
130                     └─systemd-udevd.service @9.201s +1.904s
131                       └─systemd-tmpfiles-setup-dev.service @7.306s +1.776s
132                         └─kmod-static-nodes.service @6.976s +177ms
133                           └─systemd-journald.socket
134                             └─system.slice
135                               └─-.slice
136
137   systemd-analyze log-level [LEVEL]
138       systemd-analyze log-level prints the current log level of the systemd
139       daemon. If an optional argument LEVEL is provided, then the command
140       changes the current log level of the systemd daemon to LEVEL (accepts
141       the same values as --log-level= described in systemd(1)).
142
143   systemd-analyze log-target [TARGET]
144       systemd-analyze log-target prints the current log target of the systemd
145       daemon. If an optional argument TARGET is provided, then the command
146       changes the current log target of the systemd daemon to TARGET (accepts
147       the same values as --log-target=, described in systemd(1)).
148
149   systemd-analyze service-watchdogs [yes|no]
150       systemd-analyze service-watchdogs prints the current state of service
151       runtime watchdogs of the systemd daemon. If an optional boolean
152       argument is provided, then globally enables or disables the service
153       runtime watchdogs (WatchdogSec=) and emergency actions (e.g.
154       OnFailure= or StartLimitAction=); see systemd.service(5). The hardware
155       watchdog is not affected by this setting.
156
157   systemd-analyze dump
158       This command outputs a (usually very long) human-readable serialization
159       of the complete server state. Its format is subject to change without
160       notice and should not be parsed by applications.
161
162       Example 4. Show the internal state of user manager
163
164           $ systemd-analyze --user dump
165           Timestamp userspace: Thu 2019-03-14 23:28:07 CET
166           Timestamp finish: Thu 2019-03-14 23:28:07 CET
167           Timestamp generators-start: Thu 2019-03-14 23:28:07 CET
168           Timestamp generators-finish: Thu 2019-03-14 23:28:07 CET
169           Timestamp units-load-start: Thu 2019-03-14 23:28:07 CET
170           Timestamp units-load-finish: Thu 2019-03-14 23:28:07 CET
171           -> Unit proc-timer_list.mount:
172                   Description: /proc/timer_list
173                   ...
174           -> Unit default.target:
175                   Description: Main user target
176           ...
177
178   systemd-analyze plot
179       This command prints an SVG graphic detailing which system services have
180       been started at what time, highlighting the time they spent on
181       initialization.
182
183       Example 5. Plot a bootchart
184
185           $ systemd-analyze plot >bootup.svg
186           $ eog bootup.svg&
187
188   systemd-analyze dot [pattern...]
189       This command generates textual dependency graph description in dot
190       format for further processing with the GraphViz dot(1) tool. Use a
191       command line like systemd-analyze dot | dot -Tsvg >systemd.svg to
192       generate a graphical dependency tree. Unless --order or --require is
193       passed, the generated graph will show both ordering and requirement
194       dependencies. Optional pattern globbing style specifications (e.g.
195       *.target) may be given at the end. A unit dependency is included in the
196       graph if any of these patterns match either the origin or destination
197       node.
198
199       Example 6. Plot all dependencies of any unit whose name starts with
200       "avahi-daemon"
201
202           $ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg >avahi.svg
203           $ eog avahi.svg
204
205       Example 7. Plot the dependencies between all known target units
206
207           $ systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' \
208                 | dot -Tsvg >targets.svg
209           $ eog targets.svg
210
211   systemd-analyze unit-paths
212       This command outputs a list of all directories from which unit files,
213       .d overrides, and .wants, .requires symlinks may be loaded. Combine
214       with --user to retrieve the list for the user manager instance, and
215       --global for the global configuration of user manager instances.
216
217       Example 8. Show all paths for generated units
218
219           $ systemd-analyze unit-paths | grep '^/run'
220           /run/systemd/system.control
221           /run/systemd/transient
222           /run/systemd/generator.early
223           /run/systemd/system
224           /run/systemd/system.attached
225           /run/systemd/generator
226           /run/systemd/generator.late
227
228       Note that this verb prints the list that is compiled into
229       systemd-analyze itself, and does not communicate with the running
230       manager. Use
231
232           systemctl [--user] [--global] show -p UnitPath --value
233
234       to retrieve the actual list that the manager uses, with any empty
235       directories omitted.
236
237   systemd-analyze exit-status [STATUS...]
238       This command prints a list of exit statuses along with their "class",
239       i.e. the source of the definition (one of "glibc", "systemd", "LSB", or
240       "BSD"), see the Process Exit Codes section in systemd.exec(5). If no
241       additional arguments are specified, all known statuses are are shown.
242       Otherwise, only the definitions for the specified codes are shown.
243
244       Example 9. Show some example exit status names
245
246           $ systemd-analyze exit-status 0 1 {63..65}
247           NAME    STATUS CLASS
248           SUCCESS 0      glibc
249           FAILURE 1      glibc
250           -       63     -
251           USAGE   64     BSD
252           DATAERR 65     BSD
253
254   systemd-analyze condition CONDITION...
255       This command will evaluate Condition*=...  and Assert*=...
256       assignments, and print their values, and the resulting value of the
257       combined condition set. See systemd.unit(5) for a list of available
258       conditions and asserts.
259
260       Example 10. Evaluate conditions that check kernel versions
261
262           $ systemd-analyze condition 'ConditionKernelVersion = ! <4.0' \
263                   'ConditionKernelVersion = >=5.1' \
264                   'ConditionACPower=|false' \
265                   'ConditionArchitecture=|!arm' \
266                   'AssertPathExists=/etc/os-release'
267           test.service: AssertPathExists=/etc/os-release succeeded.
268           Asserts succeeded.
269           test.service: ConditionArchitecture=|!arm succeeded.
270           test.service: ConditionACPower=|false failed.
271           test.service: ConditionKernelVersion=>=5.1 succeeded.
272           test.service: ConditionKernelVersion=!<4.0 succeeded.
273           Conditions succeeded.
274
275   systemd-analyze syscall-filter [SET...]
276       This command will list system calls contained in the specified system
277       call set SET, or all known sets if no sets are specified. Argument SET
278       must include the "@" prefix.
279
280   systemd-analyze calendar EXPRESSION...
281       This command will parse and normalize repetitive calendar time events,
282       and will calculate when they elapse next. This takes the same input as
283       the OnCalendar= setting in systemd.timer(5), following the syntax
284       described in systemd.time(7). By default, only the next time the
285       calendar expression will elapse is shown; use --iterations= to show the
286       specified number of next times the expression elapses. Each time the
287       expression elapses forms a timestamp, see the timestamp verb below.
288
289       Example 11. Show leap days in the near future
290
291           $ systemd-analyze calendar --iterations=5 '*-2-29 0:0:0'
292             Original form: *-2-29 0:0:0
293           Normalized form: *-02-29 00:00:00
294               Next elapse: Sat 2020-02-29 00:00:00 UTC
295                  From now: 11 months 15 days left
296                  Iter. #2: Thu 2024-02-29 00:00:00 UTC
297                  From now: 4 years 11 months left
298                  Iter. #3: Tue 2028-02-29 00:00:00 UTC
299                  From now: 8 years 11 months left
300                  Iter. #4: Sun 2032-02-29 00:00:00 UTC
301                  From now: 12 years 11 months left
302                  Iter. #5: Fri 2036-02-29 00:00:00 UTC
303                  From now: 16 years 11 months left
304
305   systemd-analyze timestamp TIMESTAMP...
306       This command parses a timestamp (i.e. a single point in time) and
307       outputs the normalized form and the difference between this timestamp
308       and now. The timestamp should adhere to the syntax documented in
309       systemd.time(7), section "PARSING TIMESTAMPS".
310
311       Example 12. Show parsing of timestamps
312
313           $ systemd-analyze timestamp yesterday now tomorrow
314             Original form: yesterday
315           Normalized form: Mon 2019-05-20 00:00:00 CEST
316                  (in UTC): Sun 2019-05-19 22:00:00 UTC
317              UNIX seconds: @15583032000
318                  From now: 1 day 9h ago
319
320             Original form: now
321           Normalized form: Tue 2019-05-21 09:48:39 CEST
322                  (in UTC): Tue 2019-05-21 07:48:39 UTC
323              UNIX seconds: @1558424919.659757
324                  From now: 43us ago
325
326             Original form: tomorrow
327           Normalized form: Wed 2019-05-22 00:00:00 CEST
328                  (in UTC): Tue 2019-05-21 22:00:00 UTC
329              UNIX seconds: @15584760000
330                  From now: 14h left
331
332   systemd-analyze timespan EXPRESSION...
333       This command parses a time span (i.e. a difference between two
334       timestamps) and outputs the normalized form and the equivalent value in
335       microseconds. The time span should adhere to the syntax documented in
336       systemd.time(7), section "PARSING TIME SPANS". Values without units are
337       parsed as seconds.
338
339       Example 13. Show parsing of timespans
340
341           $ systemd-analyze timespan 1s 300s '1year 0.000001s'
342           Original: 1s
343                 μs: 1000000
344              Human: 1s
345
346           Original: 300s
347                 μs: 300000000
348              Human: 5min
349
350           Original: 1year 0.000001s
351                 μs: 31557600000001
352              Human: 1y 1us
353
354   systemd-analyze cat-config NAME|PATH...
355       This command is similar to systemctl cat, but operates on config files.
356       It will copy the contents of a config file and any drop-ins to standard
357       output, using the usual systemd set of directories and rules for
358       precedence. Each argument must be either an absolute path including the
359       prefix (such as /etc/systemd/logind.conf or
360       /usr/lib/systemd/logind.conf), or a name relative to the prefix (such
361       as systemd/logind.conf).
362
363       Example 14. Showing logind configuration
364
365           $ systemd-analyze cat-config systemd/logind.conf
366           # /etc/systemd/logind.conf
367           ...
368           [Login]
369           NAutoVTs=8
370           ...
371
372           # /usr/lib/systemd/logind.conf.d/20-test.conf
373           ... some override from another package
374
375           # /etc/systemd/logind.conf.d/50-override.conf
376           ... some administrator override
377
378
379   systemd-analyze verify FILE...
380       This command will load unit files and print warnings if any errors are
381       detected. Files specified on the command line will be loaded, but also
382       any other units referenced by them. The full unit search path is formed
383       by combining the directories for all command line arguments, and the
384       usual unit load paths (variable $SYSTEMD_UNIT_PATH is supported, and
385       may be used to replace or augment the compiled in set of unit load
386       paths; see systemd.unit(5)). All units files present in the directories
387       containing the command line arguments will be used in preference to the
388       other paths.
389
390       The following errors are currently detected:
391
392       ·   unknown sections and directives,
393
394       ·   missing dependencies which are required to start the given unit,
395
396       ·   man pages listed in Documentation= which are not found in the
397           system,
398
399       ·   commands listed in ExecStart= and similar which are not found in
400           the system or not executable.
401
402       Example 15. Misspelt directives
403
404           $ cat ./user.slice
405           [Unit]
406           WhatIsThis=11
407           Documentation=man:nosuchfile(1)
408           Requires=different.service
409
410           [Service]
411           Description=x
412
413           $ systemd-analyze verify ./user.slice
414           [./user.slice:9] Unknown lvalue 'WhatIsThis' in section 'Unit'
415           [./user.slice:13] Unknown section 'Service'. Ignoring.
416           Error: org.freedesktop.systemd1.LoadFailed:
417              Unit different.service failed to load:
418              No such file or directory.
419           Failed to create user.slice/start: Invalid argument
420           user.slice: man nosuchfile(1) command failed with code 16
421
422
423       Example 16. Missing service units
424
425           $ tail ./a.socket ./b.socket
426           ==> ./a.socket <==
427           [Socket]
428           ListenStream=100
429
430           ==> ./b.socket <==
431           [Socket]
432           ListenStream=100
433           Accept=yes
434
435           $ systemd-analyze verify ./a.socket ./b.socket
436           Service a.service not loaded, a.socket cannot be started.
437           Service b@0.service not loaded, b.socket cannot be started.
438
439
440   systemd-analyze security [UNIT...]
441       This command analyzes the security and sandboxing settings of one or
442       more specified service units. If at least one unit name is specified
443       the security settings of the specified service units are inspected and
444       a detailed analysis is shown. If no unit name is specified, all
445       currently loaded, long-running service units are inspected and a terse
446       table with results shown. The command checks for various
447       security-related service settings, assigning each a numeric "exposure
448       level" value, depending on how important a setting is. It then
449       calculates an overall exposure level for the whole unit, which is an
450       estimation in the range 0.0...10.0 indicating how exposed a service is
451       security-wise. High exposure levels indicate very little applied
452       sandboxing. Low exposure levels indicate tight sandboxing and strongest
453       security restrictions. Note that this only analyzes the per-service
454       security features systemd itself implements. This means that any
455       additional security mechanisms applied by the service code itself are
456       not accounted for. The exposure level determined this way should not be
457       misunderstood: a high exposure level neither means that there is no
458       effective sandboxing applied by the service code itself, nor that the
459       service is actually vulnerable to remote or local attacks. High
460       exposure levels do indicate however that most likely the service might
461       benefit from additional settings applied to them.
462
463       Please note that many of the security and sandboxing settings
464       individually can be circumvented — unless combined with others. For
465       example, if a service retains the privilege to establish or undo mount
466       points many of the sandboxing options can be undone by the service code
467       itself. Due to that is essential that each service uses the most
468       comprehensive and strict sandboxing and security settings possible. The
469       tool will take into account some of these combinations and
470       relationships between the settings, but not all. Also note that the
471       security and sandboxing settings analyzed here only apply to the
472       operations executed by the service code itself. If a service has access
473       to an IPC system (such as D-Bus) it might request operations from other
474       services that are not subject to the same restrictions. Any
475       comprehensive security and sandboxing analysis is hence incomplete if
476       the IPC access policy is not validated too.
477
478       Example 17. Analyze systemd-logind.service
479
480           $ systemd-analyze security --no-pager systemd-logind.service
481             NAME                DESCRIPTION                              EXPOSURE
482           ✗ PrivateNetwork=     Service has access to the host's network      0.5
483           ✗ User=/DynamicUser=  Service runs as root user                     0.4
484           ✗ DeviceAllow=        Service has no device ACL                     0.2
485           ✓ IPAddressDeny=      Service blocks all IP address ranges
486           ...
487           → Overall exposure level for systemd-logind.service: 4.1 OK 🙂
488

OPTIONS

490       The following options are understood:
491
492       --system
493           Operates on the system systemd instance. This is the implied
494           default.
495
496       --user
497           Operates on the user systemd instance.
498
499       --global
500           Operates on the system-wide configuration for user systemd
501           instance.
502
503       --order, --require
504           When used in conjunction with the dot command (see above), selects
505           which dependencies are shown in the dependency graph. If --order is
506           passed, only dependencies of type After= or Before= are shown. If
507           --require is passed, only dependencies of type Requires=,
508           Requisite=, Wants= and Conflicts= are shown. If neither is passed,
509           this shows dependencies of all these types.
510
511       --from-pattern=, --to-pattern=
512           When used in conjunction with the dot command (see above), this
513           selects which relationships are shown in the dependency graph. Both
514           options require a glob(7) pattern as an argument, which will be
515           matched against the left-hand and the right-hand, respectively,
516           nodes of a relationship.
517
518           Each of these can be used more than once, in which case the unit
519           name must match one of the values. When tests for both sides of the
520           relation are present, a relation must pass both tests to be shown.
521           When patterns are also specified as positional arguments, they must
522           match at least one side of the relation. In other words, patterns
523           specified with those two options will trim the list of edges
524           matched by the positional arguments, if any are given, and fully
525           determine the list of edges shown otherwise.
526
527       --fuzz=timespan
528           When used in conjunction with the critical-chain command (see
529           above), also show units, which finished timespan earlier, than the
530           latest unit in the same level. The unit of timespan is seconds
531           unless specified with a different unit, e.g. "50ms".
532
533       --man=no
534           Do not invoke man to verify the existence of man pages listed in
535           Documentation=.
536
537       --generators
538           Invoke unit generators, see systemd.generator(7). Some generators
539           require root privileges. Under a normal user, running with
540           generators enabled will generally result in some warnings.
541
542       --root=PATH
543           With cat-files, show config files underneath the specified root
544           path PATH.
545
546       --iterations=NUMBER
547           When used with the calendar command, show the specified number of
548           iterations the specified calendar expression will elapse next.
549           Defaults to 1.
550
551       -H, --host=
552           Execute the operation remotely. Specify a hostname, or a username
553           and hostname separated by "@", to connect to. The hostname may
554           optionally be suffixed by a port ssh is listening on, separated by
555           ":", and then a container name, separated by "/", which connects
556           directly to a specific container on the specified host. This will
557           use SSH to talk to the remote machine manager instance. Container
558           names may be enumerated with machinectl -H HOST. Put IPv6 addresses
559           in brackets.
560
561       -M, --machine=
562           Execute operation on a local container. Specify a container name to
563           connect to.
564
565       -h, --help
566           Print a short help text and exit.
567
568       --version
569           Print a short version string and exit.
570
571       --no-pager
572           Do not pipe output into a pager.
573

EXIT STATUS

575       On success, 0 is returned, a non-zero failure code otherwise.
576

ENVIRONMENT

578       $SYSTEMD_PAGER
579           Pager to use when --no-pager is not given; overrides $PAGER. If
580           neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
581           pager implementations are tried in turn, including less(1) and
582           more(1), until one is found. If no pager implementation is
583           discovered no pager is invoked. Setting this environment variable
584           to an empty string or the value "cat" is equivalent to passing
585           --no-pager.
586
587       $SYSTEMD_LESS
588           Override the options passed to less (by default "FRSXMK").
589
590           Users might want to change two options in particular:
591
592           K
593               This option instructs the pager to exit immediately when Ctrl+C
594               is pressed. To allow less to handle Ctrl+C itself to switch
595               back to the pager command prompt, unset this option.
596
597               If the value of $SYSTEMD_LESS does not include "K", and the
598               pager that is invoked is less, Ctrl+C will be ignored by the
599               executable, and needs to be handled by the pager.
600
601           X
602               This option instructs the pager to not send termcap
603               initialization and deinitialization strings to the terminal. It
604               is set by default to allow command output to remain visible in
605               the terminal even after the pager exits. Nevertheless, this
606               prevents some pager functionality from working, in particular
607               paged output cannot be scrolled with the mouse.
608
609           See less(1) for more discussion.
610
611       $SYSTEMD_LESSCHARSET
612           Override the charset passed to less (by default "utf-8", if the
613           invoking terminal is determined to be UTF-8 compatible).
614
615       $SYSTEMD_COLORS
616           The value must be a boolean. Controls whether colorized output
617           should be generated. This can be specified to override the decision
618           that systemd makes based on $TERM and what the console is connected
619           to.
620
621       $SYSTEMD_URLIFY
622           The value must be a boolean. Controls whether clickable links
623           should be generated in the output for terminal emulators supporting
624           this. This can be specified to override the decision that systemd
625           makes based on $TERM and other conditions.
626

SEE ALSO

628       systemd(1), systemctl(1)
629
630
631
632systemd 243                                                 SYSTEMD-ANALYZE(1)
Impressum