1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2010 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="systemd">
27 <title>systemd</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
41 <refentrytitle>systemd</refentrytitle>
42 <manvolnum>1</manvolnum>
46 <refname>systemd</refname>
47 <refname>init</refname>
48 <refpurpose>systemd System and Session Manager</refpurpose>
53 <command>systemd <arg choice="opt" rep="repeat">OPTIONS</arg></command>
56 <command>init <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="req">COMMAND</arg></command>
61 <title>Description</title>
63 <para>systemd is a system and session manager for
64 Linux operating systems. When run as first process on
65 boot (as PID 1), it acts as init system that brings
66 up and maintains userspace services.</para>
68 <para>For compatibility with SysV, if systemd is called
69 as <command>init</command> and a PID that is not
70 1, it will execute <command>telinit</command> and pass
71 all command line arguments unmodified. That means
72 <command>init</command> and <command>telinit</command>
73 are mostly equivalent when invoked from normal login sessions. See
74 <citerefentry><refentrytitle>telinit</refentrytitle><manvolnum>8</manvolnum></citerefentry>
75 for more information.</para>
79 <title>Options</title>
81 <para>The following options are understood:</para>
85 <term><option>-h</option></term>
86 <term><option>--help</option></term>
88 <listitem><para>Prints a short help
89 text and exits.</para></listitem>
92 <term><option>--unit=</option></term>
94 <listitem><para>Set default unit to
95 activate on startup. If not specified
97 <filename>default.target</filename>.</para></listitem>
100 <term><option>--running-as=</option></term>
102 <listitem><para>Tell systemd to run in
103 a particular mode. Argument is one of
104 <option>system</option>,
105 <option>session</option>. Normally it
106 should not be necessary to pass this
107 option, as systemd automatically
108 detects the mode it is started
109 in. This call is hence of little use
111 debugging.</para></listitem>
114 <term><option>--test</option></term>
116 <listitem><para>Determine startup
117 sequence, dump it and exit. This is an
118 option useful for debugging
119 only.</para></listitem>
122 <term><option>--dump-configuration-items</option></term>
124 <listitem><para>Dump understood unit
125 configuration items. This outputs a
126 terse but complete list of
127 configuration items understood in unit
128 definition files.</para></listitem>
131 <term><option>--confirm-spawn</option></term>
133 <listitem><para>Ask for confirmation when spawning processes.</para></listitem>
136 <term><option>--introspect=</option></term>
138 <listitem><para>Extract D-Bus
139 interface introspection data. This is
140 mostly useful at build at install time
141 to generate data suitable for the
143 repository. Optionally the interface
144 name for the introspection data may be
145 specified. If omitted, the
146 introspection data for all interfaces
147 is dumped.</para></listitem>
150 <term><option>--log-level=</option></term>
152 <listitem><para>Set log level. As
153 argument this accepts a numerical log
154 level or the well-known <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
155 symbolic names (lowercase):
156 <option>emerg</option>,
157 <option>alert</option>,
158 <option>crit</option>,
159 <option>err</option>,
160 <option>warning</option>,
161 <option>notice</option>,
162 <option>info</option>,
163 <option>debug</option>.</para></listitem>
166 <term><option>--log-target=</option></term>
168 <listitem><para>Set log
169 target. Argument must be one of
170 <option>console</option>,
171 <option>syslog</option>,
172 <option>kmsg</option>,
173 <option>syslog-or-kmsg</option>,
174 <option>null</option>.</para></listitem>
177 <term><option>--log-color=</option></term>
179 <listitem><para>Highlight important
180 log messages. Argument is a boolean
181 value. If the argument is omitted it
183 <option>true</option>.</para></listitem>
186 <term><option>--log-location=</option></term>
188 <listitem><para>Include code location
189 in log messages. This is mostly
190 relevant for debugging
191 purposes. Argument is a boolean
192 value. If the argument is omitted
194 <option>true</option>.</para></listitem>
200 <title>Concepts</title>
202 <para>systemd provides a dependency system between
203 various entities called "units". Units encapsulate
204 various objects that are relevant for system boot-up
205 and maintainance. The majority of units are configured
206 in unit configuration files, whose syntax and basic
207 set of options is described in
208 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
209 however some are created automatically from other
210 configuration or dynamically from system state. Units
211 may be active (meaning started, bound, plugged in, ...
212 depending on the unit type), or inactive (meaning
213 stopped, unbound, unplugged, ...), as well is in the
214 process of being activated or deactivated,
215 i.e. between the two states. The following unit types
216 are available:</para>
219 <listitem><para>Service units, which control
220 daemons and the processes they consist of. For
222 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
224 <listitem><para>Socket units, which
225 encapsulate local IPC or network sockets in
226 the system, useful for socket-based
227 activation. For details about socket units see
228 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
229 for details on socket-based activation and
230 other forms of activation, see
231 <citerefentry><refentrytitle>daemon</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para></listitem>
233 <listitem><para>Target units are useful to
234 group units, or provide well-known
235 synchronization points during boot-up, see
236 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
238 <listitem><para>Device units expose kernel
239 devices in systemd and may be used to
240 implement device-based activation. For details
242 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
244 <listitem><para>Mount units control mount
245 points in the file system, for details see
246 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
248 <listitem><para>Automount units provide
249 automount capabilities, for on-demand mounting
250 of file systems as well as parallelized
252 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
254 <listitem><para>Snapshot units can be used to
255 temporarily save the state of the set of
256 systemd units, which later may be restored by
257 activating the saved snapshot unit. For more
259 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
261 <listitem><para>Timer units are useful for
262 triggering activation of other units based on
263 timers. You may find details in
264 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
266 <listitem><para>Swap units are very similar to
267 mount units and encapsulated memory swap
268 partitions or files of the operating
269 systemd. They are described in <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
271 <listitem><para>Path units may be used
272 activate other services when file system
273 objects change or are modified. See
274 <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
278 <para>Units are named as their configuration
279 files. Some units have special semantics. A detailed
281 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
283 <para>On boot systemd activates the target unit
284 <filename>default.target</filename> whose job it is to
285 activate on-boot services and other on-boot units by
286 pulling them in via dependencies. Usually the unit
287 name is just an alias (symlink) for either
288 <filename>graphical.target</filename> (for
289 fully-featured boots into the UI) or
290 <filename>multi-user.target</filename> (for limited
291 console-only boots for use in embedded or server
292 environments, or similar; a subset of
293 graphical.target). However it is at the discretion of
294 the administrator to configure it as an alias to any
295 other target unit. See
296 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>
297 for details about these target units.</para>
299 <para>For more information about the concepts and
300 ideas behind systemd please refer to the <ulink
301 url="http://0pointer.de/blog/projects/systemd.html">Original
302 Announcement Document</ulink>.</para>
306 <title>Directories</title>
310 <term>System unit directories</term>
312 <listitem><para>The systemd system
313 manager reads unit configuration from
314 various directories. Packages that
315 want to install unit files shall place
316 them in the directory returned by
317 <command>pkg-config systemd
318 --variable=systemdsystemunitdir</command>. Other
319 directories checked are
320 <filename>/usr/local/share/systemd/system</filename>
322 <filename>/usr/share/systemd/system</filename>. User
323 configuration always takes
324 precedence. <command>pkg-config
326 --variable=systemdsystemconfdir</command>
327 returns the path of the system
328 configuration directory. Packages
329 should alter the content of these directories
331 <citerefentry><refentrytitle>systemd-install</refentrytitle><manvolnum>1</manvolnum></citerefentry>
332 tool.</para></listitem>
338 <term>Session unit directories</term>
340 <listitem><para>Similar rules apply
342 directories. However, here the <ulink
343 url="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG
344 Base Directory specification</ulink>
346 units. Applications should place their
347 unit files in the directory returned
348 by <command>pkg-config systemd
349 --variable=systemdsessionunitdir</command>. Global
350 configuration is done in the
351 directory reported by
352 <command>pkg-config systemd
353 --variable=systemdsessionconfdir</command>. The
354 <citerefentry><refentrytitle>systemd-install</refentrytitle><manvolnum>1</manvolnum></citerefentry>
355 tool can handle both global (i.e. for
356 all users) and private (for one user)
357 enabling/disabling of
358 units.</para></listitem>
364 <term>SysV init scripts directory</term>
366 <listitem><para>The location of the
367 SysV init script directory varies
368 between distributions. If systemd
369 cannot find a native unit file for a
370 requested service, it will look for a
371 SysV init script of the same name
373 <filename>.service</filename> suffix
374 removed).</para></listitem>
380 <term>SysV runlevel link farm directory</term>
382 <listitem><para>The location of the
383 SysV runlevel link farm directory
384 varies between distributions. systemd
385 will take the link farm into account
386 when figuring out whether a service
387 shall be enabled. Note that a service
388 unit with a native unit configuration
389 file can be started by activating it
390 in the SysV runlevel link
391 farm.</para></listitem>
397 <title>Signals</title>
403 <listitem><para>Upon receiving this
404 signal the systemd system manager
405 serializes its state, reexecutes
406 itself and deserializes the saved
407 state again. This is mostly equivalent
408 to <command>systemctl
409 daemon-reexec</command>.</para>
411 <para>systemd session managers will
413 <filename>exit.target</filename> unit
414 when this signal is received. This is
416 <command>systemctl --session start
417 exit.target</command>.</para></listitem>
423 <listitem><para>Upon receiving this
424 signal the systemd system manager will
426 <filename>ctrl-alt-del.target</filename> unit. This
427 is mostly equivalent to
428 <command>systemctl start
429 ctl-alt-del.target</command>.</para>
431 <para>systemd session managers
432 treat this signal the same way as
433 SIGTERM.</para></listitem>
437 <term>SIGWINCH</term>
439 <listitem><para>When this signal is
440 received the systemd system manager
442 <filename>kbrequest.target</filename>
443 unit. This is mostly equivalent to
444 <command>systemctl start
445 kbrequest.target</command>.</para>
447 <para>This signal is ignored by
449 managers.</para></listitem>
455 <listitem><para>When this signal is
456 received the systemd manager
458 <filename>sigpwr.target</filename>
459 unit. This is mostly equivalent to
460 <command>systemctl start
461 sigpwr.target</command>.</para></listitem>
467 <listitem><para>When this signal is
468 received the systemd manager will try
469 to reconnect to the D-Bus
470 bus.</para></listitem>
476 <listitem><para>When this signal is
477 received the systemd manager will log
478 its complete state in human readable
479 form. The data logged is the same as
480 printed by <command>systemctl
481 dump</command>.</para></listitem>
487 <listitem><para>Reloads the complete
488 daemon configuration. This is mostly
489 equivalent to <command>systemctl
490 daemon-reload</command>.</para></listitem>
494 <term>SIGRTMIN+0</term>
496 <listitem><para>Enters default mode, starts the
497 <filename>default.target</filename>
498 unit. This is mostly equivalent to
499 <command>systemctl start
500 default.target</command>.</para></listitem>
504 <term>SIGRTMIN+1</term>
506 <listitem><para>Enters rescue mode,
508 <filename>rescue.target</filename>
509 unit. This is mostly equivalent to
510 <command>systemctl isolate
511 rescue.target</command>.</para></listitem>
515 <term>SIGRTMIN+2</term>
517 <listitem><para>Enters emergency mode,
519 <filename>emergency.service</filename>
520 unit. This is mostly equivalent to
521 <command>systemctl isolate
522 emergency.service</command>.</para></listitem>
526 <term>SIGRTMIN+3</term>
528 <listitem><para>Halts the machine,
530 <filename>halt.target</filename>
531 unit. This is mostly equivalent to
532 <command>systemctl start
533 halt.target</command>.</para></listitem>
537 <term>SIGRTMIN+4</term>
539 <listitem><para>Powers off the machine,
541 <filename>poweroff.target</filename>
542 unit. This is mostly equivalent to
543 <command>systemctl start
544 poweroff.target</command>.</para></listitem>
548 <term>SIGRTMIN+5</term>
550 <listitem><para>Reboots the machine,
552 <filename>reboot.target</filename>
553 unit. This is mostly equivalent to
554 <command>systemctl start
555 reboot.target</command>.</para></listitem>
561 <title>Environment</title>
565 <term><varname>$SYSTEMD_LOG_LEVEL</varname></term>
566 <listitem><para>systemd reads the
567 log level from this environment
568 variable. This can be overridden with
569 <option>--log-level=</option>.</para></listitem>
573 <term><varname>$SYSTEMD_LOG_TARGET</varname></term>
574 <listitem><para>systemd reads the
575 log target from this environment
576 variable. This can be overridden with
577 <option>--log-target=</option>.</para></listitem>
581 <term><varname>$SYSTEMD_LOG_COLOR</varname></term>
582 <listitem><para>Controls whether
583 systemd highlights important log
584 messages. This can be overridden with
585 <option>--log-color=</option>.</para></listitem>
589 <term><varname>$SYSTEMD_LOG_LOCATION</varname></term>
590 <listitem><para>Controls whether
591 systemd prints the code location along
592 with log messages. This can be
594 <option>--log-location=</option>.</para></listitem>
598 <term><varname>$XDG_CONFIG_HOME</varname></term>
599 <term><varname>$XDG_CONFIG_DIRS</varname></term>
600 <term><varname>$XDG_DATA_HOME</varname></term>
601 <term><varname>$XDG_DATA_DIRS</varname></term>
603 <listitem><para>The systemd session
604 manager uses these variables in
605 accordance to the <ulink
606 url="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG
607 Base Directory specification</ulink>
608 to find its configuration.</para></listitem>
612 <term><varname>$SYSTEMD_UNIT_PATH</varname></term>
614 <listitem><para>Controls where systemd
616 files.</para></listitem>
620 <term><varname>$SYSTEMD_SYSVINIT_PATH</varname></term>
622 <listitem><para>Controls where systemd
623 looks for SysV init scripts.</para></listitem>
627 <term><varname>$SYSTEMD_SYSVRCND_PATH</varname></term>
629 <listitem><para>Controls where systemd
630 looks for SysV init script runlevel link
631 farms.</para></listitem>
635 <term><varname>$LISTEN_PID</varname></term>
636 <term><varname>$LISTEN_FDS</varname></term>
638 <listitem><para>Set by systemd for
639 supervised processes during
640 socket-based activation. See
641 <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>
642 for more information.
647 <term><varname>$NOTIFY_SOCKET</varname></term>
649 <listitem><para>Set by systemd for
650 supervised processes for status and
651 start-up completion notification. See
652 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>
653 for more information.
660 <title>Sockets and FIFOs</title>
664 <term><filename>@/org/freedesktop/systemd1/notify</filename></term>
666 <listitem><para>Daemon status
667 notification socket. This is an AF_UNIX
668 datagram socket in the Linux abstract
669 namespace, and is used to implement
670 the daemon notification logic as
672 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem>
677 <term><filename>@/org/freedesktop/systemd1/logger</filename></term>
679 <listitem><para>Used internally by the
680 <filename>systemd-logger.service</filename>
681 unit to connect STDOUT and/or STDERR
682 of spawned processes to
683 <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
684 or the kernel log buffer. This is an
685 AF_UNIX stream socket in the Linux
686 abstract namespace.</para></listitem>
690 <term><filename>@/org/freedesktop/systemd1/private</filename></term>
692 <listitem><para>Used internally as
693 communication channel between
694 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
695 and the systemd process. This is an
696 AF_UNIX stream socket in the Linux
697 abstract namespace. This interface is
698 private to systemd and should not be
700 projects.</para></listitem>
704 <term><filename>/dev/initctl</filename></term>
706 <listitem><para>Limited compatibility
707 support for the SysV client interface,
708 as implemented by the
709 <filename>systemd-initctl.service</filename>
710 unit. This is a named pipe in the file
711 system. This interface is obsolete and
712 should not be used in new
713 applications.</para></listitem>
719 <title>See Also</title>
721 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
722 <citerefentry><refentrytitle>systemadm</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
723 <citerefentry><refentrytitle>systemd-install</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
724 <citerefentry><refentrytitle>systemd-notify</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
725 <citerefentry><refentrytitle>daemon</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
726 <citerefentry><refentrytitle>sd-daemon</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
727 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
728 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
729 <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>