mirror of
https://git.proxmox.com/git/systemd
synced 2025-06-02 21:38:04 +00:00
175 lines
18 KiB
HTML
175 lines
18 KiB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>systemd-analyze</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
|
||
a.headerlink {
|
||
color: #c60f0f;
|
||
font-size: 0.8em;
|
||
padding: 0 4px 0 4px;
|
||
text-decoration: none;
|
||
visibility: hidden;
|
||
}
|
||
|
||
a.headerlink:hover {
|
||
background-color: #c60f0f;
|
||
color: white;
|
||
}
|
||
|
||
h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
|
||
visibility: visible;
|
||
}
|
||
</style><a href="index.html">Index </a>·
|
||
<a href="systemd.directives.html">Directives </a>·
|
||
<a href="../python-systemd/index.html">Python </a>·
|
||
<a href="../libudev/index.html">libudev </a>·
|
||
<a href="../libudev/index.html">gudev </a><span style="float:right">systemd 219</span><hr><div class="refentry"><a name="systemd-analyze"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>systemd-analyze — Analyze system boot-up performance</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">systemd-analyze</code> [OPTIONS...] [time]</p></div><div class="cmdsynopsis"><p><code class="command">systemd-analyze</code> [OPTIONS...] blame </p></div><div class="cmdsynopsis"><p><code class="command">systemd-analyze</code> [OPTIONS...] critical-chain [<em class="replaceable"><code>UNIT</code></em>...]</p></div><div class="cmdsynopsis"><p><code class="command">systemd-analyze</code> [OPTIONS...] plot [> file.svg]</p></div><div class="cmdsynopsis"><p><code class="command">systemd-analyze</code> [OPTIONS...] dot [<em class="replaceable"><code>PATTERN</code></em>...] [> file.dot]</p></div><div class="cmdsynopsis"><p><code class="command">systemd-analyze</code> [OPTIONS...] dump </p></div><div class="cmdsynopsis"><p><code class="command">systemd-analyze</code> [OPTIONS...] set-log-level [<em class="replaceable"><code>LEVEL</code></em>]</p></div><div class="cmdsynopsis"><p><code class="command">systemd-analyze</code> [OPTIONS...] verify [<em class="replaceable"><code>FILES</code></em>...]</p></div></div><div class="refsect1"><a name="idm140641388268928"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><span class="command"><strong>systemd-analyze</strong></span> may be used to determine
|
||
system boot-up performance statistics and retrieve other state and
|
||
tracing information from the system and service manager, and to
|
||
verify the correctness of unit files.</p><p><span class="command"><strong>systemd-analyze time</strong></span> prints the time
|
||
spent in the kernel before userspace has been reached, the time
|
||
spent in the initial RAM disk (initrd) before normal system
|
||
userspace has been reached, and the time normal system userspace
|
||
took to initialize. Note that these measurements simply measure
|
||
the time passed up to the point where all system services have
|
||
been spawned, but not necessarily until they fully finished
|
||
initialization or the disk is idle.</p><p><span class="command"><strong>systemd-analyze blame</strong></span> prints a list of
|
||
all running units, ordered by the time they took to initialize.
|
||
This information may be used to optimize boot-up times. Note that
|
||
the output might be misleading as the initialization of one
|
||
service might be slow simply because it waits for the
|
||
initialization of another service to complete.</p><p><span class="command"><strong>systemd-analyze critical-chain
|
||
[<em class="replaceable"><code>UNIT...</code></em>]</strong></span> prints a tree of
|
||
the time-critical chain of units (for each of the specified
|
||
<em class="replaceable"><code>UNIT</code></em>s or for the default target
|
||
otherwise). The time after the unit is active or started is
|
||
printed after the "@" character. The time the unit takes to start
|
||
is printed after the "+" character. Note that the output might be
|
||
misleading as the initialization of one service might depend on
|
||
socket activation and because of the parallel execution of
|
||
units.</p><p><span class="command"><strong>systemd-analyze plot</strong></span> prints an SVG
|
||
graphic detailing which system services have been started at what
|
||
time, highlighting the time they spent on initialization.</p><p><span class="command"><strong>systemd-analyze dot</strong></span> generates textual
|
||
dependency graph description in dot format for further processing
|
||
with the GraphViz
|
||
<a href="dot.html"><span class="citerefentry"><span class="refentrytitle">dot</span>(1)</span></a>
|
||
tool. Use a command line like <span class="command"><strong>systemd-analyze dot | dot
|
||
-Tsvg > systemd.svg</strong></span> to generate a graphical dependency
|
||
tree. Unless <code class="option">--order</code> or
|
||
<code class="option">--require</code> is passed, the generated graph will
|
||
show both ordering and requirement dependencies. Optional pattern
|
||
globbing style specifications (e.g. <code class="filename">*.target</code>)
|
||
may be given at the end. A unit dependency is included in the
|
||
graph if any of these patterns match either the origin or
|
||
destination node.</p><p><span class="command"><strong>systemd-analyze dump</strong></span> outputs a (usually
|
||
very long) human-readable serialization of the complete server
|
||
state. Its format is subject to change without notice and should
|
||
not be parsed by applications.</p><p><span class="command"><strong>systemd-analyze set-log-level
|
||
<em class="replaceable"><code>LEVEL</code></em></strong></span> changes the current log
|
||
level of the <span class="command"><strong>systemd</strong></span> daemon to
|
||
<em class="replaceable"><code>LEVEL</code></em> (accepts the same values as
|
||
<code class="option">--log-level=</code> described in
|
||
<a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>).</p><p><span class="command"><strong>systemd-analyze verify</strong></span> will load unit
|
||
files and print warnings if any errors are detected. Files
|
||
specified on the command line will be loaded, but also any other
|
||
units referenced by them. This command works by prepending the
|
||
directories for all command line arguments at the beginning of the
|
||
unit load path, which means that all units files found in those
|
||
directories will be used in preference to the unit files found in
|
||
the standard locations, even if not listed explicitly.</p><p>If no command is passed, <span class="command"><strong>systemd-analyze
|
||
time</strong></span> is implied.</p></div><div class="refsect1"><a name="idm140641388249104"></a><h2 id="Options">Options<a class="headerlink" title="Permalink to this headline" href="#Options">¶</a></h2><p>The following options are understood:</p><div class="variablelist"><dl class="variablelist"><dt id="--user"><span class="term"><code class="option">--user</code></span><a class="headerlink" title="Permalink to this term" href="#--user">¶</a></dt><dd><p>Operates on the user systemd
|
||
instance.</p></dd><dt id="--system"><span class="term"><code class="option">--system</code></span><a class="headerlink" title="Permalink to this term" href="#--system">¶</a></dt><dd><p>Operates on the system systemd instance. This
|
||
is the implied default.</p></dd><dt id="--order"><span class="term"><code class="option">--order</code>, </span><span class="term"><code class="option">--require</code></span><a class="headerlink" title="Permalink to this term" href="#--order">¶</a></dt><dd><p>When used in conjunction with the
|
||
<span class="command"><strong>dot</strong></span> command (see above), selects which
|
||
dependencies are shown in the dependency graph. If
|
||
<code class="option">--order</code> is passed, only dependencies of type
|
||
<code class="varname">After=</code> or <code class="varname">Before=</code> are
|
||
shown. If <code class="option">--require</code> is passed, only
|
||
dependencies of type <code class="varname">Requires=</code>,
|
||
<code class="varname">RequiresOverridable=</code>,
|
||
<code class="varname">Requisite=</code>,
|
||
<code class="varname">RequisiteOverridable=</code>,
|
||
<code class="varname">Wants=</code> and <code class="varname">Conflicts=</code>
|
||
are shown. If neither is passed, this shows dependencies of
|
||
all these types.</p></dd><dt id="--from-pattern="><span class="term"><code class="option">--from-pattern=</code>, </span><span class="term"><code class="option">--to-pattern=</code></span><a class="headerlink" title="Permalink to this term" href="#--from-pattern=">¶</a></dt><dd><p>When used in conjunction with the
|
||
<span class="command"><strong>dot</strong></span> command (see above), this selects which
|
||
relationships are shown in the dependency graph. Both options
|
||
require a
|
||
<a href="glob.html"><span class="citerefentry"><span class="refentrytitle">glob</span>(7)</span></a>
|
||
pattern as an argument, which will be matched against the
|
||
left-hand and the right-hand, respectively, nodes of a
|
||
relationship.</p><p>Each of these can be used more than once, in which case
|
||
the unit name must match one of the values. When tests for
|
||
both sides of the relation are present, a relation must pass
|
||
both tests to be shown. When patterns are also specified as
|
||
positional arguments, they must match at least one side of the
|
||
relation. In other words, patterns specified with those two
|
||
options will trim the list of edges matched by the positional
|
||
arguments, if any are given, and fully determine the list of
|
||
edges shown otherwise.</p></dd><dt id="--fuzz=timespan"><span class="term"><code class="option">--fuzz=</code><em class="replaceable"><code>timespan</code></em></span><a class="headerlink" title="Permalink to this term" href="#--fuzz=timespan">¶</a></dt><dd><p>When used in conjunction with the
|
||
<span class="command"><strong>critical-chain</strong></span> command (see above), also
|
||
show units, which finished <em class="replaceable"><code>timespan</code></em>
|
||
earlier, than the latest unit in the same level. The unit of
|
||
<em class="replaceable"><code>timespan</code></em> is seconds unless
|
||
specified with a different unit, e.g.
|
||
"50ms".</p></dd><dt id="--no-man"><span class="term"><code class="option">--no-man</code></span><a class="headerlink" title="Permalink to this term" href="#--no-man">¶</a></dt><dd><p>Do not invoke man to verify the existence of
|
||
man pages listed in <code class="varname">Documentation=</code>.
|
||
</p></dd><dt id="-H"><span class="term"><code class="option">-H</code>, </span><span class="term"><code class="option">--host=</code></span><a class="headerlink" title="Permalink to this term" href="#-H">¶</a></dt><dd><p><a name="host-text"></a>Execute the operation remotely. Specify a hostname, or a
|
||
username and hostname separated by "<code class="literal">@</code>", to
|
||
connect to. The hostname may optionally be suffixed by a
|
||
container name, separated by "<code class="literal">:</code>", which
|
||
connects directly to a specific container on the specified
|
||
host. This will use SSH to talk to the remote machine manager
|
||
instance. Container names may be enumerated with
|
||
<span class="command"><strong>machinectl -H
|
||
<em class="replaceable"><code>HOST</code></em></strong></span>.</p></dd><dt id="-M"><span class="term"><code class="option">-M</code>, </span><span class="term"><code class="option">--machine=</code></span><a class="headerlink" title="Permalink to this term" href="#-M">¶</a></dt><dd><p><a name="machine-text"></a>Execute operation on a local container. Specify a
|
||
container name to connect to.</p></dd><dt id="-h"><span class="term"><code class="option">-h</code>, </span><span class="term"><code class="option">--help</code></span><a class="headerlink" title="Permalink to this term" href="#-h">¶</a></dt><dd><p><a name="help-text"></a>Print a short help text and exit.
|
||
</p></dd><dt id="--version"><span class="term"><code class="option">--version</code></span><a class="headerlink" title="Permalink to this term" href="#--version">¶</a></dt><dd><p><a name="version-text"></a>Print a short version string and exit.</p></dd><dt id="--no-pager"><span class="term"><code class="option">--no-pager</code></span><a class="headerlink" title="Permalink to this term" href="#--no-pager">¶</a></dt><dd><p>Do not pipe output into a pager.</p></dd></dl></div></div><div class="refsect1"><a name="idm140641383313088"></a><h2 id="Exit status">Exit status<a class="headerlink" title="Permalink to this headline" href="#Exit%20status">¶</a></h2><p>On success, 0 is returned, a non-zero failure code
|
||
otherwise.</p></div><div class="refsect1"><a name="idm140641383311936"></a><h2 id="Examples for dot">Examples for <span class="command"><strong>dot</strong></span><a class="headerlink" title="Permalink to this headline" href="#Examples%20for%20dot">¶</a></h2><div class="example"><a name="idm140641383310800"></a><p class="title"><b>Example 1. Plots all dependencies of any unit whose name starts with
|
||
"<code class="literal">avahi-daemon</code>"</b></p><div class="example-contents"><pre class="programlisting">$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg > avahi.svg
|
||
$ eog avahi.svg</pre></div></div><br class="example-break"><div class="example"><a name="idm140641383308816"></a><p class="title"><b>Example 2. Plots the dependencies between all known target units</b></p><div class="example-contents"><pre class="programlisting">systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' | dot -Tsvg > targets.svg
|
||
$ eog targets.svg</pre></div></div><br class="example-break"></div><div class="refsect1"><a name="idm140641383307168"></a><h2 id="Examples for verify">Examples for <span class="command"><strong>verify</strong></span><a class="headerlink" title="Permalink to this headline" href="#Examples%20for%20verify">¶</a></h2><p>The following errors are currently detected:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>unknown sections and directives,
|
||
</p></li><li class="listitem"><p>missing dependencies which are required to start
|
||
the given unit, </p></li><li class="listitem"><p>man pages listed in
|
||
<code class="varname">Documentation=</code> which are not found in the
|
||
system,</p></li><li class="listitem"><p>commands listed in <code class="varname">ExecStart=</code>
|
||
and similar which are not found in the system or not
|
||
executable.</p></li></ul></div><div class="example"><a name="idm140641383302352"></a><p class="title"><b>Example 3. Misspelt directives</b></p><div class="example-contents"><pre class="programlisting">$ cat ./user.slice
|
||
[Unit]
|
||
WhatIsThis=11
|
||
Documentation=man:nosuchfile(1)
|
||
Requires=different.service
|
||
|
||
[Service]
|
||
Desription=x
|
||
|
||
$ systemd-analyze verify ./user.slice
|
||
[./user.slice:9] Unknown lvalue 'WhatIsThis' in section 'Unit'
|
||
[./user.slice:13] Unknown section 'Service'. Ignoring.
|
||
Error: org.freedesktop.systemd1.LoadFailed:
|
||
Unit different.service failed to load:
|
||
No such file or directory.
|
||
Failed to create user.slice/start: Invalid argument
|
||
user.slice: man nosuchfile(1) command failed with code 16
|
||
</pre></div></div><br class="example-break"><div class="example"><a name="idm140641383300432"></a><p class="title"><b>Example 4. Missing service units</b></p><div class="example-contents"><pre class="programlisting">$ tail ./a.socket ./b.socket
|
||
==> ./a.socket <==
|
||
[Socket]
|
||
ListenStream=100
|
||
|
||
==> ./b.socket <==
|
||
[Socket]
|
||
ListenStream=100
|
||
Accept=yes
|
||
|
||
$ systemd-analyze verify ./a.socket ./b.socket
|
||
Service a.service not loaded, a.socket cannot be started.
|
||
Service b@0.service not loaded, b.socket cannot be started.
|
||
</pre></div></div><br class="example-break"></div><div class="refsect1"><a name="idm140641370572560"></a><h2 id="Environment">Environment<a class="headerlink" title="Permalink to this headline" href="#Environment">¶</a></h2><div class="variablelist"><dl class="variablelist"><dt id="$SYSTEMD_PAGER"><span class="term"><code class="varname">$SYSTEMD_PAGER</code></span><a class="headerlink" title="Permalink to this term" href="#%24SYSTEMD_PAGER">¶</a></dt><dd><p>Pager to use when
|
||
<code class="option">--no-pager</code> is not given;
|
||
overrides <code class="varname">$PAGER</code>. Setting
|
||
this to an empty string or the value
|
||
"<code class="literal">cat</code>" is equivalent to passing
|
||
<code class="option">--no-pager</code>.</p></dd><dt id="$SYSTEMD_LESS"><span class="term"><code class="varname">$SYSTEMD_LESS</code></span><a class="headerlink" title="Permalink to this term" href="#%24SYSTEMD_LESS">¶</a></dt><dd><p>Override the default
|
||
options passed to
|
||
<span class="command"><strong>less</strong></span>
|
||
("<code class="literal">FRSXMK</code>").</p></dd></dl></div></div><div class="refsect1"><a name="idm140641383297792"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p>
|
||
<a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
|
||
<a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>
|
||
</p></div></div></body></html>
|