]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.device.xml
Merge pull request #74 from systemd-mailing-devs/1432753344-31461-1-git-send-email...
[thirdparty/systemd.git] / man / systemd.device.xml
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" [
4 <!ENTITY % entities SYSTEM "custom-entities.ent" >
5 %entities;
6 ]>
7
8 <!--
9 This file is part of systemd.
10
11 Copyright 2010 Lennart Poettering
12
13 systemd is free software; you can redistribute it and/or modify it
14 under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation; either version 2.1 of the License, or
16 (at your option) any later version.
17
18 systemd is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public License
24 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 -->
26
27 <refentry id="systemd.device">
28 <refentryinfo>
29 <title>systemd.device</title>
30 <productname>systemd</productname>
31
32 <authorgroup>
33 <author>
34 <contrib>Developer</contrib>
35 <firstname>Lennart</firstname>
36 <surname>Poettering</surname>
37 <email>lennart@poettering.net</email>
38 </author>
39 </authorgroup>
40 </refentryinfo>
41
42 <refmeta>
43 <refentrytitle>systemd.device</refentrytitle>
44 <manvolnum>5</manvolnum>
45 </refmeta>
46
47 <refnamediv>
48 <refname>systemd.device</refname>
49 <refpurpose>Device unit configuration</refpurpose>
50 </refnamediv>
51
52 <refsynopsisdiv>
53 <para><filename><replaceable>device</replaceable>.device</filename></para>
54 </refsynopsisdiv>
55
56 <refsect1>
57 <title>Description</title>
58
59 <para>A unit configuration file whose name ends in
60 <literal>.device</literal> encodes information about a device unit
61 as exposed in the
62 sysfs/<citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
63 device tree.</para>
64
65 <para>This unit type has no specific options. See
66 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
67 for the common options of all unit configuration files. The common
68 configuration items are configured in the generic
69 <literal>[Unit]</literal> and <literal>[Install]</literal>
70 sections. A separate <literal>[Device]</literal> section does not
71 exist, since no device-specific options may be configured.</para>
72
73 <para>systemd will dynamically create device units for all kernel
74 devices that are marked with the "systemd" udev tag (by default
75 all block and network devices, and a few others). This may be used
76 to define dependencies between devices and other units. To tag a
77 udev device, use <literal>TAG+="systemd"</literal> in the udev
78 rules file, see
79 <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
80 for details.</para>
81
82 <para>Device units are named after the <filename>/sys</filename>
83 and <filename>/dev</filename> paths they control. Example: the
84 device <filename noindex='true'>/dev/sda5</filename> is exposed in
85 systemd as <filename>dev-sda5.device</filename>. For details about
86 the escaping logic used to convert a file system path to a unit
87 name see
88 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
89
90 </refsect1>
91
92 <refsect1>
93 <title>The udev Database</title>
94
95 <para>The settings of device units may either be configured via
96 unit files, or directly from the udev database (which is
97 recommended). The following udev device properties are understood
98 by systemd:</para>
99
100 <variablelist class='udev-directives'>
101 <varlistentry>
102 <term><varname>SYSTEMD_WANTS=</varname></term>
103 <term><varname>SYSTEMD_USER_WANTS=</varname></term>
104 <listitem><para>Adds dependencies of type
105 <varname>Wants</varname> from the device unit to all listed
106 units. The first form is used by the system systemd instance,
107 the second by user systemd instances. Those settings may be
108 used to activate arbitrary units when a specific device
109 becomes available.</para>
110
111 <para>Note that this and the other tags are not taken into
112 account unless the device is tagged with the
113 <literal>systemd</literal> string in the udev database,
114 because otherwise the device is not exposed as a systemd unit
115 (see above).</para>
116
117 <para>Note that systemd will only act on
118 <varname>Wants</varname> dependencies when a device first
119 becomes active. It will not act on them if they are added to
120 devices that are already active. Use
121 <varname>SYSTEMD_READY=</varname> (see below) to influence on
122 which udev event to trigger the dependencies.
123 </para></listitem>
124 </varlistentry>
125
126 <varlistentry>
127 <term><varname>SYSTEMD_ALIAS=</varname></term>
128 <listitem><para>Adds an additional alias name to the device
129 unit. This must be an absolute path that is automatically
130 transformed into a unit name. (See above.)</para></listitem>
131 </varlistentry>
132
133 <varlistentry>
134 <term><varname>SYSTEMD_READY=</varname></term>
135 <listitem><para>If set to 0, systemd will consider this device
136 unplugged even if it shows up in the udev tree. If this
137 property is unset or set to 1, the device will be considered
138 plugged if it is visible in the udev tree. This property has
139 no influence on the behavior when a device disappears from the
140 udev tree.</para>
141
142 <para>This option is useful to support devices that initially
143 show up in an uninitialized state in the tree, and for which a
144 <literal>changed</literal> event is generated the moment they
145 are fully set up. Note that <varname>SYSTEMD_WANTS=</varname>
146 (see above) is not acted on as long as
147 <varname>SYSTEMD_READY=0</varname> is set for a
148 device.</para></listitem>
149 </varlistentry>
150
151 <varlistentry>
152 <term><varname>ID_MODEL_FROM_DATABASE=</varname></term>
153 <term><varname>ID_MODEL=</varname></term>
154
155 <listitem><para>If set, this property is used as description
156 string for the device unit.</para></listitem>
157 </varlistentry>
158
159 </variablelist>
160
161 </refsect1>
162
163 <refsect1>
164 <title>See Also</title>
165 <para>
166 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
167 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
168 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
169 <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
170 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
171 </para>
172 </refsect1>
173
174 </refentry>