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