]>
Commit | Line | Data |
---|---|---|
514094f9 | 1 | <?xml version='1.0'?> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
db9ecf05 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
f48f7543 | 5 | |
c94c581c YW |
6 | <refentry id="udevadm" |
7 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
8 | ||
63749b1a | 9 | <refentryinfo> |
225cb03b | 10 | <title>udevadm</title> |
d3a2386d | 11 | <productname>systemd</productname> |
63749b1a | 12 | </refentryinfo> |
225cb03b | 13 | |
63749b1a KS |
14 | <refmeta> |
15 | <refentrytitle>udevadm</refentrytitle> | |
16 | <manvolnum>8</manvolnum> | |
63749b1a | 17 | </refmeta> |
225cb03b | 18 | |
63749b1a KS |
19 | <refnamediv> |
20 | <refname>udevadm</refname><refpurpose>udev management tool</refpurpose> | |
21 | </refnamediv> | |
225cb03b | 22 | |
63749b1a KS |
23 | <refsynopsisdiv> |
24 | <cmdsynopsis> | |
25 | <command>udevadm</command> | |
26 | <arg><option>--debug</option></arg> | |
27 | <arg><option>--version</option></arg> | |
28 | <arg><option>--help</option></arg> | |
29 | </cmdsynopsis> | |
30 | <cmdsynopsis> | |
c94c581c | 31 | <command>udevadm info <optional>options</optional> <optional>devpath</optional></command> |
63749b1a KS |
32 | </cmdsynopsis> |
33 | <cmdsynopsis> | |
c94c581c | 34 | <command>udevadm trigger <optional>options</optional> <optional>devpath</optional></command> |
63749b1a KS |
35 | </cmdsynopsis> |
36 | <cmdsynopsis> | |
37 | <command>udevadm settle <optional>options</optional></command> | |
38 | </cmdsynopsis> | |
39 | <cmdsynopsis> | |
c94c581c | 40 | <command>udevadm control <replaceable>option</replaceable></command> |
63749b1a KS |
41 | </cmdsynopsis> |
42 | <cmdsynopsis> | |
43 | <command>udevadm monitor <optional>options</optional></command> | |
44 | </cmdsynopsis> | |
45 | <cmdsynopsis> | |
46 | <command>udevadm test <optional>options</optional> <replaceable>devpath</replaceable></command> | |
47 | </cmdsynopsis> | |
d7867b31 KS |
48 | <cmdsynopsis> |
49 | <command>udevadm test-builtin <optional>options</optional> <replaceable>command</replaceable> <replaceable>devpath</replaceable></command> | |
50 | </cmdsynopsis> | |
acdba85e DL |
51 | <cmdsynopsis> |
52 | <command>udevadm verify</command> | |
53 | <arg choice="opt" rep="repeat">options</arg> | |
e8c53080 | 54 | <arg choice="opt" rep="repeat"><replaceable>file</replaceable></arg> |
acdba85e | 55 | </cmdsynopsis> |
aa2b0d8d YW |
56 | <cmdsynopsis> |
57 | <command>udevadm wait <optional>options</optional> <replaceable>device|syspath</replaceable></command> | |
58 | </cmdsynopsis> | |
ae61c53c LP |
59 | <cmdsynopsis> |
60 | <command>udevadm lock <optional>options</optional> <replaceable>command</replaceable></command> | |
61 | </cmdsynopsis> | |
63749b1a | 62 | </refsynopsisdiv> |
225cb03b | 63 | |
63749b1a | 64 | <refsect1><title>Description</title> |
124b48b0 ZJS |
65 | <para><command>udevadm</command> expects a command and command |
66 | specific options. It controls the runtime behavior of | |
67 | <command>systemd-udevd</command>, requests kernel events, manages | |
68 | the event queue, and provides simple debugging mechanisms.</para> | |
63749b1a | 69 | </refsect1> |
225cb03b | 70 | |
80877656 | 71 | <refsect1><title>Options</title> |
63749b1a KS |
72 | <variablelist> |
73 | <varlistentry> | |
c94c581c | 74 | <term><option>-d</option></term> |
63749b1a KS |
75 | <term><option>--debug</option></term> |
76 | <listitem> | |
35a44646 YW |
77 | <para>Print debug messages to standard error. This option is implied in <command>udevadm test</command> and |
78 | <command>udevadm test-builtin</command> commands.</para> | |
63749b1a KS |
79 | </listitem> |
80 | </varlistentry> | |
c94c581c | 81 | |
c94c581c | 82 | <xi:include href="standard-options.xml" xpointer="help" /> |
63749b1a | 83 | </variablelist> |
225cb03b | 84 | |
80877656 ZJS |
85 | <refsect2><title>udevadm info |
86 | <arg choice="opt"><replaceable>options</replaceable></arg> | |
3c79311a | 87 | <arg choice="opt" rep="repeat"><replaceable>devpath</replaceable>|<replaceable>file</replaceable>|<replaceable>unit</replaceable></arg> |
80877656 ZJS |
88 | </title> |
89 | ||
b6854081 ZJS |
90 | <para>Query the udev database for device information.</para> |
91 | ||
3c79311a ZJS |
92 | <para>Positional arguments should be used to specify one or more devices. Each one may be a device name |
93 | (in which case it must start with <filename>/dev/</filename>), a sys path (in which case it must start | |
94 | with <filename>/sys/</filename>), or a systemd device unit name (in which case it must end with | |
b6854081 ZJS |
95 | <literal>.device</literal>, see |
96 | <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>). | |
97 | </para> | |
98 | ||
63749b1a KS |
99 | <variablelist> |
100 | <varlistentry> | |
7643ac9a ZJS |
101 | <term><option>-q</option></term> |
102 | <term><option>--query=<replaceable>TYPE</replaceable></option></term> | |
63749b1a | 103 | <listitem> |
b6854081 | 104 | <para>Query the database for the specified type of device data. |
7643ac9a ZJS |
105 | Valid <replaceable>TYPE</replaceable>s are: |
106 | <constant>name</constant>, <constant>symlink</constant>, | |
107 | <constant>path</constant>, <constant>property</constant>, | |
124b48b0 | 108 | <constant>all</constant>.</para> |
63749b1a KS |
109 | </listitem> |
110 | </varlistentry> | |
b6854081 | 111 | |
6c1482b2 FS |
112 | <varlistentry> |
113 | <term><option>--property=<replaceable>NAME</replaceable></option></term> | |
114 | <listitem> | |
115 | <para>When showing device properties using the <option>--query=property</option> | |
116 | option, limit display to properties specified in the argument. The argument should | |
117 | be a comma-separated list of property names. If not specified, all known properties | |
118 | are shown.</para> | |
ec07c3c8 AK |
119 | |
120 | <xi:include href="version-info.xml" xpointer="v250"/> | |
6c1482b2 FS |
121 | </listitem> |
122 | </varlistentry> | |
123 | <varlistentry> | |
124 | <term><option>--value</option></term> | |
125 | <listitem> | |
126 | <para>When showing device properties using the <option>--query=property</option> | |
127 | option, print only their values, and skip the property name and <literal>=</literal>.</para> | |
128 | <para>Cannot be used together with <option>-x/--export</option> or | |
129 | <option>-P/--export-prefix</option>.</para> | |
ec07c3c8 AK |
130 | |
131 | <xi:include href="version-info.xml" xpointer="v250"/> | |
6c1482b2 FS |
132 | </listitem> |
133 | </varlistentry> | |
63749b1a | 134 | <varlistentry> |
7643ac9a ZJS |
135 | <term><option>-p</option></term> |
136 | <term><option>--path=<replaceable>DEVPATH</replaceable></option></term> | |
63749b1a | 137 | <listitem> |
3b121157 ZJS |
138 | <para>The <filename>/sys/</filename> path of the device to query, e.g. |
139 | <filename><optional>/sys/</optional>/class/block/sda</filename>. This option is an alternative to | |
b6854081 ZJS |
140 | the positional argument with a <filename>/sys/</filename> prefix. <command>udevadm info |
141 | --path=/class/block/sda</command> is equivalent to <command>udevadm info | |
142 | /sys/class/block/sda</command>.</para> | |
63749b1a KS |
143 | </listitem> |
144 | </varlistentry> | |
145 | <varlistentry> | |
7643ac9a ZJS |
146 | <term><option>-n</option></term> |
147 | <term><option>--name=<replaceable>FILE</replaceable></option></term> | |
63749b1a | 148 | <listitem> |
124b48b0 | 149 | <para>The name of the device node or a symlink to query, |
3b121157 | 150 | e.g. <filename><optional>/dev/</optional>/sda</filename>. This option is an alternative to the |
b6854081 ZJS |
151 | positional argument with a <filename>/dev/</filename> prefix. <command>udevadm info |
152 | --name=sda</command> is equivalent to <command>udevadm info /dev/sda</command>.</para> | |
63749b1a KS |
153 | </listitem> |
154 | </varlistentry> | |
155 | <varlistentry> | |
7643ac9a | 156 | <term><option>-r</option></term> |
63749b1a KS |
157 | <term><option>--root</option></term> |
158 | <listitem> | |
4f5d327a KS |
159 | <para>Print absolute paths in <command>name</command> or <command>symlink</command> |
160 | query.</para> | |
4ec9c3e7 KS |
161 | </listitem> |
162 | </varlistentry> | |
63749b1a | 163 | <varlistentry> |
7643ac9a | 164 | <term><option>-a</option></term> |
63749b1a KS |
165 | <term><option>--attribute-walk</option></term> |
166 | <listitem> | |
167 | <para>Print all sysfs properties of the specified device that can be used | |
168 | in udev rules to match the specified device. It prints all devices | |
169 | along the chain, up to the root of sysfs that can be used in udev rules.</para> | |
170 | </listitem> | |
171 | </varlistentry> | |
9117d94b LP |
172 | <varlistentry> |
173 | <term><option>-t</option></term> | |
174 | <term><option>--tree</option></term> | |
175 | <listitem> | |
176 | <para>Display a sysfs tree. This recursively iterates through the sysfs hierarchy and displays it | |
bd4297e7 | 177 | in a tree structure. If a path is specified only the subtree below and its parent directories are |
9117d94b | 178 | shown. This will show both device and subsystem items.</para> |
ec07c3c8 AK |
179 | |
180 | <xi:include href="version-info.xml" xpointer="v251"/> | |
9117d94b LP |
181 | </listitem> |
182 | </varlistentry> | |
dc1791a9 | 183 | <varlistentry> |
7643ac9a | 184 | <term><option>-x</option></term> |
dc1791a9 KS |
185 | <term><option>--export</option></term> |
186 | <listitem> | |
f0c29bbf YW |
187 | <para>Print output as key/value pairs. Values are enclosed in single quotes. |
188 | This takes effects only when <option>--query=property</option> or | |
189 | <option>--device-id-of-file=<replaceable>FILE</replaceable></option> is specified.</para> | |
dc1791a9 KS |
190 | </listitem> |
191 | </varlistentry> | |
192 | <varlistentry> | |
7643ac9a ZJS |
193 | <term><option>-P</option></term> |
194 | <term><option>--export-prefix=<replaceable>NAME</replaceable></option></term> | |
dc1791a9 | 195 | <listitem> |
f0c29bbf YW |
196 | <para>Add a prefix to the key name of exported values. |
197 | This implies <option>--export</option>.</para> | |
dc1791a9 KS |
198 | </listitem> |
199 | </varlistentry> | |
63749b1a | 200 | <varlistentry> |
7643ac9a ZJS |
201 | <term><option>-d</option></term> |
202 | <term><option>--device-id-of-file=<replaceable>FILE</replaceable></option></term> | |
63749b1a | 203 | <listitem> |
f0c29bbf YW |
204 | <para>Print major/minor numbers of the underlying device, where the file lives on. |
205 | If this is specified, all positional arguments are ignored.</para> | |
63749b1a KS |
206 | </listitem> |
207 | </varlistentry> | |
208 | <varlistentry> | |
7643ac9a | 209 | <term><option>-e</option></term> |
63749b1a KS |
210 | <term><option>--export-db</option></term> |
211 | <listitem> | |
212 | <para>Export the content of the udev database.</para> | |
213 | </listitem> | |
214 | </varlistentry> | |
9ead6627 | 215 | <varlistentry> |
7643ac9a | 216 | <term><option>-c</option></term> |
9ead6627 KS |
217 | <term><option>--cleanup-db</option></term> |
218 | <listitem> | |
219 | <para>Cleanup the udev database.</para> | |
220 | </listitem> | |
221 | </varlistentry> | |
ae760f4b YW |
222 | <varlistentry> |
223 | <term><option>-w<optional>SECONDS</optional></option></term> | |
224 | <term><option>--wait-for-initialization<optional>=SECONDS</optional></option></term> | |
225 | <listitem> | |
226 | <para>Wait for device to be initialized. If argument <replaceable>SECONDS</replaceable> | |
227 | is not specified, the default is to wait forever.</para> | |
ec07c3c8 AK |
228 | |
229 | <xi:include href="version-info.xml" xpointer="v243"/> | |
ae760f4b YW |
230 | </listitem> |
231 | </varlistentry> | |
c94c581c | 232 | |
c94c581c | 233 | <xi:include href="standard-options.xml" xpointer="help" /> |
b6ec23a0 | 234 | <xi:include href="standard-options.xml" xpointer="no-pager" /> |
63749b1a | 235 | </variablelist> |
205013c8 LP |
236 | |
237 | <para>The generated output shows the current device database entry in a terse format. Each line shown | |
238 | is prefixed with one of the following characters:</para> | |
239 | ||
240 | <table> | |
241 | <title><command>udevadm info</command> output prefixes</title> | |
242 | <tgroup cols='2' align='left' colsep='1' rowsep='1'> | |
243 | <colspec colname="prefix" /> | |
244 | <colspec colname="meaning" /> | |
245 | <thead> | |
246 | <row> | |
247 | <entry>Prefix</entry> | |
248 | <entry>Meaning</entry> | |
249 | </row> | |
250 | </thead> | |
251 | <tbody> | |
252 | <row> | |
253 | <entry><literal>P:</literal></entry> | |
254 | <entry>Device path in <filename>/sys/</filename></entry> | |
255 | </row> | |
a0e90259 LP |
256 | <row> |
257 | <entry><literal>M:</literal></entry> | |
258 | <entry>Device name in <filename>/sys/</filename> (i.e. the last component of <literal>P:</literal>)</entry> | |
259 | </row> | |
260 | <row> | |
261 | <entry><literal>R:</literal></entry> | |
262 | <entry>Device number in <filename>/sys/</filename> (i.e. the numeric suffix of the last component of <literal>P:</literal>)</entry> | |
263 | </row> | |
264 | <row> | |
265 | <entry><literal>U:</literal></entry> | |
266 | <entry>Kernel subsystem</entry> | |
267 | </row> | |
268 | <row> | |
269 | <entry><literal>T:</literal></entry> | |
270 | <entry>Kernel device type within subsystem</entry> | |
271 | </row> | |
272 | <row> | |
273 | <entry><literal>D:</literal></entry> | |
274 | <entry>Kernel device node major/minor</entry> | |
275 | </row> | |
276 | <row> | |
277 | <entry><literal>I:</literal></entry> | |
278 | <entry>Network interface index</entry> | |
279 | </row> | |
205013c8 LP |
280 | <row> |
281 | <entry><literal>N:</literal></entry> | |
282 | <entry>Kernel device node name</entry> | |
283 | </row> | |
284 | <row> | |
285 | <entry><literal>L:</literal></entry> | |
286 | <entry>Device node symlink priority</entry> | |
287 | </row> | |
288 | <row> | |
289 | <entry><literal>S:</literal></entry> | |
290 | <entry>Device node symlink</entry> | |
291 | </row> | |
a0e90259 LP |
292 | <row> |
293 | <entry><literal>Q:</literal></entry> | |
294 | <entry>Block device sequence number (DISKSEQ)</entry> | |
295 | </row> | |
296 | <row> | |
297 | <entry><literal>V:</literal></entry> | |
298 | <entry>Attached driver</entry> | |
299 | </row> | |
205013c8 LP |
300 | <row> |
301 | <entry><literal>E:</literal></entry> | |
302 | <entry>Device property</entry> | |
303 | </row> | |
304 | </tbody> | |
305 | </tgroup> | |
306 | </table> | |
63749b1a | 307 | </refsect2> |
225cb03b | 308 | |
80877656 ZJS |
309 | <refsect2><title>udevadm trigger |
310 | <arg choice="opt"><replaceable>options</replaceable></arg> | |
a9bc94e5 | 311 | <arg choice="opt"><replaceable>devpath</replaceable>|<replaceable>file</replaceable>|<replaceable>unit</replaceable></arg> |
b6854081 | 312 | </title> |
63749b1a | 313 | <para>Request device events from the kernel. Primarily used to replay events at system coldplug time.</para> |
b6854081 | 314 | |
5b3b0733 | 315 | <para>Takes device specifications as positional arguments. See the description of <command>info</command> |
b6854081 ZJS |
316 | above.</para> |
317 | ||
63749b1a KS |
318 | <variablelist> |
319 | <varlistentry> | |
7643ac9a | 320 | <term><option>-v</option></term> |
63749b1a KS |
321 | <term><option>--verbose</option></term> |
322 | <listitem> | |
323 | <para>Print the list of devices which will be triggered.</para> | |
324 | </listitem> | |
325 | </varlistentry> | |
326 | <varlistentry> | |
7643ac9a | 327 | <term><option>-n</option></term> |
63749b1a KS |
328 | <term><option>--dry-run</option></term> |
329 | <listitem> | |
330 | <para>Do not actually trigger the event.</para> | |
331 | </listitem> | |
332 | </varlistentry> | |
6c99c265 YW |
333 | <varlistentry> |
334 | <term><option>-q</option></term> | |
335 | <term><option>--quiet</option></term> | |
336 | <listitem> | |
337 | <para>Suppress error logging in triggering events.</para> | |
ec07c3c8 AK |
338 | |
339 | <xi:include href="version-info.xml" xpointer="v248"/> | |
6c99c265 YW |
340 | </listitem> |
341 | </varlistentry> | |
63749b1a | 342 | <varlistentry> |
7643ac9a ZJS |
343 | <term><option>-t</option></term> |
344 | <term><option>--type=<replaceable>TYPE</replaceable></option></term> | |
63749b1a | 345 | <listitem> |
1baeee57 YW |
346 | <para>Trigger a specific type of devices. Valid types are <literal>all</literal>, |
347 | <literal>devices</literal>, and <literal>subsystems</literal>. The default value is | |
348 | <literal>devices</literal>.</para> | |
63749b1a KS |
349 | </listitem> |
350 | </varlistentry> | |
351 | <varlistentry> | |
7643ac9a ZJS |
352 | <term><option>-c</option></term> |
353 | <term><option>--action=<replaceable>ACTION</replaceable></option></term> | |
63749b1a | 354 | <listitem> |
cd648ae1 YW |
355 | <para>Type of event to be triggered. Possible actions are <literal>add</literal>, |
356 | <literal>remove</literal>, <literal>change</literal>, <literal>move</literal>, | |
357 | <literal>online</literal>, <literal>offline</literal>, <literal>bind</literal>, | |
6d22bd87 YW |
358 | and <literal>unbind</literal>. Also, the special value <literal>help</literal> can be used |
359 | to list the possible actions. The default value is <literal>change</literal>. | |
360 | </para> | |
63749b1a KS |
361 | </listitem> |
362 | </varlistentry> | |
873cf95c YW |
363 | <varlistentry> |
364 | <term><option>--prioritized-subsystem=<replaceable>SUBSYSTEM<optional>,<replaceable>SUBSYSTEM</replaceable>…</optional></replaceable></option></term> | |
365 | <listitem> | |
366 | <para>Takes a comma separated list of subsystems. When triggering events for devices, the | |
367 | devices from the specified subsystems and their parents are triggered first. For example, | |
368 | if <option>--prioritized-subsystem=block,net</option>, then firstly all block devices and | |
369 | their parents are triggered, in the next all network devices and their parents are | |
370 | triggered, and lastly the other devices are triggered. This option can be specified | |
371 | multiple times, and in that case the lists of the subsystems will be merged. That is, | |
372 | <option>--prioritized-subsystem=block --prioritized-subsystem=net</option> is equivalent to | |
373 | <option>--prioritized-subsystem=block,net</option>.</para> | |
ec07c3c8 AK |
374 | |
375 | <xi:include href="version-info.xml" xpointer="v251"/> | |
873cf95c YW |
376 | </listitem> |
377 | </varlistentry> | |
63749b1a | 378 | <varlistentry> |
7643ac9a ZJS |
379 | <term><option>-s</option></term> |
380 | <term><option>--subsystem-match=<replaceable>SUBSYSTEM</replaceable></option></term> | |
63749b1a | 381 | <listitem> |
7643ac9a | 382 | <para>Trigger events for devices which belong to a |
a9bc94e5 YW |
383 | matching subsystem. This option supports shell style pattern matching. |
384 | When this option is specified more than once, then each matching result is ORed, that is, | |
385 | all the devices in each subsystem are triggered.</para> | |
63749b1a KS |
386 | </listitem> |
387 | </varlistentry> | |
388 | <varlistentry> | |
7643ac9a ZJS |
389 | <term><option>-S</option></term> |
390 | <term><option>--subsystem-nomatch=<replaceable>SUBSYSTEM</replaceable></option></term> | |
63749b1a KS |
391 | <listitem> |
392 | <para>Do not trigger events for devices which belong to a matching subsystem. This option | |
a9bc94e5 YW |
393 | supports shell style pattern matching. When this option is specified more than once, |
394 | then each matching result is ANDed, that is, devices which do not match all specified | |
395 | subsystems are triggered.</para> | |
63749b1a KS |
396 | </listitem> |
397 | </varlistentry> | |
398 | <varlistentry> | |
7643ac9a ZJS |
399 | <term><option>-a</option></term> |
400 | <term><option>--attr-match=<replaceable>ATTRIBUTE</replaceable>=<replaceable>VALUE</replaceable></option></term> | |
63749b1a | 401 | <listitem> |
a9bc94e5 YW |
402 | <para>Trigger events for devices with a matching sysfs attribute. If a value is specified along |
403 | with the attribute name, the content of the attribute is matched against the given value using | |
404 | shell style pattern matching. If no value is specified, the existence of the sysfs attribute is | |
405 | checked. When this option is specified multiple times, then each matching result is ANDed, | |
406 | that is, only devices which have all specified attributes are triggered.</para> | |
63749b1a KS |
407 | </listitem> |
408 | </varlistentry> | |
409 | <varlistentry> | |
7643ac9a ZJS |
410 | <term><option>-A</option></term> |
411 | <term><option>--attr-nomatch=<replaceable>ATTRIBUTE</replaceable>=<replaceable>VALUE</replaceable></option></term> | |
63749b1a | 412 | <listitem> |
a9bc94e5 YW |
413 | <para>Do not trigger events for devices with a matching sysfs attribute. If a value is specified |
414 | along with the attribute name, the content of the attribute is matched against the given value | |
415 | using shell style pattern matching. If no value is specified, the existence of the sysfs attribute | |
416 | is checked. When this option is specified multiple times, then each matching result is ANDed, | |
417 | that is, only devices which have none of the specified attributes are triggered.</para> | |
63749b1a KS |
418 | </listitem> |
419 | </varlistentry> | |
420 | <varlistentry> | |
7643ac9a ZJS |
421 | <term><option>-p</option></term> |
422 | <term><option>--property-match=<replaceable>PROPERTY</replaceable>=<replaceable>VALUE</replaceable></option></term> | |
63749b1a | 423 | <listitem> |
a9bc94e5 YW |
424 | <para>Trigger events for devices with a matching property value. This option supports shell style |
425 | pattern matching. When this option is specified more than once, then each matching result is ORed, | |
426 | that is, devices which have one of the specified properties are triggered.</para> | |
63749b1a KS |
427 | </listitem> |
428 | </varlistentry> | |
429 | <varlistentry> | |
7643ac9a | 430 | <term><option>-g</option></term> |
d27e6aee | 431 | <term><option>--tag-match=<replaceable>TAG</replaceable></option></term> |
63749b1a | 432 | <listitem> |
a9bc94e5 YW |
433 | <para>Trigger events for devices with a matching tag. When this option is specified multiple times, |
434 | then each matching result is ANDed, that is, devices which have all specified tags are triggered.</para> | |
63749b1a KS |
435 | </listitem> |
436 | </varlistentry> | |
437 | <varlistentry> | |
7643ac9a | 438 | <term><option>-y</option></term> |
a9bc94e5 | 439 | <term><option>--sysname-match=<replaceable>NAME</replaceable></option></term> |
63749b1a | 440 | <listitem> |
a9bc94e5 | 441 | <para>Trigger events for devices for which the last component (i.e. the filename) of the |
3b121157 | 442 | <filename>/sys/</filename> path matches the specified <replaceable>PATH</replaceable>. This option |
a9bc94e5 YW |
443 | supports shell style pattern matching. When this option is specified more than once, then each |
444 | matching result is ORed, that is, all devices which have any of the specified | |
445 | <replaceable>NAME</replaceable> are triggered.</para> | |
63749b1a KS |
446 | </listitem> |
447 | </varlistentry> | |
80877656 ZJS |
448 | <varlistentry> |
449 | <term><option>--name-match=<replaceable>NAME</replaceable></option></term> | |
450 | <listitem> | |
a9bc94e5 | 451 | <para>Trigger events for devices with a matching device path. When this option is specified more than once, |
5b3b0733 | 452 | then each matching result is ORed, that is, all specified devices are triggered.</para> |
aefdc112 AK |
453 | |
454 | <xi:include href="version-info.xml" xpointer="v218"/> | |
80877656 ZJS |
455 | </listitem> |
456 | </varlistentry> | |
b05211fa | 457 | <varlistentry> |
7643ac9a ZJS |
458 | <term><option>-b</option></term> |
459 | <term><option>--parent-match=<replaceable>SYSPATH</replaceable></option></term> | |
b05211fa | 460 | <listitem> |
a9bc94e5 | 461 | <para>Trigger events for all children of a given device. When this option is specified more than once, |
5b3b0733 | 462 | then each matching result is ORed, that is, all children of each specified device are triggered.</para> |
7643ac9a | 463 | </listitem> |
792cc203 | 464 | </varlistentry> |
678f2b16 DK |
465 | <varlistentry> |
466 | <term><option>--initialized-match</option></term> | |
467 | <term><option>--initialized-nomatch</option></term> | |
468 | <listitem> | |
469 | <para>When <option>--initialized-match</option> is specified, trigger events for devices | |
470 | that are already initialized by <command>systemd-udevd</command>, and skip devices that | |
471 | are not initialized yet.</para> | |
472 | <para>When <option>--initialized-nomatch</option> is specified, trigger events for devices | |
473 | that are not initialized by <command>systemd-udevd</command> yet, and skip devices that | |
474 | are already initialized.</para> | |
aa2b0d8d YW |
475 | <para>Typically, it is essential that applications which intend to use such a match, make |
476 | sure a suitable udev rule is installed that sets at least one property on devices that | |
477 | shall be matched. See also Initialized Devices section below for more details.</para> | |
678f2b16 DK |
478 | <para>WARNING: <option>--initialized-nomatch</option> can potentially save a significant |
479 | amount of time compared to re-triggering all devices in the system and e.g. can be used to | |
480 | optimize boot time. However, this is not safe to be used in a boot sequence in general. | |
481 | Especially, when udev rules for a device depend on its parent devices (e.g. | |
482 | <literal>ATTRS</literal> or <literal>IMPORT{parent}</literal> keys, see | |
483 | <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
484 | for more details), the final state of the device becomes easily unstable with this option. | |
485 | </para> | |
ec07c3c8 AK |
486 | |
487 | <xi:include href="version-info.xml" xpointer="v251"/> | |
678f2b16 DK |
488 | </listitem> |
489 | </varlistentry> | |
792cc203 MH |
490 | <varlistentry> |
491 | <term><option>-w</option></term> | |
492 | <term><option>--settle</option></term> | |
493 | <listitem> | |
494 | <para>Apart from triggering events, also waits for those events to | |
495 | finish. Note that this is different from calling <command>udevadm | |
496 | settle</command>. <command>udevadm settle</command> waits for all | |
497 | events to finish. This option only waits for events triggered by | |
498 | the same command to finish.</para> | |
aefdc112 AK |
499 | |
500 | <xi:include href="version-info.xml" xpointer="v238"/> | |
792cc203 | 501 | </listitem> |
7643ac9a | 502 | </varlistentry> |
730b9c1e LP |
503 | <varlistentry> |
504 | <term><option>--uuid</option></term> | |
505 | <listitem> | |
506 | <para>Trigger the synthetic device events, and associate a randomized UUID with each. These UUIDs | |
507 | are printed to standard output, one line for each event. These UUIDs are included in the uevent | |
508 | environment block (in the <literal>SYNTH_UUID=</literal> property) and may be used to track | |
509 | delivery of the generated events.</para> | |
ec07c3c8 AK |
510 | |
511 | <xi:include href="version-info.xml" xpointer="v249"/> | |
730b9c1e LP |
512 | </listitem> |
513 | </varlistentry> | |
2001622c YW |
514 | <varlistentry> |
515 | <term><option>--wait-daemon[=<replaceable>SECONDS</replaceable>]</option></term> | |
516 | <listitem> | |
517 | <para>Before triggering uevents, wait for systemd-udevd daemon to be initialized. | |
ff0a9199 YW |
518 | Optionally takes timeout value. Default timeout is 5 seconds. This is equivalent to invoking |
519 | <command>udevadm control --ping</command> before <command>udevadm trigger</command>.</para> | |
ec07c3c8 AK |
520 | |
521 | <xi:include href="version-info.xml" xpointer="v241"/> | |
2001622c YW |
522 | </listitem> |
523 | </varlistentry> | |
c94c581c | 524 | |
c94c581c | 525 | <xi:include href="standard-options.xml" xpointer="help" /> |
63749b1a | 526 | </variablelist> |
80877656 | 527 | |
5b3b0733 YW |
528 | <para>In addition, optional positional arguments can be used |
529 | to specify device names or sys paths. They must start with | |
3b121157 | 530 | <filename>/dev/</filename> or <filename>/sys/</filename> |
80877656 | 531 | respectively.</para> |
63749b1a | 532 | </refsect2> |
225cb03b | 533 | |
80877656 ZJS |
534 | <refsect2><title>udevadm settle |
535 | <arg choice="opt"><replaceable>options</replaceable></arg> | |
536 | </title> | |
63749b1a KS |
537 | <para>Watches the udev event queue, and exits if all current events are handled.</para> |
538 | <variablelist> | |
539 | <varlistentry> | |
7643ac9a ZJS |
540 | <term><option>-t</option></term> |
541 | <term><option>--timeout=<replaceable>SECONDS</replaceable></option></term> | |
63749b1a | 542 | <listitem> |
7643ac9a ZJS |
543 | <para>Maximum number of seconds to wait for the event |
544 | queue to become empty. The default value is 120 seconds. A | |
545 | value of 0 will check if the queue is empty and always | |
2233c270 YK |
546 | return immediately. A non-zero value will return an exit |
547 | code of 0 if queue became empty before timeout was reached, | |
548 | non-zero otherwise.</para> | |
63749b1a KS |
549 | </listitem> |
550 | </varlistentry> | |
63749b1a | 551 | <varlistentry> |
7643ac9a ZJS |
552 | <term><option>-E</option></term> |
553 | <term><option>--exit-if-exists=<replaceable>FILE</replaceable></option></term> | |
63749b1a KS |
554 | <listitem> |
555 | <para>Stop waiting if file exists.</para> | |
556 | </listitem> | |
557 | </varlistentry> | |
c94c581c | 558 | |
c94c581c | 559 | <xi:include href="standard-options.xml" xpointer="help" /> |
63749b1a | 560 | </variablelist> |
18a38822 ZJS |
561 | |
562 | <para>See | |
563 | <citerefentry><refentrytitle>systemd-udev-settle.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
564 | for more information.</para> | |
63749b1a | 565 | </refsect2> |
225cb03b | 566 | |
c94c581c | 567 | <refsect2><title>udevadm control <replaceable>option</replaceable></title> |
63749b1a KS |
568 | <para>Modify the internal state of the running udev daemon.</para> |
569 | <variablelist> | |
ff2c503d | 570 | <varlistentry> |
bd8420c5 | 571 | <term><option>-e</option></term> |
ff2c503d KS |
572 | <term><option>--exit</option></term> |
573 | <listitem> | |
6371db93 YW |
574 | <para>Signal and wait for systemd-udevd to exit. No option except for |
575 | <option>--timeout</option> can be specified after this option. | |
576 | Note that <filename>systemd-udevd.service</filename> contains | |
577 | <option>Restart=always</option> and so as a result, this option restarts systemd-udevd. | |
d0d7e102 YW |
578 | If you want to stop <filename>systemd-udevd.service</filename>, please use the following: |
579 | <programlisting>systemctl stop systemd-udevd-control.socket systemd-udevd-kernel.socket systemd-udevd.service</programlisting> | |
580 | </para> | |
ff2c503d KS |
581 | </listitem> |
582 | </varlistentry> | |
63749b1a | 583 | <varlistentry> |
7643ac9a | 584 | <term><option>-l</option></term> |
027f96c8 | 585 | <term><option>--log-level=<replaceable>value</replaceable></option></term> |
63749b1a | 586 | <listitem> |
e03234a1 ZJS |
587 | <para>Set the internal log level of |
588 | <filename>systemd-udevd</filename>. Valid values are the | |
589 | numerical syslog priorities or their textual | |
590 | representations: <option>emerg</option>, | |
591 | <option>alert</option>, <option>crit</option>, | |
592 | <option>err</option>, <option>warning</option>, | |
593 | <option>notice</option>, <option>info</option>, and | |
594 | <option>debug</option>.</para> | |
63749b1a KS |
595 | </listitem> |
596 | </varlistentry> | |
597 | <varlistentry> | |
7643ac9a | 598 | <term><option>-s</option></term> |
63749b1a KS |
599 | <term><option>--stop-exec-queue</option></term> |
600 | <listitem> | |
f13b388f | 601 | <para>Signal systemd-udevd to stop executing new events. Incoming events |
63749b1a KS |
602 | will be queued.</para> |
603 | </listitem> | |
604 | </varlistentry> | |
605 | <varlistentry> | |
7643ac9a | 606 | <term><option>-S</option></term> |
63749b1a KS |
607 | <term><option>--start-exec-queue</option></term> |
608 | <listitem> | |
f13b388f | 609 | <para>Signal systemd-udevd to enable the execution of events.</para> |
63749b1a KS |
610 | </listitem> |
611 | </varlistentry> | |
612 | <varlistentry> | |
7643ac9a | 613 | <term><option>-R</option></term> |
7c85d636 | 614 | <term><option>--reload</option></term> |
63749b1a | 615 | <listitem> |
f13b388f | 616 | <para>Signal systemd-udevd to reload the rules files and other databases like the kernel |
7c85d636 KS |
617 | module index. Reloading rules and databases does not apply any changes to already |
618 | existing devices; the new configuration will only be applied to new events.</para> | |
63749b1a KS |
619 | </listitem> |
620 | </varlistentry> | |
621 | <varlistentry> | |
7643ac9a | 622 | <term><option>-p</option></term> |
63749b1a KS |
623 | <term><option>--property=<replaceable>KEY</replaceable>=<replaceable>value</replaceable></option></term> |
624 | <listitem> | |
625 | <para>Set a global property for all events.</para> | |
626 | </listitem> | |
627 | </varlistentry> | |
628 | <varlistentry> | |
7643ac9a | 629 | <term><option>-m</option></term> |
87d55ff6 | 630 | <term><option>--children-max=</option><replaceable>value</replaceable></term> |
63749b1a | 631 | <listitem> |
7b5ca134 YW |
632 | <para>Set the maximum number of events, systemd-udevd will handle at the same time. When 0 is |
633 | specified, then the maximum is determined based on the system resources.</para> | |
63749b1a KS |
634 | </listitem> |
635 | </varlistentry> | |
a82340cc YW |
636 | <varlistentry> |
637 | <term><option>--ping</option></term> | |
638 | <listitem> | |
639 | <para>Send a ping message to systemd-udevd and wait for the reply. This may be useful to check that | |
640 | systemd-udevd daemon is running.</para> | |
ec07c3c8 AK |
641 | |
642 | <xi:include href="version-info.xml" xpointer="v241"/> | |
a82340cc YW |
643 | </listitem> |
644 | </varlistentry> | |
ff2c503d | 645 | <varlistentry> |
c94c581c | 646 | <term><option>-t</option></term> |
ff2c503d KS |
647 | <term><option>--timeout=</option><replaceable>seconds</replaceable></term> |
648 | <listitem> | |
7e505069 | 649 | <para>The maximum number of seconds to wait for a reply from systemd-udevd.</para> |
ff2c503d KS |
650 | </listitem> |
651 | </varlistentry> | |
c94c581c | 652 | |
c94c581c | 653 | <xi:include href="standard-options.xml" xpointer="help" /> |
63749b1a KS |
654 | </variablelist> |
655 | </refsect2> | |
225cb03b | 656 | |
80877656 ZJS |
657 | <refsect2><title>udevadm monitor |
658 | <arg choice="opt"><replaceable>options</replaceable></arg> | |
659 | </title> | |
63749b1a KS |
660 | <para>Listens to the kernel uevents and events sent out by a udev rule |
661 | and prints the devpath of the event to the console. It can be used to analyze the | |
662 | event timing, by comparing the timestamps of the kernel uevent and the udev event. | |
663 | </para> | |
664 | <variablelist> | |
665 | <varlistentry> | |
7643ac9a | 666 | <term><option>-k</option></term> |
63749b1a KS |
667 | <term><option>--kernel</option></term> |
668 | <listitem> | |
669 | <para>Print the kernel uevents.</para> | |
670 | </listitem> | |
671 | </varlistentry> | |
672 | <varlistentry> | |
7643ac9a | 673 | <term><option>-u</option></term> |
63749b1a KS |
674 | <term><option>--udev</option></term> |
675 | <listitem> | |
676 | <para>Print the udev event after the rule processing.</para> | |
677 | </listitem> | |
678 | </varlistentry> | |
679 | <varlistentry> | |
7643ac9a | 680 | <term><option>-p</option></term> |
63749b1a KS |
681 | <term><option>--property</option></term> |
682 | <listitem> | |
683 | <para>Also print the properties of the event.</para> | |
684 | </listitem> | |
685 | </varlistentry> | |
686 | <varlistentry> | |
7643ac9a | 687 | <term><option>-s</option></term> |
63749b1a KS |
688 | <term><option>--subsystem-match=<replaceable>string[/string]</replaceable></option></term> |
689 | <listitem> | |
a9bc94e5 YW |
690 | <para>Filter kernel uevents and udev events by subsystem[/devtype]. Only events with a matching subsystem value will pass. |
691 | When this option is specified more than once, then each matching result is ORed, that is, all devices in the specified | |
692 | subsystems are monitored.</para> | |
63749b1a KS |
693 | </listitem> |
694 | </varlistentry> | |
695 | <varlistentry> | |
7643ac9a | 696 | <term><option>-t</option></term> |
63749b1a KS |
697 | <term><option>--tag-match=<replaceable>string</replaceable></option></term> |
698 | <listitem> | |
a9bc94e5 YW |
699 | <para>Filter udev events by tag. Only udev events with a given tag attached will pass. |
700 | When this option is specified more than once, then each matching result is ORed, that is, devices which have one of the | |
701 | specified tags are monitored.</para> | |
63749b1a KS |
702 | </listitem> |
703 | </varlistentry> | |
c94c581c | 704 | |
c94c581c | 705 | <xi:include href="standard-options.xml" xpointer="help" /> |
63749b1a KS |
706 | </variablelist> |
707 | </refsect2> | |
225cb03b | 708 | |
80877656 ZJS |
709 | <refsect2><title>udevadm test |
710 | <arg choice="opt"><replaceable>options</replaceable></arg> | |
f4f32495 | 711 | <arg choice="opt"><replaceable>devpath</replaceable>|<replaceable>file</replaceable>|<replaceable>unit</replaceable></arg> |
80877656 | 712 | </title> |
63749b1a KS |
713 | <para>Simulate a udev event run for the given device, and print debug output.</para> |
714 | <variablelist> | |
715 | <varlistentry> | |
7643ac9a | 716 | <term><option>-a</option></term> |
6d22bd87 | 717 | <term><option>--action=<replaceable>ACTION</replaceable></option></term> |
63749b1a | 718 | <listitem> |
e148cbc5 YW |
719 | <para>Type of event to be simulated. Possible actions are <literal>add</literal>, |
720 | <literal>remove</literal>, <literal>change</literal>, <literal>move</literal>, | |
721 | <literal>online</literal>, <literal>offline</literal>, <literal>bind</literal>, | |
722 | and <literal>unbind</literal>. Also, the special value <literal>help</literal> can be used | |
723 | to list the possible actions. The default value is <literal>add</literal>.</para> | |
63749b1a KS |
724 | </listitem> |
725 | </varlistentry> | |
726 | <varlistentry> | |
7643ac9a | 727 | <term><option>-N</option></term> |
124b48b0 | 728 | <term><option>--resolve-names=<constant>early</constant>|<constant>late</constant>|<constant>never</constant></option></term> |
63749b1a | 729 | <listitem> |
124b48b0 ZJS |
730 | <para>Specify when udevadm should resolve names of users |
731 | and groups. When set to <constant>early</constant> (the | |
72f4d966 JE |
732 | default), names will be resolved when the rules are |
733 | parsed. When set to <constant>late</constant>, names will | |
124b48b0 | 734 | be resolved for every event. When set to |
72f4d966 | 735 | <constant>never</constant>, names will never be resolved |
124b48b0 | 736 | and all devices will be owned by root.</para> |
aefdc112 AK |
737 | |
738 | <xi:include href="version-info.xml" xpointer="v209"/> | |
63749b1a KS |
739 | </listitem> |
740 | </varlistentry> | |
c94c581c | 741 | |
c94c581c | 742 | <xi:include href="standard-options.xml" xpointer="help" /> |
63749b1a KS |
743 | </variablelist> |
744 | </refsect2> | |
d7867b31 | 745 | |
80877656 ZJS |
746 | <refsect2><title>udevadm test-builtin |
747 | <arg choice="opt"><replaceable>options</replaceable></arg> | |
748 | <arg><replaceable>command</replaceable></arg> | |
f4f32495 | 749 | <arg choice="opt"><replaceable>devpath</replaceable>|<replaceable>file</replaceable>|<replaceable>unit</replaceable></arg> |
80877656 | 750 | </title> |
7643ac9a ZJS |
751 | <para>Run a built-in command <replaceable>COMMAND</replaceable> |
752 | for device <replaceable>DEVPATH</replaceable>, and print debug | |
753 | output.</para> | |
d7867b31 | 754 | <variablelist> |
7ce05a8d YW |
755 | <varlistentry> |
756 | <term><option>-a</option></term> | |
757 | <term><option>--action=<replaceable>ACTION</replaceable></option></term> | |
758 | <listitem> | |
759 | <para>Type of event to be simulated. Possible actions are <literal>add</literal>, | |
760 | <literal>remove</literal>, <literal>change</literal>, <literal>move</literal>, | |
761 | <literal>online</literal>, <literal>offline</literal>, <literal>bind</literal>, | |
762 | and <literal>unbind</literal>. Also, the special value <literal>help</literal> can be used | |
763 | to list the possible actions. The default value is <literal>add</literal>.</para> | |
aefdc112 AK |
764 | |
765 | <xi:include href="version-info.xml" xpointer="v250"/> | |
7ce05a8d YW |
766 | </listitem> |
767 | </varlistentry> | |
768 | ||
c94c581c | 769 | <xi:include href="standard-options.xml" xpointer="help" /> |
5356761d | 770 | <xi:include href="standard-options.xml" xpointer="version" /> |
d7867b31 KS |
771 | </variablelist> |
772 | </refsect2> | |
aa2b0d8d | 773 | |
acdba85e DL |
774 | <refsect2> |
775 | <title>udevadm verify | |
776 | <arg choice="opt"><replaceable>options</replaceable></arg> | |
e8c53080 | 777 | <arg choice="opt" rep="repeat"><replaceable>file</replaceable></arg> |
acdba85e DL |
778 | … |
779 | </title> | |
780 | ||
d4bfb78b | 781 | <para>Verify syntactic, semantic, and stylistic correctness of udev rules files.</para> |
acdba85e | 782 | |
e8c53080 DL |
783 | <para>Positional arguments could be used to specify one or more files to check. |
784 | If no files are specified, the udev rules are read from the files located in | |
785 | the same udev/rules.d directories that are processed by the udev daemon.</para> | |
acdba85e | 786 | |
d4bfb78b DL |
787 | <para>The exit status is <constant>0</constant> if all specified udev |
788 | rules files are syntactically, semantically, and stylistically correct, | |
789 | and a non-zero error code otherwise.</para> | |
acdba85e DL |
790 | |
791 | <variablelist> | |
792 | <varlistentry> | |
793 | <term><option>-N</option></term> | |
794 | <term><option>--resolve-names=<constant>early</constant>|<constant>never</constant></option></term> | |
795 | <listitem> | |
796 | <para>Specify when udevadm should resolve names of users | |
797 | and groups. When set to <constant>early</constant> (the | |
798 | default), names will be resolved when the rules are | |
799 | parsed. When set to <constant>never</constant>, names will | |
800 | never be resolved.</para> | |
ec07c3c8 AK |
801 | |
802 | <xi:include href="version-info.xml" xpointer="v254"/> | |
acdba85e | 803 | </listitem> |
a6ca54ed YW |
804 | </varlistentry> |
805 | ||
806 | <varlistentry> | |
0a7eda34 DL |
807 | <term><option>--root=<replaceable>PATH</replaceable></option></term> |
808 | <listitem> | |
809 | <para>When looking for udev rules files located in udev/rules.d directories, | |
810 | operate on files underneath the specified root path <replaceable>PATH</replaceable>.</para> | |
ec07c3c8 AK |
811 | |
812 | <xi:include href="version-info.xml" xpointer="v254"/> | |
0a7eda34 | 813 | </listitem> |
acdba85e DL |
814 | </varlistentry> |
815 | ||
9e36da15 DL |
816 | <varlistentry> |
817 | <term><option>--no-summary</option></term> | |
818 | <listitem> | |
819 | <para>Do not show summary.</para> | |
ec07c3c8 AK |
820 | |
821 | <xi:include href="version-info.xml" xpointer="v254"/> | |
9e36da15 DL |
822 | </listitem> |
823 | </varlistentry> | |
824 | ||
1bf3dd41 YW |
825 | <varlistentry> |
826 | <term><option>--no-style</option></term> | |
827 | <listitem> | |
828 | <para>Ignore style issues. When specified, even if style issues are found in udev rules files, | |
829 | the exit status is <constant>0</constant> if no syntactic or semantic errors are found.</para> | |
ec07c3c8 AK |
830 | |
831 | <xi:include href="version-info.xml" xpointer="v254"/> | |
1bf3dd41 YW |
832 | </listitem> |
833 | </varlistentry> | |
834 | ||
acdba85e DL |
835 | <xi:include href="standard-options.xml" xpointer="help" /> |
836 | </variablelist> | |
837 | </refsect2> | |
838 | ||
aa2b0d8d YW |
839 | <refsect2> |
840 | <title>udevadm wait | |
841 | <arg choice="opt"><replaceable>options</replaceable></arg> | |
842 | <arg choice="opt"><replaceable>device|syspath</replaceable></arg> | |
843 | … | |
844 | </title> | |
845 | ||
846 | <para>Wait for devices or device symlinks being created and initialized by | |
847 | <command>systemd-udevd</command>. Each device path must start with | |
848 | <literal>/dev/</literal> or <literal>/sys/</literal>, e.g. <literal>/dev/sda</literal>, | |
849 | <literal>/dev/disk/by-path/pci-0000:3c:00.0-nvme-1-part1</literal>, | |
850 | <literal>/sys/devices/pci0000:00/0000:00:1f.6/net/eth0</literal>, or | |
851 | <literal>/sys/class/net/eth0</literal>. This can take multiple devices. This may be useful for | |
852 | waiting for devices being processed by <command>systemd-udevd</command> after e.g. partitioning | |
853 | or formatting the devices.</para> | |
854 | ||
855 | <variablelist> | |
856 | <varlistentry> | |
857 | <term><option>-t</option></term> | |
858 | <term><option>--timeout=<replaceable>SECONDS</replaceable></option></term> | |
859 | <listitem> | |
860 | <para>Maximum number of seconds to wait for the specified devices or device symlinks being | |
861 | created, initialized, or removed. The default value is <literal>infinity</literal>.</para> | |
ec07c3c8 AK |
862 | |
863 | <xi:include href="version-info.xml" xpointer="v251"/> | |
aa2b0d8d YW |
864 | </listitem> |
865 | </varlistentry> | |
866 | ||
867 | <varlistentry> | |
868 | <term><option>--initialized=<replaceable>BOOL</replaceable></option></term> | |
869 | <listitem> | |
870 | <para>Check if <command>systemd-udevd</command> initialized devices. Defaults to true. When | |
871 | false, the command only checks if the specified devices exist. Set false to this setting if | |
872 | there is no udev rules for the specified devices, as the devices will never be considered | |
873 | as initialized in that case. See Initialized Devices section below for more details.</para> | |
ec07c3c8 AK |
874 | |
875 | <xi:include href="version-info.xml" xpointer="v251"/> | |
aa2b0d8d YW |
876 | </listitem> |
877 | </varlistentry> | |
878 | ||
879 | <varlistentry> | |
880 | <term><option>--removed</option></term> | |
881 | <listitem> | |
882 | <para>When specified, the command wait for devices being removed instead of created or | |
883 | initialized. If this is specified, <option>--initialized=</option> will be ignored.</para> | |
ec07c3c8 AK |
884 | |
885 | <xi:include href="version-info.xml" xpointer="v251"/> | |
aa2b0d8d YW |
886 | </listitem> |
887 | </varlistentry> | |
888 | ||
889 | <varlistentry> | |
890 | <term><option>--settle</option></term> | |
891 | <listitem> | |
892 | <para>When specified, also watches the udev event queue, and wait for all queued events | |
893 | being processed by <command>systemd-udevd</command>.</para> | |
ec07c3c8 AK |
894 | |
895 | <xi:include href="version-info.xml" xpointer="v251"/> | |
aa2b0d8d YW |
896 | </listitem> |
897 | </varlistentry> | |
898 | ||
899 | <xi:include href="standard-options.xml" xpointer="help" /> | |
900 | </variablelist> | |
901 | </refsect2> | |
ae61c53c LP |
902 | |
903 | <refsect2> | |
904 | <title>udevadm lock | |
905 | <arg choice="opt"><replaceable>options</replaceable></arg> | |
906 | <arg choice="opt"><replaceable>command</replaceable></arg> | |
907 | … | |
908 | </title> | |
909 | ||
0923b425 ZJS |
910 | <para><command>udevadm lock</command> takes an (advisory) exclusive lock on a block device (or all |
911 | specified devices), as per <ulink url="https://systemd.io/BLOCK_DEVICE_LOCKING">Locking Block Device | |
912 | Access</ulink> and invokes a program with the locks taken. When the invoked program exits the locks | |
aa386add UÖ |
913 | are automatically released and its return value is propagated as exit code of <command>udevadm |
914 | lock</command>.</para> | |
ae61c53c LP |
915 | |
916 | <para>This tool is in particular useful to ensure that | |
917 | <citerefentry><refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
918 | does not probe a block device while changes are made to it, for example partitions created or file | |
919 | systems formatted. Note that many tools that interface with block devices natively support taking | |
920 | relevant locks, see for example | |
ff9412c1 | 921 | <citerefentry project='man-pages'><refentrytitle>sfdisk</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s |
ae61c53c LP |
922 | <option>--lock</option> switch.</para> |
923 | ||
924 | <para>The command expects at least one block device specified via <option>--device=</option> or | |
925 | <option>--backing=</option>, and a command line to execute as arguments.</para> | |
926 | ||
927 | <variablelist> | |
928 | <varlistentry> | |
929 | <term><option>--device=<replaceable>DEVICE</replaceable></option></term> | |
930 | <term><option>-d <replaceable>DEVICE</replaceable></option></term> | |
931 | ||
932 | <listitem><para>Takes a path to a device node of the device to lock. This switch may be used | |
933 | multiple times (and in combination with <option>--backing=</option>) in order to lock multiple | |
934 | devices. If a partition block device node is specified the containing "whole" block device is | |
935 | automatically determined and used for the lock, as per the specification. If multiple devices are | |
936 | specified, they are deduplicated, sorted by the major/minor of their device nodes and then locked | |
937 | in order.</para> | |
938 | ||
939 | <para>This switch must be used at least once, to specify at least one device to | |
ec07c3c8 AK |
940 | lock. (Alternatively, use <option>--backing=</option>, see below.)</para> |
941 | ||
942 | <xi:include href="version-info.xml" xpointer="v251"/></listitem> | |
ae61c53c LP |
943 | </varlistentry> |
944 | ||
945 | <varlistentry> | |
946 | <term><option>--backing=<replaceable>PATH</replaceable></option></term> | |
947 | <term><option>-b <replaceable>PATH</replaceable></option></term> | |
948 | ||
949 | <listitem><para>If a path to a device node is specified, identical to | |
950 | <option>--device=</option>. However, this switch alternatively accepts a path to a regular file or | |
951 | directory, in which case the block device of the file system the file/directory resides on is | |
952 | automatically determined and used as if it was specified with | |
ec07c3c8 AK |
953 | <option>--device=</option>.</para> |
954 | ||
955 | <xi:include href="version-info.xml" xpointer="v251"/></listitem> | |
ae61c53c LP |
956 | </varlistentry> |
957 | ||
958 | <varlistentry> | |
959 | <term><option>--timeout=<replaceable>SECS</replaceable></option></term> | |
960 | <term><option>-t <replaceable>SECS</replaceable></option></term> | |
961 | ||
962 | <listitem><para>Specifies how long to wait at most until all locks can be taken. Takes a value in | |
963 | seconds, or in the usual supported time units, see | |
964 | <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>. If | |
965 | specified as zero the lock is attempted and if not successful the invocation will immediately | |
966 | fail. If passed as <literal>infinity</literal> (the default) the invocation will wait indefinitely | |
967 | until the lock can be acquired. If the lock cannot be taken in the specified time the specified | |
ec07c3c8 AK |
968 | command will not be executed and the invocation will fail.</para> |
969 | ||
970 | <xi:include href="version-info.xml" xpointer="v251"/></listitem> | |
ae61c53c LP |
971 | </varlistentry> |
972 | ||
973 | <varlistentry> | |
974 | <term><option>--print</option></term> | |
975 | <term><option>-p</option></term> | |
976 | ||
0923b425 ZJS |
977 | <listitem><para>Instead of locking the specified devices and executing a command, just print the |
978 | device paths that would be locked, and execute no command. This command is useful to determine | |
ae61c53c LP |
979 | the "whole" block device in case a partition block device is specified. The devices will be sorted |
980 | by their device node major number as primary ordering key and the minor number as secondary | |
981 | ordering key (i.e. they are shown in the order they'd be locked). Note that the number of lines | |
8b9f0921 | 982 | printed here can be less than the number of <option>--device=</option> and |
ae61c53c | 983 | <option>--backing=</option> switches specified in case these resolve to the same "whole" |
ec07c3c8 AK |
984 | devices.</para> |
985 | ||
986 | <xi:include href="version-info.xml" xpointer="v251"/></listitem> | |
ae61c53c LP |
987 | </varlistentry> |
988 | ||
989 | <xi:include href="standard-options.xml" xpointer="help" /> | |
990 | </variablelist> | |
991 | </refsect2> | |
aa2b0d8d YW |
992 | </refsect1> |
993 | ||
994 | <refsect1> | |
995 | <title>Initialized Devices</title> | |
996 | ||
997 | <para>Initialized devices are those for which at least one udev rule already completed execution | |
998 | – for any action but <literal>remove</literal> — that set a property or other device setting (and | |
999 | thus has an entry in the udev device database). Devices are no longer considered initialized if a | |
1000 | <literal>remove</literal> action is seen for them (which removes their entry in the udev device | |
1001 | database). Note that devices that have no udev rules are never considered initialized, but might | |
1002 | still be announced via the sd-device API (or similar).</para> | |
63749b1a | 1003 | </refsect1> |
225cb03b | 1004 | |
ae61c53c LP |
1005 | <refsect1> |
1006 | <title>Example</title> | |
1007 | ||
1008 | <example> | |
1009 | <title>Format a File System</title> | |
1010 | ||
1011 | <para>Take a lock on the backing block device while creating a file system, to ensure that | |
1012 | <command>systemd-udevd</command> doesn't probe or announce the new superblock before it is | |
1013 | comprehensively written:</para> | |
1014 | ||
1015 | <programlisting># udevadm lock --device=/dev/sda1 mkfs.ext4 /dev/sda1</programlisting> | |
1016 | </example> | |
1017 | ||
1018 | <example> | |
1019 | <title>Format a RAID File System</title> | |
1020 | ||
1021 | <para>Similar, but take locks on multiple devices at once:</para> | |
1022 | ||
1023 | <programlisting># udevadm lock --device=/dev/sda1 --device=/dev/sdb1 mkfs.btrfs /dev/sda1 /dev/sdb1</programlisting> | |
1024 | </example> | |
1025 | ||
1026 | <example> | |
1027 | <title>Copy in a File System</title> | |
1028 | ||
1029 | <para>Take a lock on the backing block device while copying in a prepared file system image, to ensure | |
1030 | that <command>systemd-udevd</command> doesn't probe or announce the new superblock before it is fully | |
1031 | written:</para> | |
1032 | ||
1033 | <programlisting># udevadm lock -d /dev/sda1 dd if=fs.raw of=/dev/sda1</programlisting> | |
1034 | </example> | |
1035 | </refsect1> | |
1036 | ||
63749b1a KS |
1037 | <refsect1> |
1038 | <title>See Also</title> | |
1039 | <para><citerefentry> | |
1040 | <refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum> | |
7d06ef0a | 1041 | </citerefentry>, |
63749b1a | 1042 | <citerefentry> |
b79f817b | 1043 | <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum> |
63749b1a KS |
1044 | </citerefentry></para> |
1045 | </refsect1> | |
1046 | </refentry> |