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