]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemctl.xml
pkgconfig: define variables relative to ${prefix}/${rootprefix}/${sysconfdir}
[thirdparty/systemd.git] / man / systemctl.xml
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4 <!ENTITY % entities SYSTEM "custom-entities.ent" >
5 %entities;
6 ]>
7
8 <!--
9 SPDX-License-Identifier: LGPL-2.1+
10 -->
11
12 <refentry id="systemctl"
13 xmlns:xi="http://www.w3.org/2001/XInclude">
14
15 <refentryinfo>
16 <title>systemctl</title>
17 <productname>systemd</productname>
18 </refentryinfo>
19
20 <refmeta>
21 <refentrytitle>systemctl</refentrytitle>
22 <manvolnum>1</manvolnum>
23 </refmeta>
24
25 <refnamediv>
26 <refname>systemctl</refname>
27 <refpurpose>Control the systemd system and service manager</refpurpose>
28 </refnamediv>
29
30 <refsynopsisdiv>
31 <cmdsynopsis>
32 <command>systemctl</command>
33 <arg choice="opt" rep="repeat">OPTIONS</arg>
34 <arg choice="plain">COMMAND</arg>
35 <arg choice="opt" rep="repeat">UNIT</arg>
36 </cmdsynopsis>
37 </refsynopsisdiv>
38
39 <refsect1>
40 <title>Description</title>
41
42 <para><command>systemctl</command> may be used to introspect and
43 control the state of the <literal>systemd</literal> system and
44 service manager. Please refer to
45 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
46 for an introduction into the basic concepts and functionality this
47 tool manages.</para>
48 </refsect1>
49
50 <refsect1>
51 <title>Options</title>
52
53 <para>The following options are understood:</para>
54
55 <variablelist>
56 <varlistentry>
57 <term><option>-t</option></term>
58 <term><option>--type=</option></term>
59
60 <listitem>
61 <para>The argument should be a comma-separated list of unit
62 types such as <option>service</option> and
63 <option>socket</option>.
64 </para>
65
66 <para>If one of the arguments is a unit type, when listing
67 units, limit display to certain unit types. Otherwise, units
68 of all types will be shown.</para>
69
70 <para>As a special case, if one of the arguments is
71 <option>help</option>, a list of allowed values will be
72 printed and the program will exit.</para>
73 </listitem>
74 </varlistentry>
75
76 <varlistentry>
77 <term><option>--state=</option></term>
78
79 <listitem>
80 <para>The argument should be a comma-separated list of unit
81 LOAD, SUB, or ACTIVE states. When listing units, show only
82 those in the specified states. Use <option>--state=failed</option>
83 to show only failed units.</para>
84
85 <para>As a special case, if one of the arguments is
86 <option>help</option>, a list of allowed values will be
87 printed and the program will exit.</para>
88 </listitem>
89 </varlistentry>
90
91 <varlistentry>
92 <term><option>-p</option></term>
93 <term><option>--property=</option></term>
94
95 <listitem>
96 <para>When showing unit/job/manager properties with the
97 <command>show</command> command, limit display to properties
98 specified in the argument. The argument should be a
99 comma-separated list of property names, such as
100 <literal>MainPID</literal>. Unless specified, all known
101 properties are shown. If specified more than once, all
102 properties with the specified names are shown. Shell
103 completion is implemented for property names.</para>
104
105 <para>For the manager itself,
106 <command>systemctl show</command> will show all available
107 properties. Those properties are documented in
108 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
109 </para>
110
111 <para>Properties for units vary by unit type, so showing any
112 unit (even a non-existent one) is a way to list properties
113 pertaining to this type. Similarly, showing any job will list
114 properties pertaining to all jobs. Properties for units are
115 documented in
116 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
117 and the pages for individual unit types
118 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
119 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
120 etc.</para>
121 </listitem>
122 </varlistentry>
123
124 <varlistentry>
125 <term><option>-a</option></term>
126 <term><option>--all</option></term>
127
128 <listitem>
129 <para>When listing units with <command>list-units</command>, also show inactive units and
130 units which are following other units. When showing unit/job/manager properties, show all
131 properties regardless whether they are set or not.</para>
132
133 <para>To list all units installed in the file system, use the
134 <command>list-unit-files</command> command instead.</para>
135
136 <para>When listing units with <command>list-dependencies</command>, recursively show
137 dependencies of all dependent units (by default only dependencies of target units are
138 shown).</para>
139 </listitem>
140 </varlistentry>
141
142 <varlistentry>
143 <term><option>-r</option></term>
144 <term><option>--recursive</option></term>
145
146 <listitem>
147 <para>When listing units, also show units of local
148 containers. Units of local containers will be prefixed with
149 the container name, separated by a single colon character
150 (<literal>:</literal>).</para>
151 </listitem>
152 </varlistentry>
153
154 <varlistentry>
155 <term><option>--reverse</option></term>
156
157 <listitem>
158 <para>Show reverse dependencies between units with
159 <command>list-dependencies</command>, i.e. follow
160 dependencies of type <varname>WantedBy=</varname>,
161 <varname>RequiredBy=</varname>,
162 <varname>PartOf=</varname>, <varname>BoundBy=</varname>,
163 instead of <varname>Wants=</varname> and similar.
164 </para>
165 </listitem>
166 </varlistentry>
167
168 <varlistentry>
169 <term><option>--after</option></term>
170
171 <listitem>
172 <para>With <command>list-dependencies</command>, show the
173 units that are ordered before the specified unit. In other
174 words, recursively list units following the
175 <varname>After=</varname> dependency.</para>
176
177 <para>Note that any <varname>After=</varname> dependency is
178 automatically mirrored to create a
179 <varname>Before=</varname> dependency. Temporal dependencies
180 may be specified explicitly, but are also created implicitly
181 for units which are <varname>WantedBy=</varname> targets
182 (see
183 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>),
184 and as a result of other directives (for example
185 <varname>RequiresMountsFor=</varname>). Both explicitly
186 and implicitly introduced dependencies are shown with
187 <command>list-dependencies</command>.</para>
188
189 <para>When passed to the <command>list-jobs</command> command, for each printed job show which other jobs are
190 waiting for it. May be combined with <option>--before</option> to show both the jobs waiting for each job as
191 well as all jobs each job is waiting for.</para>
192 </listitem>
193 </varlistentry>
194
195 <varlistentry>
196 <term><option>--before</option></term>
197
198 <listitem>
199 <para>With <command>list-dependencies</command>, show the
200 units that are ordered after the specified unit. In other
201 words, recursively list units following the
202 <varname>Before=</varname> dependency.</para>
203
204 <para>When passed to the <command>list-jobs</command> command, for each printed job show which other jobs it
205 is waiting for. May be combined with <option>--after</option> to show both the jobs waiting for each job as
206 well as all jobs each job is waiting for.</para>
207 </listitem>
208 </varlistentry>
209
210 <varlistentry>
211 <term><option>-l</option></term>
212 <term><option>--full</option></term>
213
214 <listitem>
215 <para>Do not ellipsize unit names, process tree entries,
216 journal output, or truncate unit descriptions in the output
217 of <command>status</command>, <command>list-units</command>,
218 <command>list-jobs</command>, and
219 <command>list-timers</command>.</para>
220 <para>Also, show installation targets in the output of
221 <command>is-enabled</command>.</para>
222 </listitem>
223 </varlistentry>
224
225 <varlistentry>
226 <term><option>--value</option></term>
227
228 <listitem>
229 <para>When printing properties with <command>show</command>,
230 only print the value, and skip the property name and
231 <literal>=</literal>.</para>
232 </listitem>
233 </varlistentry>
234
235 <varlistentry>
236 <term><option>--show-types</option></term>
237
238 <listitem>
239 <para>When showing sockets, show the type of the socket.</para>
240 </listitem>
241 </varlistentry>
242
243 <varlistentry>
244 <term><option>--job-mode=</option></term>
245
246 <listitem>
247 <para>When queuing a new job, this option controls how to deal with
248 already queued jobs. It takes one of <literal>fail</literal>,
249 <literal>replace</literal>,
250 <literal>replace-irreversibly</literal>,
251 <literal>isolate</literal>,
252 <literal>ignore-dependencies</literal>,
253 <literal>ignore-requirements</literal> or
254 <literal>flush</literal>. Defaults to
255 <literal>replace</literal>, except when the
256 <command>isolate</command> command is used which implies the
257 <literal>isolate</literal> job mode.</para>
258
259 <para>If <literal>fail</literal> is specified and a requested
260 operation conflicts with a pending job (more specifically:
261 causes an already pending start job to be reversed into a stop
262 job or vice versa), cause the operation to fail.</para>
263
264 <para>If <literal>replace</literal> (the default) is
265 specified, any conflicting pending job will be replaced, as
266 necessary.</para>
267
268 <para>If <literal>replace-irreversibly</literal> is specified,
269 operate like <literal>replace</literal>, but also mark the new
270 jobs as irreversible. This prevents future conflicting
271 transactions from replacing these jobs (or even being enqueued
272 while the irreversible jobs are still pending). Irreversible
273 jobs can still be cancelled using the <command>cancel</command>
274 command. This job mode should be used on any transaction which
275 pulls in <filename>shutdown.target</filename>.</para>
276
277 <para><literal>isolate</literal> is only valid for start
278 operations and causes all other units to be stopped when the
279 specified unit is started. This mode is always used when the
280 <command>isolate</command> command is used.</para>
281
282 <para><literal>flush</literal> will cause all queued jobs to
283 be canceled when the new job is enqueued.</para>
284
285 <para>If <literal>ignore-dependencies</literal> is specified,
286 then all unit dependencies are ignored for this new job and
287 the operation is executed immediately. If passed, no required
288 units of the unit passed will be pulled in, and no ordering
289 dependencies will be honored. This is mostly a debugging and
290 rescue tool for the administrator and should not be used by
291 applications.</para>
292
293 <para><literal>ignore-requirements</literal> is similar to
294 <literal>ignore-dependencies</literal>, but only causes the
295 requirement dependencies to be ignored, the ordering
296 dependencies will still be honored.</para>
297 </listitem>
298
299 </varlistentry>
300
301 <varlistentry>
302 <term><option>--fail</option></term>
303
304 <listitem>
305 <para>Shorthand for <option>--job-mode=</option>fail.</para>
306 <para>When used with the <command>kill</command> command,
307 if no units were killed, the operation results in an error.
308 </para>
309 </listitem>
310 </varlistentry>
311
312 <varlistentry>
313 <term><option>-i</option></term>
314 <term><option>--ignore-inhibitors</option></term>
315
316 <listitem>
317 <para>When system shutdown or a sleep state is requested, ignore inhibitor locks. Applications can establish
318 inhibitor locks to avoid that certain important operations (such as CD burning or suchlike) are interrupted
319 by system shutdown or a sleep state. Any user may take these locks and privileged users may override these
320 locks. If any locks are taken, shutdown and sleep state requests will normally fail (unless privileged) and a
321 list of active locks is printed. However, if <option>--ignore-inhibitors</option> is specified, the
322 established locks are ignored and not shown, and the operation attempted anyway, possibly requiring
323 additional privileges.</para>
324 </listitem>
325 </varlistentry>
326
327 <varlistentry>
328 <term><option>--dry-run</option></term>
329
330 <listitem>
331 <para>Just print what would be done. Currently supported by verbs
332 <command>halt</command>, <command>poweroff</command>, <command>reboot</command>,
333 <command>kexec</command>, <command>suspend</command>, <command>hibernate</command>,
334 <command>hybrid-sleep</command>, <command>suspend-then-hibernate</command>,
335 <command>default</command>, <command>rescue</command>,
336 <command>emergency</command>, and <command>exit</command>.</para>
337 </listitem>
338 </varlistentry>
339
340 <varlistentry>
341 <term><option>-q</option></term>
342 <term><option>--quiet</option></term>
343
344 <listitem>
345 <para>Suppress printing of the results of various commands
346 and also the hints about truncated log lines. This does not
347 suppress output of commands for which the printed output is
348 the only result (like <command>show</command>). Errors are
349 always printed.</para>
350 </listitem>
351 </varlistentry>
352
353 <varlistentry>
354 <term><option>--no-block</option></term>
355
356 <listitem>
357 <para>Do not synchronously wait for the requested operation
358 to finish. If this is not specified, the job will be
359 verified, enqueued and <command>systemctl</command> will
360 wait until the unit's start-up is completed. By passing this
361 argument, it is only verified and enqueued. This option may not be
362 combined with <option>--wait</option>.</para>
363 </listitem>
364 </varlistentry>
365
366 <varlistentry>
367 <term><option>--wait</option></term>
368
369 <listitem>
370 <para>Synchronously wait for started units to terminate again.
371 This option may not be combined with <option>--no-block</option>.
372 Note that this will wait forever if any given unit never terminates
373 (by itself or by getting stopped explicitly); particularly services
374 which use <literal>RemainAfterExit=yes</literal>.</para>
375
376 <para>When used with <command>is-system-running</command>, wait
377 until the boot process is completed before returning.</para>
378 </listitem>
379 </varlistentry>
380
381 <xi:include href="user-system-options.xml" xpointer="user" />
382 <xi:include href="user-system-options.xml" xpointer="system" />
383
384 <varlistentry>
385 <term><option>--failed</option></term>
386
387 <listitem>
388 <para>List units in failed state. This is equivalent to
389 <option>--state=failed</option>.</para>
390 </listitem>
391 </varlistentry>
392
393 <varlistentry>
394 <term><option>--no-wall</option></term>
395
396 <listitem>
397 <para>Do not send wall message before halt, power-off and reboot.</para>
398 </listitem>
399 </varlistentry>
400
401 <varlistentry>
402 <term><option>--global</option></term>
403
404 <listitem>
405 <para>When used with <command>enable</command> and
406 <command>disable</command>, operate on the global user
407 configuration directory, thus enabling or disabling a unit
408 file globally for all future logins of all users.</para>
409 </listitem>
410 </varlistentry>
411
412 <varlistentry>
413 <term><option>--no-reload</option></term>
414
415 <listitem>
416 <para>When used with <command>enable</command> and
417 <command>disable</command>, do not implicitly reload daemon
418 configuration after executing the changes.</para>
419 </listitem>
420 </varlistentry>
421
422 <varlistentry>
423 <term><option>--no-ask-password</option></term>
424
425 <listitem>
426 <para>When used with <command>start</command> and related
427 commands, disables asking for passwords. Background services
428 may require input of a password or passphrase string, for
429 example to unlock system hard disks or cryptographic
430 certificates. Unless this option is specified and the
431 command is invoked from a terminal,
432 <command>systemctl</command> will query the user on the
433 terminal for the necessary secrets. Use this option to
434 switch this behavior off. In this case, the password must be
435 supplied by some other means (for example graphical password
436 agents) or the service might fail. This also disables
437 querying the user for authentication for privileged
438 operations.</para>
439 </listitem>
440 </varlistentry>
441
442 <varlistentry>
443 <term><option>--kill-who=</option></term>
444
445 <listitem>
446 <para>When used with <command>kill</command>, choose which
447 processes to send a signal to. Must be one of
448 <option>main</option>, <option>control</option> or
449 <option>all</option> to select whether to kill only the main
450 process, the control process or all processes of the
451 unit. The main process of the unit is the one that defines
452 the life-time of it. A control process of a unit is one that
453 is invoked by the manager to induce state changes of it. For
454 example, all processes started due to the
455 <varname>ExecStartPre=</varname>,
456 <varname>ExecStop=</varname> or
457 <varname>ExecReload=</varname> settings of service units are
458 control processes. Note that there is only one control
459 process per unit at a time, as only one state change is
460 executed at a time. For services of type
461 <varname>Type=forking</varname>, the initial process started
462 by the manager for <varname>ExecStart=</varname> is a
463 control process, while the process ultimately forked off by
464 that one is then considered the main process of the unit (if
465 it can be determined). This is different for service units
466 of other types, where the process forked off by the manager
467 for <varname>ExecStart=</varname> is always the main process
468 itself. A service unit consists of zero or one main process,
469 zero or one control process plus any number of additional
470 processes. Not all unit types manage processes of these
471 types however. For example, for mount units, control processes
472 are defined (which are the invocations of
473 <filename>&MOUNT_PATH;</filename> and
474 <filename>&UMOUNT_PATH;</filename>), but no main process
475 is defined. If omitted, defaults to
476 <option>all</option>.</para>
477 </listitem>
478
479 </varlistentry>
480
481 <varlistentry>
482 <term><option>-s</option></term>
483 <term><option>--signal=</option></term>
484
485 <listitem>
486 <para>When used with <command>kill</command>, choose which
487 signal to send to selected processes. Must be one of the
488 well-known signal specifiers such as <constant>SIGTERM</constant>, <constant>SIGINT</constant> or
489 <constant>SIGSTOP</constant>. If omitted, defaults to
490 <option>SIGTERM</option>.</para>
491 </listitem>
492 </varlistentry>
493
494 <varlistentry>
495 <term><option>-f</option></term>
496 <term><option>--force</option></term>
497
498 <listitem>
499 <para>When used with <command>enable</command>, overwrite
500 any existing conflicting symlinks.</para>
501
502 <para>When used with <command>edit</command>, create all of the
503 specified units which do not already exist.</para>
504
505 <para>When used with <command>halt</command>, <command>poweroff</command>, <command>reboot</command> or
506 <command>kexec</command>, execute the selected operation without shutting down all units. However, all
507 processes will be killed forcibly and all file systems are unmounted or remounted read-only. This is hence a
508 drastic but relatively safe option to request an immediate reboot. If <option>--force</option> is specified
509 twice for these operations (with the exception of <command>kexec</command>), they will be executed
510 immediately, without terminating any processes or unmounting any file systems. Warning: specifying
511 <option>--force</option> twice with any of these operations might result in data loss. Note that when
512 <option>--force</option> is specified twice the selected operation is executed by
513 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
514 succeed even when the system manager has crashed.</para>
515 </listitem>
516 </varlistentry>
517
518 <varlistentry>
519 <term><option>--message=</option></term>
520
521 <listitem>
522 <para>When used with <command>halt</command>, <command>poweroff</command> or <command>reboot</command>, set a
523 short message explaining the reason for the operation. The message will be logged together with the default
524 shutdown message.</para>
525 </listitem>
526 </varlistentry>
527
528 <varlistentry>
529 <term><option>--now</option></term>
530
531 <listitem>
532 <para>When used with <command>enable</command>, the units
533 will also be started. When used with <command>disable</command> or
534 <command>mask</command>, the units will also be stopped. The start
535 or stop operation is only carried out when the respective enable or
536 disable operation has been successful.</para>
537 </listitem>
538 </varlistentry>
539
540 <varlistentry>
541 <term><option>--root=</option></term>
542
543 <listitem>
544 <para>When used with
545 <command>enable</command>/<command>disable</command>/<command>is-enabled</command>
546 (and related commands), use the specified root path when looking for unit
547 files. If this option is present, <command>systemctl</command> will operate on
548 the file system directly, instead of communicating with the <command>systemd</command>
549 daemon to carry out changes.</para>
550 </listitem>
551
552 </varlistentry>
553
554 <varlistentry>
555 <term><option>--runtime</option></term>
556
557 <listitem>
558 <para>When used with <command>set-property</command>, make changes only
559 temporarily, so that they are lost on the next reboot.</para>
560
561 <para>Similarily, when used with <command>enable</command>, <command>mask</command>,
562 <command>edit</command> and related commands, make temporary changes, which are lost on
563 the next reboot. Changes are not made in subdirectories of <filename>/etc</filename>, but
564 in <filename>/run</filename>. The immediate effect is identical, however since the latter
565 is lost on reboot, the changes are lost too.</para>
566
567 <para>Note: this option cannot be used with <command>disable</command>,
568 <command>unmask</command>, <command>preset</command>, or <command>preset-all</command>,
569 because those operations sometimes need to remove symlinks under <filename>/etc</filename>
570 to have the desired effect, which would cause a persistent change.</para>
571 </listitem>
572 </varlistentry>
573
574 <varlistentry>
575 <term><option>--preset-mode=</option></term>
576
577 <listitem>
578 <para>Takes one of <literal>full</literal> (the default),
579 <literal>enable-only</literal>,
580 <literal>disable-only</literal>. When used with the
581 <command>preset</command> or <command>preset-all</command>
582 commands, controls whether units shall be disabled and
583 enabled according to the preset rules, or only enabled, or
584 only disabled.</para>
585 </listitem>
586 </varlistentry>
587
588 <varlistentry>
589 <term><option>-n</option></term>
590 <term><option>--lines=</option></term>
591
592 <listitem>
593 <para>When used with <command>status</command>, controls the number of journal lines to show, counting from
594 the most recent ones. Takes a positive integer argument, or 0 to disable journal output. Defaults to
595 10.</para>
596 </listitem>
597 </varlistentry>
598
599 <varlistentry>
600 <term><option>-o</option></term>
601 <term><option>--output=</option></term>
602
603 <listitem>
604 <para>When used with <command>status</command>, controls the
605 formatting of the journal entries that are shown. For the
606 available choices, see
607 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
608 Defaults to <literal>short</literal>.</para>
609 </listitem>
610 </varlistentry>
611
612 <varlistentry>
613 <term><option>--firmware-setup</option></term>
614
615 <listitem>
616 <para>When used with the <command>reboot</command> command,
617 indicate to the system's firmware to boot into setup
618 mode. Note that this is currently only supported on some EFI
619 systems and only if the system was booted in EFI
620 mode.</para>
621 </listitem>
622 </varlistentry>
623
624 <varlistentry>
625 <term><option>--plain</option></term>
626
627 <listitem>
628 <para>When used with <command>list-dependencies</command>,
629 <command>list-units</command> or <command>list-machines</command>,
630 the output is printed as a list instead of a tree, and the bullet
631 circles are omitted.</para>
632 </listitem>
633 </varlistentry>
634
635 <xi:include href="user-system-options.xml" xpointer="host" />
636 <xi:include href="user-system-options.xml" xpointer="machine" />
637
638 <xi:include href="standard-options.xml" xpointer="no-pager" />
639 <xi:include href="standard-options.xml" xpointer="no-legend" />
640 <xi:include href="standard-options.xml" xpointer="help" />
641 <xi:include href="standard-options.xml" xpointer="version" />
642 </variablelist>
643 </refsect1>
644
645 <refsect1>
646 <title>Commands</title>
647
648 <para>The following commands are understood:</para>
649
650 <refsect2>
651 <title>Unit Commands</title>
652
653 <variablelist>
654 <varlistentry>
655 <term><command>list-units</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
656
657 <listitem>
658 <para>List units that <command>systemd</command> currently has in memory. This includes units that are
659 either referenced directly or through a dependency, units that are pinned by applications programmatically,
660 or units that were active in the past and have failed. By default only units which are active, have pending
661 jobs, or have failed are shown; this can be changed with option <option>--all</option>. If one or more
662 <replaceable>PATTERN</replaceable>s are specified, only units matching one of them are shown. The units
663 that are shown are additionally filtered by <option>--type=</option> and <option>--state=</option> if those
664 options are specified.</para>
665
666 <para>Produces output similar to
667 <programlisting> UNIT LOAD ACTIVE SUB DESCRIPTION
668 sys-module-fuse.device loaded active plugged /sys/module/fuse
669 -.mount loaded active mounted Root Mount
670 boot-efi.mount loaded active mounted /boot/efi
671 systemd-journald.service loaded active running Journal Service
672 systemd-logind.service loaded active running Login Service
673 â—Ź user@1000.service loaded failed failed User Manager for UID 1000
674 …
675 systemd-tmpfiles-clean.timer loaded active waiting Daily Cleanup of Temporary Directories
676
677 LOAD = Reflects whether the unit definition was properly loaded.
678 ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
679 SUB = The low-level unit activation state, values depend on unit type.
680
681 123 loaded units listed. Pass --all to see loaded but inactive units, too.
682 To show all installed unit files use 'systemctl list-unit-files'.
683 </programlisting>
684 The header and the last unit of a given type are underlined if the
685 terminal supports that. A colored dot is shown next to services which
686 were masked, not found, or otherwise failed.</para>
687
688 <para>The LOAD column shows the load state, one of <constant>loaded</constant>,
689 <constant>not-found</constant>, <constant>bad-setting</constant>, <constant>error</constant>,
690 <constant>masked</constant>. The ACTIVE columns shows the general unit state, one of
691 <constant>active</constant>, <constant>reloading</constant>, <constant>inactive</constant>,
692 <constant>failed</constant>, <constant>activating</constant>, <constant>deactivating</constant>. The SUB
693 column shows the unit-type-specific detailed state of the unit, possible values vary by unit type. The list
694 of possible LOAD, ACTIVE, and SUB states is not constant and new systemd releases may both add and remove
695 values. <programlisting>systemctl --state=help</programlisting> command maybe be used to display the
696 current set of possible values.</para>
697
698 <para>This is the default command.</para>
699 </listitem>
700 </varlistentry>
701
702 <varlistentry>
703 <term><command>list-sockets</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
704
705 <listitem>
706 <para>List socket units currently in memory, ordered by listening address. If one or more
707 <replaceable>PATTERN</replaceable>s are specified, only socket units matching one of them are
708 shown. Produces output similar to
709 <programlisting>
710 LISTEN UNIT ACTIVATES
711 /dev/initctl systemd-initctl.socket systemd-initctl.service
712 …
713 [::]:22 sshd.socket sshd.service
714 kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
715
716 5 sockets listed.</programlisting>
717 Note: because the addresses might contains spaces, this output
718 is not suitable for programmatic consumption.
719 </para>
720
721 <para>Also see <option>--show-types</option>, <option>--all</option>, and <option>--state=</option>.</para>
722 </listitem>
723 </varlistentry>
724
725 <varlistentry>
726 <term><command>list-timers</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
727
728 <listitem>
729 <para>List timer units currently in memory, ordered by the time they elapse next. If one or more
730 <replaceable>PATTERN</replaceable>s are specified, only units matching one of them are shown.
731 Produces output similar to
732 <programlisting>
733 NEXT LEFT LAST PASSED UNIT ACTIVATES
734 n/a n/a Thu 2017-02-23 13:40:29 EST 3 days ago ureadahead-stop.timer ureadahead-stop.service
735 Sun 2017-02-26 18:55:42 EST 1min 14s left Thu 2017-02-23 13:54:44 EST 3 days ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
736 Sun 2017-02-26 20:37:16 EST 1h 42min left Sun 2017-02-26 11:56:36 EST 6h ago apt-daily.timer apt-daily.service
737 Sun 2017-02-26 20:57:49 EST 2h 3min left Sun 2017-02-26 11:56:36 EST 6h ago snapd.refresh.timer snapd.refresh.service
738 </programlisting>
739 </para>
740
741 <para><emphasis>NEXT</emphasis> shows the next time the timer will run.</para>
742 <para><emphasis>LEFT</emphasis> shows how long till the next time the timer runs.</para>
743 <para><emphasis>LAST</emphasis> shows the last time the timer ran.</para>
744 <para><emphasis>PASSED</emphasis> shows how long has passed since the timer last ran.</para>
745 <para><emphasis>UNIT</emphasis> shows the name of the timer</para>
746 <para><emphasis>ACTIVATES</emphasis> shows the name the service the timer activates when it runs.</para>
747
748 <para>Also see <option>--all</option> and <option>--state=</option>.</para>
749 </listitem>
750 </varlistentry>
751
752 <varlistentry>
753 <term><command>start <replaceable>PATTERN</replaceable>…</command></term>
754
755 <listitem>
756 <para>Start (activate) one or more units specified on the
757 command line.</para>
758
759 <para>Note that glob patterns operate on the set of primary names of units currently in memory. Units which
760 are not active and are not in a failed state usually are not in memory, and will not be matched by any
761 pattern. In addition, in case of instantiated units, systemd is often unaware of the instance name until
762 the instance has been started. Therefore, using glob patterns with <command>start</command> has limited
763 usefulness. Also, secondary alias names of units are not considered.</para>
764 </listitem>
765 </varlistentry>
766 <varlistentry>
767 <term><command>stop <replaceable>PATTERN</replaceable>…</command></term>
768
769 <listitem>
770 <para>Stop (deactivate) one or more units specified on the
771 command line.</para>
772 </listitem>
773 </varlistentry>
774 <varlistentry>
775 <term><command>reload <replaceable>PATTERN</replaceable>…</command></term>
776
777 <listitem>
778 <para>Asks all units listed on the command line to reload
779 their configuration. Note that this will reload the
780 service-specific configuration, not the unit configuration
781 file of systemd. If you want systemd to reload the
782 configuration file of a unit, use the
783 <command>daemon-reload</command> command. In other words:
784 for the example case of Apache, this will reload Apache's
785 <filename>httpd.conf</filename> in the web server, not the
786 <filename>apache.service</filename> systemd unit
787 file.</para>
788
789 <para>This command should not be confused with the
790 <command>daemon-reload</command> command.</para>
791 </listitem>
792
793 </varlistentry>
794 <varlistentry>
795 <term><command>restart <replaceable>PATTERN</replaceable>…</command></term>
796
797 <listitem>
798 <para>Stop and then start one or more units specified on the command line. If the units are not running
799 yet, they will be started.</para>
800
801 <para>Note that restarting a unit with this command does not necessarily flush out all of the unit's
802 resources before it is started again. For example, the per-service file descriptor storage facility (see
803 <varname>FileDescriptorStoreMax=</varname> in
804 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>) will
805 remain intact as long as the unit has a job pending, and is only cleared when the unit is fully stopped and
806 no jobs are pending anymore. If it is intended that the file descriptor store is flushed out, too, during a
807 restart operation an explicit <command>systemctl stop</command> command followed by <command>systemctl
808 start</command> should be issued.</para>
809 </listitem>
810 </varlistentry>
811 <varlistentry>
812 <term><command>try-restart <replaceable>PATTERN</replaceable>…</command></term>
813
814 <listitem>
815 <para>Stop and then start one or more units specified on the
816 command line if the units are running. This does nothing
817 if units are not running.</para>
818 <!-- Note that we don't document condrestart here, as that is just compatibility support, and we generally
819 don't document that. -->
820 </listitem>
821 </varlistentry>
822 <varlistentry>
823 <term><command>reload-or-restart <replaceable>PATTERN</replaceable>…</command></term>
824
825 <listitem>
826 <para>Reload one or more units if they support it. If not, stop and then start them instead. If the units
827 are not running yet, they will be started.</para>
828 </listitem>
829 </varlistentry>
830 <varlistentry>
831 <term><command>try-reload-or-restart <replaceable>PATTERN</replaceable>…</command></term>
832
833 <listitem>
834 <para>Reload one or more units if they support it. If not, stop and then start them instead. This does
835 nothing if the units are not running.</para>
836 <!-- Note that we don't document force-reload here, as that is just compatibility support, and we generally
837 don't document that. -->
838 </listitem>
839 </varlistentry>
840 <varlistentry>
841 <term><command>isolate <replaceable>UNIT</replaceable></command></term>
842
843 <listitem>
844 <para>Start the unit specified on the command line and its dependencies
845 and stop all others, unless they have
846 <option>IgnoreOnIsolate=yes</option> (see
847 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
848 If a unit name with no extension is given, an extension of
849 <literal>.target</literal> will be assumed.</para>
850
851 <para>This is similar to changing the runlevel in a
852 traditional init system. The <command>isolate</command>
853 command will immediately stop processes that are not enabled
854 in the new unit, possibly including the graphical
855 environment or terminal you are currently using.</para>
856
857 <para>Note that this is allowed only on units where
858 <option>AllowIsolate=</option> is enabled. See
859 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
860 for details.</para>
861 </listitem>
862 </varlistentry>
863 <varlistentry>
864 <term><command>kill <replaceable>PATTERN</replaceable>…</command></term>
865
866 <listitem>
867 <para>Send a signal to one or more processes of the
868 unit. Use <option>--kill-who=</option> to select which
869 process to kill. Use <option>--signal=</option> to select
870 the signal to send.</para>
871 </listitem>
872 </varlistentry>
873 <varlistentry>
874 <term><command>is-active <replaceable>PATTERN</replaceable>…</command></term>
875
876 <listitem>
877 <para>Check whether any of the specified units are active
878 (i.e. running). Returns an exit code
879 <constant>0</constant> if at least one is active, or
880 non-zero otherwise. Unless <option>--quiet</option> is
881 specified, this will also print the current unit state to
882 standard output.</para>
883 </listitem>
884 </varlistentry>
885 <varlistentry>
886 <term><command>is-failed <replaceable>PATTERN</replaceable>…</command></term>
887
888 <listitem>
889 <para>Check whether any of the specified units are in a
890 "failed" state. Returns an exit code
891 <constant>0</constant> if at least one has failed,
892 non-zero otherwise. Unless <option>--quiet</option> is
893 specified, this will also print the current unit state to
894 standard output.</para>
895 </listitem>
896 </varlistentry>
897 <varlistentry>
898 <term><command>status</command> <optional><replaceable>PATTERN</replaceable>…|<replaceable>PID</replaceable>…]</optional></term>
899
900 <listitem>
901 <para>Show terse runtime status information about one or
902 more units, followed by most recent log data from the
903 journal. If no units are specified, show system status. If
904 combined with <option>--all</option>, also show the status of
905 all units (subject to limitations specified with
906 <option>-t</option>). If a PID is passed, show information
907 about the unit the process belongs to.</para>
908
909 <para>This function is intended to generate human-readable
910 output. If you are looking for computer-parsable output,
911 use <command>show</command> instead. By default, this
912 function only shows 10 lines of output and ellipsizes
913 lines to fit in the terminal window. This can be changed
914 with <option>--lines</option> and <option>--full</option>,
915 see above. In addition, <command>journalctl
916 --unit=<replaceable>NAME</replaceable></command> or
917 <command>journalctl
918 --user-unit=<replaceable>NAME</replaceable></command> use
919 a similar filter for messages and might be more
920 convenient.
921 </para>
922
923 <para>systemd implicitly loads units as necessary, so just running the <command>status</command> will
924 attempt to load a file. The command is thus not useful for determining if something was already loaded or
925 not. The units may possibly also be quickly unloaded after the operation is completed if there's no reason
926 to keep it in memory thereafter.
927 </para>
928
929 <example>
930 <title>Example output from systemctl status </title>
931
932 <programlisting>$ systemctl status bluetooth
933 â—Ź bluetooth.service - Bluetooth service
934 Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
935 Active: active (running) since Wed 2017-01-04 13:54:04 EST; 1 weeks 0 days ago
936 Docs: man:bluetoothd(8)
937 Main PID: 930 (bluetoothd)
938 Status: "Running"
939 Tasks: 1
940 Memory: 648.0K
941 CPU: 435ms
942 CGroup: /system.slice/bluetooth.service
943 └─930 /usr/lib/bluetooth/bluetoothd
944
945 Jan 12 10:46:45 example.com bluetoothd[8900]: Not enough free handles to register service
946 Jan 12 10:46:45 example.com bluetoothd[8900]: Current Time Service could not be registered
947 Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output error (5)
948 </programlisting>
949
950 <para>The dot ("â—Ź") uses color on supported terminals to summarize the unit state at a glance. White
951 indicates an <literal>inactive</literal> or <literal>deactivating</literal> state. Red indicates a
952 <literal>failed</literal> or <literal>error</literal> state and green indicates an
953 <literal>active</literal>, <literal>reloading</literal> or <literal>activating</literal> state.
954 </para>
955
956 <para>The "Loaded:" line in the output will show <literal>loaded</literal> if the unit has been loaded into
957 memory. Other possible values for "Loaded:" include: <literal>error</literal> if there was a problem
958 loading it, <literal>not-found</literal> if not unit file was found for this unit,
959 <literal>bad-setting</literal> if an essential unit file setting could not be parsed and
960 <literal>masked</literal> if the unit file has been masked. Along with showing the path to the unit file,
961 this line will also show the enablement state. Enabled commands start at boot. See the full table of
962 possible enablement states — including the definition of <literal>masked</literal> — in the documentation
963 for the <command>is-enabled</command> command.
964 </para>
965
966 <para>The "Active:" line shows active state. The value is usually <literal>active</literal> or
967 <literal>inactive</literal>. Active could mean started, bound, plugged in, etc depending on the unit type.
968 The unit could also be in process of changing states, reporting a state of <literal>activating</literal> or
969 <literal>deactivating</literal>. A special <literal>failed</literal> state is entered when the service
970 failed in some way, such as a crash, exiting with an error code or timing out. If the failed state is
971 entered the cause will be logged for later reference.</para>
972 </example>
973
974 </listitem>
975 </varlistentry>
976 <varlistentry>
977 <term><command>show</command> <optional><replaceable>PATTERN</replaceable>…|<replaceable>JOB</replaceable>…</optional></term>
978
979 <listitem>
980 <para>Show properties of one or more units, jobs, or the manager itself. If no argument is specified,
981 properties of the manager will be shown. If a unit name is specified, properties of the unit are shown, and
982 if a job ID is specified, properties of the job are shown. By default, empty properties are suppressed. Use
983 <option>--all</option> to show those too. To select specific properties to show, use
984 <option>--property=</option>. This command is intended to be used whenever computer-parsable output is
985 required. Use <command>status</command> if you are looking for formatted human-readable output.</para>
986
987 <para>Many properties shown by <command>systemctl show</command> map directly to configuration settings of
988 the system and service manager and its unit files. Note that the properties shown by the command are
989 generally more low-level, normalized versions of the original configuration settings and expose runtime
990 state in addition to configuration. For example, properties shown for service units include the service's
991 current main process identifier as <literal>MainPID</literal> (which is runtime state), and time settings
992 are always exposed as properties ending in the <literal>…USec</literal> suffix even if a matching
993 configuration options end in <literal>…Sec</literal>, because microseconds is the normalized time unit used
994 by the system and service manager.</para>
995 </listitem>
996 </varlistentry>
997 <varlistentry>
998 <term><command>cat <replaceable>PATTERN</replaceable>…</command></term>
999
1000 <listitem>
1001 <para>Show backing files of one or more units. Prints the
1002 "fragment" and "drop-ins" (source files) of units. Each
1003 file is preceded by a comment which includes the file
1004 name. Note that this shows the contents of the backing files
1005 on disk, which may not match the system manager's
1006 understanding of these units if any unit files were
1007 updated on disk and the <command>daemon-reload</command>
1008 command wasn't issued since.</para>
1009 </listitem>
1010 </varlistentry>
1011 <varlistentry>
1012 <term><command>set-property <replaceable>UNIT</replaceable> <replaceable>PROPERTY</replaceable>=<replaceable>VALUE</replaceable>…</command></term>
1013
1014 <listitem>
1015 <para>Set the specified unit properties at runtime where
1016 this is supported. This allows changing configuration
1017 parameter properties such as resource control settings at
1018 runtime. Not all properties may be changed at runtime, but
1019 many resource control settings (primarily those in
1020 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
1021 may. The changes are applied immediately, and stored on disk
1022 for future boots, unless <option>--runtime</option> is
1023 passed, in which case the settings only apply until the
1024 next reboot. The syntax of the property assignment follows
1025 closely the syntax of assignments in unit files.</para>
1026
1027 <para>Example: <command>systemctl set-property foobar.service CPUShares=777</command></para>
1028
1029 <para>If the specified unit appears to be inactive, the
1030 changes will be only stored on disk as described
1031 previously hence they will be effective when the unit will
1032 be started.</para>
1033
1034 <para>Note that this command allows changing multiple
1035 properties at the same time, which is preferable over
1036 setting them individually. Like with unit file configuration
1037 settings, assigning an empty list will reset the property.
1038 </para>
1039 </listitem>
1040 </varlistentry>
1041
1042 <varlistentry>
1043 <term><command>help <replaceable>PATTERN</replaceable>…|<replaceable>PID</replaceable>…</command></term>
1044
1045 <listitem>
1046 <para>Show manual pages for one or more units, if
1047 available. If a PID is given, the manual pages for the unit
1048 the process belongs to are shown.</para>
1049 </listitem>
1050 </varlistentry>
1051
1052 <varlistentry>
1053 <term><command>reset-failed [<replaceable>PATTERN</replaceable>…]</command></term>
1054
1055 <listitem>
1056 <para>Reset the <literal>failed</literal> state of the specified units, or if no unit name is passed, reset
1057 the state of all units. When a unit fails in some way (i.e. process exiting with non-zero error code,
1058 terminating abnormally or timing out), it will automatically enter the <literal>failed</literal> state and
1059 its exit code and status is recorded for introspection by the administrator until the service is
1060 stopped/re-started or reset with this command.</para>
1061
1062 <para>In addition to resetting the <literal>failed</literal> state of a unit it also resets various other
1063 per-unit properties: the start rate limit counter of all unit types is reset to zero, as is the restart
1064 counter of service units. Thus, if a unit's start limit (as configured with
1065 <varname>StartLimitIntervalSec=</varname>/<varname>StartLimitBurst=</varname>) is hit and the unit refuses
1066 to be started again, use this command to make it startable again.</para>
1067 </listitem>
1068 </varlistentry>
1069
1070 <varlistentry>
1071 <term>
1072 <command>list-dependencies</command>
1073 <optional><replaceable>UNIT</replaceable></optional>
1074 </term>
1075
1076 <listitem>
1077 <para>Shows units required and wanted by the specified
1078 unit. This recursively lists units following the
1079 <varname>Requires=</varname>,
1080 <varname>Requisite=</varname>,
1081 <varname>ConsistsOf=</varname>,
1082 <varname>Wants=</varname>, <varname>BindsTo=</varname>
1083 dependencies. If no unit is specified,
1084 <filename>default.target</filename> is implied.</para>
1085
1086 <para>By default, only target units are recursively
1087 expanded. When <option>--all</option> is passed, all other
1088 units are recursively expanded as well.</para>
1089
1090 <para>Options <option>--reverse</option>,
1091 <option>--after</option>, <option>--before</option>
1092 may be used to change what types of dependencies
1093 are shown.</para>
1094
1095 <para>Note that this command only lists units currently loaded into memory by the service manager. In
1096 particular, this command is not suitable to get a comprehensive list at all reverse dependencies on a
1097 specific unit, as it won't list the dependencies declared by units currently not loaded.</para>
1098 </listitem>
1099 </varlistentry>
1100 </variablelist>
1101 </refsect2>
1102
1103 <refsect2>
1104 <title>Unit File Commands</title>
1105
1106 <variablelist>
1107 <varlistentry>
1108 <term><command>list-unit-files</command> <optional><replaceable>PATTERN…</replaceable></optional></term>
1109
1110 <listitem>
1111 <para>List unit files installed on the system, in combination with their enablement state (as reported by
1112 <command>is-enabled</command>). If one or more <replaceable>PATTERN</replaceable>s are specified, only unit
1113 files whose name matches one of them are shown (patterns matching unit file system paths are not
1114 supported).</para>
1115 </listitem>
1116 </varlistentry>
1117
1118 <varlistentry>
1119 <term><command>enable <replaceable>UNIT</replaceable>…</command></term>
1120 <term><command>enable <replaceable>PATH</replaceable>…</command></term>
1121
1122 <listitem>
1123 <para>Enable one or more units or unit instances. This will create a set of symlinks, as encoded in the
1124 <literal>[Install]</literal> sections of the indicated unit files. After the symlinks have been created,
1125 the system manager configuration is reloaded (in a way equivalent to <command>daemon-reload</command>), in
1126 order to ensure the changes are taken into account immediately. Note that this does
1127 <emphasis>not</emphasis> have the effect of also starting any of the units being enabled. If this is
1128 desired, combine this command with the <option>--now</option> switch, or invoke <command>start</command>
1129 with appropriate arguments later. Note that in case of unit instance enablement (i.e. enablement of units of
1130 the form <filename>foo@bar.service</filename>), symlinks named the same as instances are created in the
1131 unit configuration directory, however they point to the single template unit file they are instantiated
1132 from.</para>
1133
1134 <para>This command expects either valid unit names (in which case various unit file directories are
1135 automatically searched for unit files with appropriate names), or absolute paths to unit files (in which
1136 case these files are read directly). If a specified unit file is located outside of the usual unit file
1137 directories, an additional symlink is created, linking it into the unit configuration path, thus ensuring
1138 it is found when requested by commands such as <command>start</command>. The file system where the linked
1139 unit files are located must be accessible when systemd is started (e.g. anything underneath
1140 <filename>/home</filename> or <filename>/var</filename> is not allowed, unless those directories are
1141 located on the root file system).</para>
1142
1143 <para>This command will print the file system operations executed. This output may be suppressed by passing
1144 <option>--quiet</option>.
1145 </para>
1146
1147 <para>Note that this operation creates only the symlinks suggested in the <literal>[Install]</literal>
1148 section of the unit files. While this command is the recommended way to manipulate the unit configuration
1149 directory, the administrator is free to make additional changes manually by placing or removing symlinks
1150 below this directory. This is particularly useful to create configurations that deviate from the suggested
1151 default installation. In this case, the administrator must make sure to invoke
1152 <command>daemon-reload</command> manually as necessary, in order to ensure the changes are taken into
1153 account.
1154 </para>
1155
1156 <para>Enabling units should not be confused with starting (activating) units, as done by the
1157 <command>start</command> command. Enabling and starting units is orthogonal: units may be enabled without
1158 being started and started without being enabled. Enabling simply hooks the unit into various suggested
1159 places (for example, so that the unit is automatically started on boot or when a particular kind of
1160 hardware is plugged in). Starting actually spawns the daemon process (in case of service units), or binds
1161 the socket (in case of socket units), and so on.</para>
1162
1163 <para>Depending on whether <option>--system</option>, <option>--user</option>, <option>--runtime</option>,
1164 or <option>--global</option> is specified, this enables the unit for the system, for the calling user only,
1165 for only this boot of the system, or for all future logins of all users. Note that in the last case, no
1166 systemd daemon configuration is reloaded.</para>
1167
1168 <para>Using <command>enable</command> on masked units is not supported and results in an error.</para>
1169 </listitem>
1170 </varlistentry>
1171
1172 <varlistentry>
1173 <term><command>disable <replaceable>UNIT</replaceable>…</command></term>
1174
1175 <listitem>
1176 <para>Disables one or more units. This removes all symlinks to the unit files backing the specified units
1177 from the unit configuration directory, and hence undoes any changes made by <command>enable</command> or
1178 <command>link</command>. Note that this removes <emphasis>all</emphasis> symlinks to matching unit files,
1179 including manually created symlinks, and not just those actually created by <command>enable</command> or
1180 <command>link</command>. Note that while <command>disable</command> undoes the effect of
1181 <command>enable</command>, the two commands are otherwise not symmetric, as <command>disable</command> may
1182 remove more symlinks than a prior <command>enable</command> invocation of the same unit created.</para>
1183
1184 <para>This command expects valid unit names only, it does not accept paths to unit files.</para>
1185
1186 <para>In addition to the units specified as arguments, all units are disabled that are listed in the
1187 <varname>Also=</varname> setting contained in the <literal>[Install]</literal> section of any of the unit
1188 files being operated on.</para>
1189
1190 <para>This command implicitly reloads the system manager configuration after completing the operation. Note
1191 that this command does not implicitly stop the units that are being disabled. If this is desired, either
1192 combine this command with the <option>--now</option> switch, or invoke the <command>stop</command> command
1193 with appropriate arguments later.</para>
1194
1195 <para>This command will print information about the file system operations (symlink removals)
1196 executed. This output may be suppressed by passing <option>--quiet</option>.
1197 </para>
1198
1199 <para>This command honors <option>--system</option>, <option>--user</option>, <option>--runtime</option>
1200 and <option>--global</option> in a similar way as <command>enable</command>.</para>
1201 </listitem>
1202 </varlistentry>
1203
1204 <varlistentry>
1205 <term><command>reenable <replaceable>UNIT</replaceable>…</command></term>
1206
1207 <listitem>
1208 <para>Reenable one or more units, as specified on the command line. This is a combination of
1209 <command>disable</command> and <command>enable</command> and is useful to reset the symlinks a unit file is
1210 enabled with to the defaults configured in its <literal>[Install]</literal> section. This command expects
1211 a unit name only, it does not accept paths to unit files.</para>
1212 </listitem>
1213 </varlistentry>
1214
1215 <varlistentry>
1216 <term><command>preset <replaceable>UNIT</replaceable>…</command></term>
1217
1218 <listitem>
1219 <para>Reset the enable/disable status one or more unit files, as specified on
1220 the command line, to the defaults configured in the preset policy files. This
1221 has the same effect as <command>disable</command> or
1222 <command>enable</command>, depending how the unit is listed in the preset
1223 files.</para>
1224
1225 <para>Use <option>--preset-mode=</option> to control whether units shall be
1226 enabled and disabled, or only enabled, or only disabled.</para>
1227
1228 <para>If the unit carries no install information, it will be silently ignored
1229 by this command. <replaceable>UNIT</replaceable> must be the real unit name,
1230 any alias names are ignored silently.</para>
1231
1232 <para>For more information on the preset policy format, see
1233 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1234 For more information on the concept of presets, please consult the
1235 <ulink url="https://www.freedesktop.org/wiki/Software/systemd/Preset">Preset</ulink>
1236 document.</para>
1237 </listitem>
1238 </varlistentry>
1239
1240 <varlistentry>
1241 <term><command>preset-all</command></term>
1242
1243 <listitem>
1244 <para>Resets all installed unit files to the defaults
1245 configured in the preset policy file (see above).</para>
1246
1247 <para>Use <option>--preset-mode=</option> to control
1248 whether units shall be enabled and disabled, or only
1249 enabled, or only disabled.</para>
1250 </listitem>
1251 </varlistentry>
1252
1253 <varlistentry>
1254 <term><command>is-enabled <replaceable>UNIT</replaceable>…</command></term>
1255
1256 <listitem>
1257 <para>Checks whether any of the specified unit files are
1258 enabled (as with <command>enable</command>). Returns an
1259 exit code of 0 if at least one is enabled, non-zero
1260 otherwise. Prints the current enable status (see table).
1261 To suppress this output, use <option>--quiet</option>.
1262 To show installation targets, use <option>--full</option>.
1263 </para>
1264
1265 <table>
1266 <title>
1267 <command>is-enabled</command> output
1268 </title>
1269
1270 <tgroup cols='3'>
1271 <thead>
1272 <row>
1273 <entry>Name</entry>
1274 <entry>Description</entry>
1275 <entry>Exit Code</entry>
1276 </row>
1277 </thead>
1278 <tbody>
1279 <row>
1280 <entry><literal>enabled</literal></entry>
1281 <entry morerows='1'>Enabled via <filename>.wants/</filename>, <filename>.requires/</filename> or <varname>Alias=</varname> symlinks (permanently in <filename>/etc/systemd/system/</filename>, or transiently in <filename>/run/systemd/system/</filename>).</entry>
1282 <entry morerows='1'>0</entry>
1283 </row>
1284 <row>
1285 <entry><literal>enabled-runtime</literal></entry>
1286 </row>
1287 <row>
1288 <entry><literal>linked</literal></entry>
1289 <entry morerows='1'>Made available through one or more symlinks to the unit file (permanently in <filename>/etc/systemd/system/</filename> or transiently in <filename>/run/systemd/system/</filename>), even though the unit file might reside outside of the unit file search path.</entry>
1290 <entry morerows='1'>&gt; 0</entry>
1291 </row>
1292 <row>
1293 <entry><literal>linked-runtime</literal></entry>
1294 </row>
1295 <row>
1296 <entry><literal>masked</literal></entry>
1297 <entry morerows='1'>Completely disabled, so that any start operation on it fails (permanently in <filename>/etc/systemd/system/</filename> or transiently in <filename>/run/systemd/systemd/</filename>).</entry>
1298 <entry morerows='1'>&gt; 0</entry>
1299 </row>
1300 <row>
1301 <entry><literal>masked-runtime</literal></entry>
1302 </row>
1303 <row>
1304 <entry><literal>static</literal></entry>
1305 <entry>The unit file is not enabled, and has no provisions for enabling in the <literal>[Install]</literal> unit file section.</entry>
1306 <entry>0</entry>
1307 </row>
1308 <row>
1309 <entry><literal>indirect</literal></entry>
1310 <entry>The unit file itself is not enabled, but it has a non-empty <varname>Also=</varname> setting in the <literal>[Install]</literal> unit file section, listing other unit files that might be enabled, or it has an alias under a different name through a symlink that is not specified in Also=. For template unit file, an instance different than the one specified in <varname>DefaultInstance=</varname> is enabled.</entry>
1311 <entry>0</entry>
1312 </row>
1313 <row>
1314 <entry><literal>disabled</literal></entry>
1315 <entry>The unit file is not enabled, but contains an <literal>[Install]</literal> section with installation instructions.</entry>
1316 <entry>&gt; 0</entry>
1317 </row>
1318 <row>
1319 <entry><literal>generated</literal></entry>
1320 <entry>The unit file was generated dynamically via a generator tool. See <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>. Generated unit files may not be enabled, they are enabled implicitly by their generator.</entry>
1321 <entry>0</entry>
1322 </row>
1323 <row>
1324 <entry><literal>transient</literal></entry>
1325 <entry>The unit file has been created dynamically with the runtime API. Transient units may not be enabled.</entry>
1326 <entry>0</entry>
1327 </row>
1328 <row>
1329 <entry><literal>bad</literal></entry>
1330 <entry>The unit file is invalid or another error occurred. Note that <command>is-enabled</command> will not actually return this state, but print an error message instead. However the unit file listing printed by <command>list-unit-files</command> might show it.</entry>
1331 <entry>&gt; 0</entry>
1332 </row>
1333 </tbody>
1334 </tgroup>
1335 </table>
1336
1337 </listitem>
1338 </varlistentry>
1339
1340 <varlistentry>
1341 <term><command>mask <replaceable>UNIT</replaceable>…</command></term>
1342
1343 <listitem>
1344 <para>Mask one or more units, as specified on the command line. This will link these unit files to
1345 <filename>/dev/null</filename>, making it impossible to start them. This is a stronger version of
1346 <command>disable</command>, since it prohibits all kinds of activation of the unit, including enablement
1347 and manual activation. Use this option with care. This honors the <option>--runtime</option> option to only
1348 mask temporarily until the next reboot of the system. The <option>--now</option> option may be used to
1349 ensure that the units are also stopped. This command expects valid unit names only, it does not accept unit
1350 file paths.</para>
1351 </listitem>
1352 </varlistentry>
1353
1354 <varlistentry>
1355 <term><command>unmask <replaceable>UNIT</replaceable>…</command></term>
1356
1357 <listitem>
1358 <para>Unmask one or more unit files, as specified on the command line. This will undo the effect of
1359 <command>mask</command>. This command expects valid unit names only, it does not accept unit file
1360 paths.</para>
1361 </listitem>
1362 </varlistentry>
1363
1364 <varlistentry>
1365 <term><command>link <replaceable>PATH</replaceable>…</command></term>
1366
1367 <listitem>
1368 <para>Link a unit file that is not in the unit file search paths into the unit file search path. This
1369 command expects an absolute path to a unit file. The effect of this may be undone with
1370 <command>disable</command>. The effect of this command is that a unit file is made available for commands
1371 such as <command>start</command>, even though it is not installed directly in the unit search path. The
1372 file system where the linked unit files are located must be accessible when systemd is started
1373 (e.g. anything underneath <filename>/home</filename> or <filename>/var</filename> is not allowed, unless
1374 those directories are located on the root file system).</para>
1375 </listitem>
1376 </varlistentry>
1377
1378 <varlistentry>
1379 <term><command>revert <replaceable>UNIT</replaceable>…</command></term>
1380
1381 <listitem>
1382 <para>Revert one or more unit files to their vendor versions. This command removes drop-in configuration
1383 files that modify the specified units, as well as any user-configured unit file that overrides a matching
1384 vendor supplied unit file. Specifically, for a unit <literal>foo.service</literal> the matching directories
1385 <literal>foo.service.d/</literal> with all their contained files are removed, both below the persistent and
1386 runtime configuration directories (i.e. below <filename>/etc/systemd/system</filename> and
1387 <filename>/run/systemd/system</filename>); if the unit file has a vendor-supplied version (i.e. a unit file
1388 located below <filename>/usr</filename>) any matching persistent or runtime unit file that overrides it is
1389 removed, too. Note that if a unit file has no vendor-supplied version (i.e. is only defined below
1390 <filename>/etc/systemd/system</filename> or <filename>/run/systemd/system</filename>, but not in a unit
1391 file stored below <filename>/usr</filename>), then it is not removed. Also, if a unit is masked, it is
1392 unmasked.</para>
1393
1394 <para>Effectively, this command may be used to undo all changes made with <command>systemctl
1395 edit</command>, <command>systemctl set-property</command> and <command>systemctl mask</command> and puts
1396 the original unit file with its settings back in effect.</para>
1397 </listitem>
1398 </varlistentry>
1399
1400 <varlistentry>
1401 <term><command>add-wants <replaceable>TARGET</replaceable>
1402 <replaceable>UNIT</replaceable>…</command></term>
1403 <term><command>add-requires <replaceable>TARGET</replaceable>
1404 <replaceable>UNIT</replaceable>…</command></term>
1405
1406 <listitem>
1407 <para>Adds <literal>Wants=</literal> or <literal>Requires=</literal>
1408 dependencies, respectively, to the specified
1409 <replaceable>TARGET</replaceable> for one or more units. </para>
1410
1411 <para>This command honors <option>--system</option>,
1412 <option>--user</option>, <option>--runtime</option> and
1413 <option>--global</option> in a way similar to
1414 <command>enable</command>.</para>
1415
1416 </listitem>
1417 </varlistentry>
1418
1419 <varlistentry>
1420 <term><command>edit <replaceable>UNIT</replaceable>…</command></term>
1421
1422 <listitem>
1423 <para>Edit a drop-in snippet or a whole replacement file if
1424 <option>--full</option> is specified, to extend or override the
1425 specified unit.</para>
1426
1427 <para>Depending on whether <option>--system</option> (the default),
1428 <option>--user</option>, or <option>--global</option> is specified,
1429 this command creates a drop-in file for each unit either for the system,
1430 for the calling user, or for all futures logins of all users. Then,
1431 the editor (see the "Environment" section below) is invoked on
1432 temporary files which will be written to the real location if the
1433 editor exits successfully.</para>
1434
1435 <para>If <option>--full</option> is specified, this will copy the
1436 original units instead of creating drop-in files.</para>
1437
1438 <para>If <option>--force</option> is specified and any units do
1439 not already exist, new unit files will be opened for editing.</para>
1440
1441 <para>If <option>--runtime</option> is specified, the changes will
1442 be made temporarily in <filename>/run</filename> and they will be
1443 lost on the next reboot.</para>
1444
1445 <para>If the temporary file is empty upon exit, the modification of
1446 the related unit is canceled.</para>
1447
1448 <para>After the units have been edited, systemd configuration is
1449 reloaded (in a way that is equivalent to <command>daemon-reload</command>).
1450 </para>
1451
1452 <para>Note that this command cannot be used to remotely edit units
1453 and that you cannot temporarily edit units which are in
1454 <filename>/etc</filename>, since they take precedence over
1455 <filename>/run</filename>.</para>
1456 </listitem>
1457 </varlistentry>
1458
1459 <varlistentry>
1460 <term><command>get-default</command></term>
1461
1462 <listitem>
1463 <para>Return the default target to boot into. This returns
1464 the target unit name <filename>default.target</filename>
1465 is aliased (symlinked) to.</para>
1466 </listitem>
1467 </varlistentry>
1468
1469 <varlistentry>
1470 <term><command>set-default <replaceable>TARGET</replaceable></command></term>
1471
1472 <listitem>
1473 <para>Set the default target to boot into. This sets
1474 (symlinks) the <filename>default.target</filename> alias
1475 to the given target unit.</para>
1476 </listitem>
1477 </varlistentry>
1478
1479 </variablelist>
1480 </refsect2>
1481
1482 <refsect2>
1483 <title>Machine Commands</title>
1484
1485 <variablelist>
1486 <varlistentry>
1487 <term><command>list-machines</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
1488
1489 <listitem>
1490 <para>List the host and all running local containers with
1491 their state. If one or more
1492 <replaceable>PATTERN</replaceable>s are specified, only
1493 containers matching one of them are shown.
1494 </para>
1495 </listitem>
1496 </varlistentry>
1497 </variablelist>
1498 </refsect2>
1499
1500 <refsect2>
1501 <title>Job Commands</title>
1502
1503 <variablelist>
1504 <varlistentry>
1505 <term><command>list-jobs <optional><replaceable>PATTERN…</replaceable></optional></command></term>
1506
1507 <listitem>
1508 <para>List jobs that are in progress. If one or more
1509 <replaceable>PATTERN</replaceable>s are specified, only
1510 jobs for units matching one of them are shown.</para>
1511
1512 <para>When combined with <option>--after</option> or <option>--before</option> the list is augmented with
1513 information on which other job each job is waiting for, and which other jobs are waiting for it, see
1514 above.</para>
1515 </listitem>
1516 </varlistentry>
1517 <varlistentry>
1518 <term><command>cancel <replaceable>JOB</replaceable>…</command></term>
1519
1520 <listitem>
1521 <para>Cancel one or more jobs specified on the command line
1522 by their numeric job IDs. If no job ID is specified, cancel
1523 all pending jobs.</para>
1524 </listitem>
1525 </varlistentry>
1526 </variablelist>
1527 </refsect2>
1528
1529 <refsect2>
1530 <title>Environment Commands</title>
1531
1532 <variablelist>
1533 <varlistentry>
1534 <term><command>show-environment</command></term>
1535
1536 <listitem>
1537 <para>Dump the systemd manager environment block. This is the environment
1538 block that is passed to all processes the manager spawns. The environment
1539 block will be dumped in straight-forward form suitable for sourcing into
1540 most shells. If no special characters or whitespace is present in the variable
1541 values, no escaping is performed, and the assignments have the form
1542 <literal>VARIABLE=value</literal>. If whitespace or characters which have
1543 special meaning to the shell are present, dollar-single-quote escaping is
1544 used, and assignments have the form <literal>VARIABLE=$'value'</literal>.
1545 This syntax is known to be supported by
1546 <citerefentry project='die-net'><refentrytitle>bash</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1547 <citerefentry project='die-net'><refentrytitle>zsh</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1548 <citerefentry project='die-net'><refentrytitle>ksh</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1549 and
1550 <citerefentry project='die-net'><refentrytitle>busybox</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
1551 <citerefentry project='die-net'><refentrytitle>ash</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1552 but not
1553 <citerefentry project='die-net'><refentrytitle>dash</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1554 or
1555 <citerefentry project='die-net'><refentrytitle>fish</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
1556 </para>
1557 </listitem>
1558 </varlistentry>
1559 <varlistentry>
1560 <term><command>set-environment <replaceable>VARIABLE=VALUE</replaceable>…</command></term>
1561
1562 <listitem>
1563 <para>Set one or more systemd manager environment variables,
1564 as specified on the command line.</para>
1565 </listitem>
1566 </varlistentry>
1567 <varlistentry>
1568 <term><command>unset-environment <replaceable>VARIABLE</replaceable>…</command></term>
1569
1570 <listitem>
1571 <para>Unset one or more systemd manager environment
1572 variables. If only a variable name is specified, it will be
1573 removed regardless of its value. If a variable and a value
1574 are specified, the variable is only removed if it has the
1575 specified value.</para>
1576 </listitem>
1577 </varlistentry>
1578 <varlistentry>
1579 <term>
1580 <command>import-environment</command>
1581 <optional><replaceable>VARIABLE…</replaceable></optional>
1582 </term>
1583
1584 <listitem>
1585 <para>Import all, one or more environment variables set on
1586 the client into the systemd manager environment block. If
1587 no arguments are passed, the entire environment block is
1588 imported. Otherwise, a list of one or more environment
1589 variable names should be passed, whose client-side values
1590 are then imported into the manager's environment
1591 block.</para>
1592 </listitem>
1593 </varlistentry>
1594 </variablelist>
1595 </refsect2>
1596
1597 <refsect2>
1598 <title>Manager Lifecycle Commands</title>
1599
1600 <variablelist>
1601 <varlistentry>
1602 <term><command>daemon-reload</command></term>
1603
1604 <listitem>
1605 <para>Reload the systemd manager configuration. This will
1606 rerun all generators (see
1607 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>),
1608 reload all unit files, and recreate the entire dependency
1609 tree. While the daemon is being reloaded, all sockets
1610 systemd listens on behalf of user configuration will stay
1611 accessible.</para>
1612
1613 <para>This command should not be confused with the
1614 <command>reload</command> command.</para>
1615 </listitem>
1616 </varlistentry>
1617 <varlistentry>
1618 <term><command>daemon-reexec</command></term>
1619
1620 <listitem>
1621 <para>Reexecute the systemd manager. This will serialize the
1622 manager state, reexecute the process and deserialize the
1623 state again. This command is of little use except for
1624 debugging and package upgrades. Sometimes, it might be
1625 helpful as a heavy-weight <command>daemon-reload</command>.
1626 While the daemon is being reexecuted, all sockets systemd listening
1627 on behalf of user configuration will stay accessible.
1628 </para>
1629 </listitem>
1630 </varlistentry>
1631 </variablelist>
1632 </refsect2>
1633
1634 <refsect2>
1635 <title>System Commands</title>
1636
1637 <variablelist>
1638 <varlistentry>
1639 <term><command>is-system-running</command></term>
1640
1641 <listitem>
1642 <para>Checks whether the system is operational. This
1643 returns success (exit code 0) when the system is fully up
1644 and running, specifically not in startup, shutdown or
1645 maintenance mode, and with no failed services. Failure is
1646 returned otherwise (exit code non-zero). In addition, the
1647 current state is printed in a short string to standard
1648 output, see the table below. Use <option>--quiet</option> to
1649 suppress this output.</para>
1650
1651 <para>Use <option>--wait</option> to wait until the boot
1652 process is completed before printing the current state and
1653 returning the appropriate error status. If <option>--wait</option>
1654 is in use, states <varname>initializing</varname> or
1655 <varname>starting</varname> will not be reported, instead
1656 the command will block until a later state (such as
1657 <varname>running</varname> or <varname>degraded</varname>)
1658 is reached.</para>
1659
1660 <table>
1661 <title><command>is-system-running</command> output</title>
1662 <tgroup cols='3'>
1663 <colspec colname='name'/>
1664 <colspec colname='description'/>
1665 <colspec colname='exit-code'/>
1666 <thead>
1667 <row>
1668 <entry>Name</entry>
1669 <entry>Description</entry>
1670 <entry>Exit Code</entry>
1671 </row>
1672 </thead>
1673 <tbody>
1674 <row>
1675 <entry><varname>initializing</varname></entry>
1676 <entry><para>Early bootup, before
1677 <filename>basic.target</filename> is reached
1678 or the <varname>maintenance</varname> state entered.
1679 </para></entry>
1680 <entry>&gt; 0</entry>
1681 </row>
1682 <row>
1683 <entry><varname>starting</varname></entry>
1684 <entry><para>Late bootup, before the job queue
1685 becomes idle for the first time, or one of the
1686 rescue targets are reached.</para></entry>
1687 <entry>&gt; 0</entry>
1688 </row>
1689 <row>
1690 <entry><varname>running</varname></entry>
1691 <entry><para>The system is fully
1692 operational.</para></entry>
1693 <entry>0</entry>
1694 </row>
1695 <row>
1696 <entry><varname>degraded</varname></entry>
1697 <entry><para>The system is operational but one or more
1698 units failed.</para></entry>
1699 <entry>&gt; 0</entry>
1700 </row>
1701 <row>
1702 <entry><varname>maintenance</varname></entry>
1703 <entry><para>The rescue or emergency target is
1704 active.</para></entry>
1705 <entry>&gt; 0</entry>
1706 </row>
1707 <row>
1708 <entry><varname>stopping</varname></entry>
1709 <entry><para>The manager is shutting
1710 down.</para></entry>
1711 <entry>&gt; 0</entry>
1712 </row>
1713 <row>
1714 <entry><varname>offline</varname></entry>
1715 <entry><para>The manager is not
1716 running. Specifically, this is the operational
1717 state if an incompatible program is running as
1718 system manager (PID 1).</para></entry>
1719 <entry>&gt; 0</entry>
1720 </row>
1721 <row>
1722 <entry><varname>unknown</varname></entry>
1723 <entry><para>The operational state could not be
1724 determined, due to lack of resources or another
1725 error cause.</para></entry>
1726 <entry>&gt; 0</entry>
1727 </row>
1728 </tbody>
1729 </tgroup>
1730 </table>
1731 </listitem>
1732 </varlistentry>
1733
1734 <varlistentry>
1735 <term><command>default</command></term>
1736
1737 <listitem>
1738 <para>Enter default mode. This is equivalent to <command>systemctl isolate default.target</command>. This
1739 operation is blocking by default, use <option>--no-block</option> to request asynchronous behavior.</para>
1740 </listitem>
1741 </varlistentry>
1742
1743 <varlistentry>
1744 <term><command>rescue</command></term>
1745
1746 <listitem>
1747 <para>Enter rescue mode. This is equivalent to <command>systemctl isolate rescue.target</command>. This
1748 operation is blocking by default, use <option>--no-block</option> to request asynchronous behavior.</para>
1749 </listitem>
1750 </varlistentry>
1751 <varlistentry>
1752 <term><command>emergency</command></term>
1753
1754 <listitem>
1755 <para>Enter emergency mode. This is equivalent to <command>systemctl isolate
1756 emergency.target</command>. This operation is blocking by default, use <option>--no-block</option> to
1757 request asynchronous behavior.</para>
1758 </listitem>
1759 </varlistentry>
1760 <varlistentry>
1761 <term><command>halt</command></term>
1762
1763 <listitem>
1764 <para>Shut down and halt the system. This is mostly equivalent to <command>systemctl start halt.target
1765 --job-mode=replace-irreversibly --no-block</command>, but also prints a wall message to all users. This command is
1766 asynchronous; it will return after the halt operation is enqueued, without waiting for it to complete. Note
1767 that this operation will simply halt the OS kernel after shutting down, leaving the hardware powered
1768 on. Use <command>systemctl poweroff</command> for powering off the system (see below).</para>
1769
1770 <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all
1771 processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the
1772 system halt. If <option>--force</option> is specified twice, the operation is immediately executed without
1773 terminating any processes or unmounting any file systems. This may result in data loss. Note that when
1774 <option>--force</option> is specified twice the halt operation is executed by <command>systemctl</command>
1775 itself, and the system manager is not contacted. This means the command should succeed even when the system
1776 manager has crashed.</para>
1777 </listitem>
1778 </varlistentry>
1779 <varlistentry>
1780 <term><command>poweroff</command></term>
1781
1782 <listitem>
1783 <para>Shut down and power-off the system. This is mostly equivalent to <command>systemctl start
1784 poweroff.target --job-mode=replace-irreversibly --no-block</command>, but also prints a wall message to all
1785 users. This command is asynchronous; it will return after the power-off operation is enqueued, without
1786 waiting for it to complete.</para>
1787
1788 <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all
1789 processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the
1790 powering off. If <option>--force</option> is specified twice, the operation is immediately executed without
1791 terminating any processes or unmounting any file systems. This may result in data loss. Note that when
1792 <option>--force</option> is specified twice the power-off operation is executed by
1793 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
1794 succeed even when the system manager has crashed.</para>
1795 </listitem>
1796 </varlistentry>
1797 <varlistentry>
1798 <term><command>reboot</command> <optional><replaceable>arg</replaceable></optional></term>
1799
1800 <listitem>
1801 <para>Shut down and reboot the system. This is mostly equivalent to <command>systemctl start reboot.target
1802 --job-mode=replace-irreversibly --no-block</command>, but also prints a wall message to all users. This
1803 command is asynchronous; it will return after the reboot operation is enqueued, without waiting for it to
1804 complete.</para>
1805
1806 <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all
1807 processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the
1808 reboot. If <option>--force</option> is specified twice, the operation is immediately executed without
1809 terminating any processes or unmounting any file systems. This may result in data loss. Note that when
1810 <option>--force</option> is specified twice the reboot operation is executed by
1811 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
1812 succeed even when the system manager has crashed.</para>
1813
1814 <para>If the optional argument <replaceable>arg</replaceable> is given, it will be passed as the optional
1815 argument to the <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1816 system call. The value is architecture and firmware specific. As an example, <literal>recovery</literal>
1817 might be used to trigger system recovery, and <literal>fota</literal> might be used to trigger a
1818 <quote>firmware over the air</quote> update.</para>
1819 </listitem>
1820 </varlistentry>
1821
1822 <varlistentry>
1823 <term><command>kexec</command></term>
1824
1825 <listitem>
1826 <para>Shut down and reboot the system via <command>kexec</command>. This is equivalent to
1827 <command>systemctl start kexec.target --job-mode=replace-irreversibly --no-block</command>. This command is
1828 asynchronous; it will return after the reboot operation is enqueued, without waiting for it to
1829 complete.</para>
1830
1831 <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all
1832 processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the
1833 reboot.</para>
1834 </listitem>
1835 </varlistentry>
1836
1837 <varlistentry>
1838 <term><command>exit</command> <optional><replaceable>EXIT_CODE</replaceable></optional></term>
1839
1840 <listitem>
1841 <para>Ask the service manager to quit. This is only supported for user service managers (i.e. in
1842 conjunction with the <option>--user</option> option) or in containers and is equivalent to
1843 <command>poweroff</command> otherwise. This command is asynchronous; it will return after the exit
1844 operation is enqueued, without waiting for it to complete.</para>
1845
1846 <para>The service manager will exit with the specified exit code, if
1847 <replaceable>EXIT_CODE</replaceable> is passed.</para>
1848 </listitem>
1849 </varlistentry>
1850
1851 <varlistentry>
1852 <term><command>switch-root</command> <replaceable>ROOT</replaceable> <optional><replaceable>INIT</replaceable></optional></term>
1853
1854 <listitem>
1855 <para>Switches to a different root directory and executes a new system manager process below it. This is
1856 intended for usage in initial RAM disks ("initrd"), and will transition from the initrd's system manager
1857 process (a.k.a. "init" process) to the main system manager process which is loaded from the actual host
1858 volume. This call takes two arguments: the directory that is to become the new root directory, and the path
1859 to the new system manager binary below it to execute as PID 1. If the latter is omitted or the empty
1860 string, a systemd binary will automatically be searched for and used as init. If the system manager path is
1861 omitted, equal to the empty string or identical to the path to the systemd binary, the state of the
1862 initrd's system manager process is passed to the main system manager, which allows later introspection of
1863 the state of the services involved in the initrd boot phase.</para>
1864 </listitem>
1865 </varlistentry>
1866
1867 <varlistentry>
1868 <term><command>suspend</command></term>
1869
1870 <listitem>
1871 <para>Suspend the system. This will trigger activation of the special target unit
1872 <filename>suspend.target</filename>. This command is asynchronous, and will return after the suspend
1873 operation is successfully enqueued. It will not wait for the suspend/resume cycle to complete.</para>
1874 </listitem>
1875 </varlistentry>
1876
1877 <varlistentry>
1878 <term><command>hibernate</command></term>
1879
1880 <listitem>
1881 <para>Hibernate the system. This will trigger activation of the special target unit
1882 <filename>hibernate.target</filename>. This command is asynchronous, and will return after the hibernation
1883 operation is successfully enqueued. It will not wait for the hibernate/thaw cycle to complete.</para>
1884 </listitem>
1885 </varlistentry>
1886
1887 <varlistentry>
1888 <term><command>hybrid-sleep</command></term>
1889
1890 <listitem>
1891 <para>Hibernate and suspend the system. This will trigger activation of the special target unit
1892 <filename>hybrid-sleep.target</filename>. This command is asynchronous, and will return after the hybrid
1893 sleep operation is successfully enqueued. It will not wait for the sleep/wake-up cycle to complete.</para>
1894 </listitem>
1895 </varlistentry>
1896
1897 <varlistentry>
1898 <term><command>suspend-then-hibernate</command></term>
1899
1900 <listitem>
1901 <para>Suspend the system and hibernate it after the delay specified in <filename>systemd-sleep.conf</filename>.
1902 This will trigger activation of the special target unit <filename>suspend-then-hibernate.target</filename>.
1903 This command is asynchronous, and will return after the hybrid sleep operation is successfully enqueued.
1904 It will not wait for the sleep/wake-up or hibernate/thaw cycle to complete.</para>
1905 </listitem>
1906 </varlistentry>
1907 </variablelist>
1908 </refsect2>
1909
1910 <refsect2>
1911 <title>Parameter Syntax</title>
1912
1913 <para>Unit commands listed above take either a single unit name (designated as <replaceable>UNIT</replaceable>),
1914 or multiple unit specifications (designated as <replaceable>PATTERN</replaceable>…). In the first case, the
1915 unit name with or without a suffix must be given. If the suffix is not specified (unit name is "abbreviated"),
1916 systemctl will append a suitable suffix, <literal>.service</literal> by default, and a type-specific suffix in
1917 case of commands which operate only on specific unit types. For example,
1918 <programlisting># systemctl start sshd</programlisting> and
1919 <programlisting># systemctl start sshd.service</programlisting>
1920 are equivalent, as are
1921 <programlisting># systemctl isolate default</programlisting>
1922 and
1923 <programlisting># systemctl isolate default.target</programlisting>
1924 Note that (absolute) paths to device nodes are automatically converted to device unit names, and other (absolute)
1925 paths to mount unit names.
1926 <programlisting># systemctl status /dev/sda
1927 # systemctl status /home</programlisting>
1928 are equivalent to:
1929 <programlisting># systemctl status dev-sda.device
1930 # systemctl status home.mount</programlisting>
1931 In the second case, shell-style globs will be matched against the primary names of all units currently in memory;
1932 literal unit names, with or without a suffix, will be treated as in the first case. This means that literal unit
1933 names always refer to exactly one unit, but globs may match zero units and this is not considered an
1934 error.</para>
1935
1936 <para>Glob patterns use
1937 <citerefentry project='man-pages'><refentrytitle>fnmatch</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
1938 so normal shell-style globbing rules are used, and
1939 <literal>*</literal>, <literal>?</literal>,
1940 <literal>[]</literal> may be used. See
1941 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
1942 for more details. The patterns are matched against the primary names of
1943 units currently in memory, and patterns which do not match anything
1944 are silently skipped. For example:
1945 <programlisting># systemctl stop sshd@*.service</programlisting>
1946 will stop all <filename>sshd@.service</filename> instances. Note that alias names of units, and units that aren't
1947 in memory are not considered for glob expansion.
1948 </para>
1949
1950 <para>For unit file commands, the specified <replaceable>UNIT</replaceable> should be the name of the unit file
1951 (possibly abbreviated, see above), or the absolute path to the unit file:
1952 <programlisting># systemctl enable foo.service</programlisting>
1953 or
1954 <programlisting># systemctl link /path/to/foo.service</programlisting>
1955 </para>
1956 </refsect2>
1957
1958 </refsect1>
1959
1960 <refsect1>
1961 <title>Exit status</title>
1962
1963 <para>On success, 0 is returned, a non-zero failure code otherwise.</para>
1964
1965 <para><command>systemctl</command> uses the return codes defined by LSB, as defined in
1966 <ulink url="http://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/iniscrptact.html">LSB 3.0.0</ulink>.
1967 </para>
1968
1969 <table>
1970 <title>LSB return codes</title>
1971
1972 <tgroup cols='3'>
1973 <thead>
1974 <row>
1975 <entry>Value</entry>
1976 <entry>Description in LSB</entry>
1977 <entry>Use in systemd</entry>
1978 </row>
1979 </thead>
1980 <tbody>
1981 <row>
1982 <entry><constant>0</constant></entry>
1983 <entry>"program is running or service is OK"</entry>
1984 <entry>unit is active</entry>
1985 </row>
1986 <row>
1987 <entry><constant>1</constant></entry>
1988 <entry>"program is dead and <filename>/var/run</filename> pid file exists"</entry>
1989 <entry>unit <emphasis>not</emphasis> failed (used by <command>is-failed</command>)</entry>
1990 </row>
1991 <row>
1992 <entry><constant>2</constant></entry>
1993 <entry>"program is dead and <filename>/var/lock</filename> lock file exists"</entry>
1994 <entry>unused</entry>
1995 </row>
1996 <row>
1997 <entry><constant>3</constant></entry>
1998 <entry>"program is not running"</entry>
1999 <entry>unit is not active</entry>
2000 </row>
2001 <row>
2002 <entry><constant>4</constant></entry>
2003 <entry>"program or service status is unknown"</entry>
2004 <entry>no such unit</entry>
2005 </row>
2006 </tbody>
2007 </tgroup>
2008 </table>
2009
2010 <para>The mapping of LSB service states to systemd unit states is imperfect, so it is better to
2011 not rely on those return values but to look for specific unit states and substates instead.
2012 </para>
2013 </refsect1>
2014
2015 <refsect1>
2016 <title>Environment</title>
2017
2018 <variablelist class='environment-variables'>
2019 <varlistentry>
2020 <term><varname>$SYSTEMD_EDITOR</varname></term>
2021
2022 <listitem><para>Editor to use when editing units; overrides
2023 <varname>$EDITOR</varname> and <varname>$VISUAL</varname>. If neither
2024 <varname>$SYSTEMD_EDITOR</varname> nor <varname>$EDITOR</varname> nor
2025 <varname>$VISUAL</varname> are present or if it is set to an empty
2026 string or if their execution failed, systemctl will try to execute well
2027 known editors in this order:
2028 <citerefentry project='die-net'><refentrytitle>editor</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2029 <citerefentry project='die-net'><refentrytitle>nano</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2030 <citerefentry project='die-net'><refentrytitle>vim</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2031 <citerefentry project='die-net'><refentrytitle>vi</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
2032 </para></listitem>
2033 </varlistentry>
2034 </variablelist>
2035 <xi:include href="less-variables.xml" xpointer="pager"/>
2036 <xi:include href="less-variables.xml" xpointer="less"/>
2037 <xi:include href="less-variables.xml" xpointer="lesscharset"/>
2038 </refsect1>
2039
2040 <refsect1>
2041 <title>See Also</title>
2042 <para>
2043 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2044 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2045 <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2046 <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2047 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
2048 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
2049 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
2050 <citerefentry project='man-pages'><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2051 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
2052 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
2053 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
2054 </para>
2055 </refsect1>
2056
2057 </refentry>