]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/udevadm.xml
tree-wide: beautify remaining copyright statements
[thirdparty/systemd.git] / man / udevadm.xml
1 <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 SPDX-License-Identifier: LGPL-2.1+
7
8 Copyright © 2010-2013 Kay Sievers
9 -->
10
11 <refentry id="udevadm"
12 xmlns:xi="http://www.w3.org/2001/XInclude">
13
14 <refentryinfo>
15 <title>udevadm</title>
16 <productname>systemd</productname>
17 <authorgroup>
18 <author>
19 <contrib>Developer</contrib>
20 <firstname>Kay</firstname>
21 <surname>Sievers</surname>
22 <email>kay@vrfy.org</email>
23 </author>
24 </authorgroup>
25 </refentryinfo>
26
27 <refmeta>
28 <refentrytitle>udevadm</refentrytitle>
29 <manvolnum>8</manvolnum>
30 </refmeta>
31
32 <refnamediv>
33 <refname>udevadm</refname><refpurpose>udev management tool</refpurpose>
34 </refnamediv>
35
36 <refsynopsisdiv>
37 <cmdsynopsis>
38 <command>udevadm</command>
39 <arg><option>--debug</option></arg>
40 <arg><option>--version</option></arg>
41 <arg><option>--help</option></arg>
42 </cmdsynopsis>
43 <cmdsynopsis>
44 <command>udevadm info <optional>options</optional> <optional>devpath</optional></command>
45 </cmdsynopsis>
46 <cmdsynopsis>
47 <command>udevadm trigger <optional>options</optional> <optional>devpath</optional></command>
48 </cmdsynopsis>
49 <cmdsynopsis>
50 <command>udevadm settle <optional>options</optional></command>
51 </cmdsynopsis>
52 <cmdsynopsis>
53 <command>udevadm control <replaceable>option</replaceable></command>
54 </cmdsynopsis>
55 <cmdsynopsis>
56 <command>udevadm monitor <optional>options</optional></command>
57 </cmdsynopsis>
58 <cmdsynopsis>
59 <command>udevadm test <optional>options</optional> <replaceable>devpath</replaceable></command>
60 </cmdsynopsis>
61 <cmdsynopsis>
62 <command>udevadm test-builtin <optional>options</optional> <replaceable>command</replaceable> <replaceable>devpath</replaceable></command>
63 </cmdsynopsis>
64 </refsynopsisdiv>
65
66 <refsect1><title>Description</title>
67 <para><command>udevadm</command> expects a command and command
68 specific options. It controls the runtime behavior of
69 <command>systemd-udevd</command>, requests kernel events, manages
70 the event queue, and provides simple debugging mechanisms.</para>
71 </refsect1>
72
73 <refsect1><title>Options</title>
74 <variablelist>
75 <varlistentry>
76 <term><option>-d</option></term>
77 <term><option>--debug</option></term>
78 <listitem>
79 <para>Print debug messages to standard error. This option is implied in <command>udevadm test</command> and
80 <command>udevadm test-builtin</command> commands.</para>
81 </listitem>
82 </varlistentry>
83
84 <xi:include href="standard-options.xml" xpointer="help" />
85 </variablelist>
86
87 <refsect2><title>udevadm info
88 <arg choice="opt"><replaceable>options</replaceable></arg>
89 <arg choice="opt"><replaceable>devpath</replaceable>|<replaceable>file</replaceable></arg>
90 </title>
91
92 <para>Queries the udev database for device information
93 stored in the udev database. It can also query the properties
94 of a device from its sysfs representation to help creating udev
95 rules that match this device.</para>
96 <variablelist>
97 <varlistentry>
98 <term><option>-q</option></term>
99 <term><option>--query=<replaceable>TYPE</replaceable></option></term>
100 <listitem>
101 <para>Query the database for the specified type of device
102 data. It needs the <option>--path</option> or
103 <option>--name</option> to identify the specified device.
104 Valid <replaceable>TYPE</replaceable>s are:
105 <constant>name</constant>, <constant>symlink</constant>,
106 <constant>path</constant>, <constant>property</constant>,
107 <constant>all</constant>.</para>
108 </listitem>
109 </varlistentry>
110 <varlistentry>
111 <term><option>-p</option></term>
112 <term><option>--path=<replaceable>DEVPATH</replaceable></option></term>
113 <listitem>
114 <para>The <filename>/sys</filename> path of the device to
115 query, e.g.
116 <filename><optional>/sys</optional>/class/block/sda</filename>.
117 Note that this option usually is not very useful, since
118 <command>udev</command> can guess the type of the
119 argument, so <command>udevadm info
120 --path=/class/block/sda</command> is equivalent to
121 <command>udevadm info /sys/class/block/sda</command>.</para>
122 </listitem>
123 </varlistentry>
124 <varlistentry>
125 <term><option>-n</option></term>
126 <term><option>--name=<replaceable>FILE</replaceable></option></term>
127 <listitem>
128 <para>The name of the device node or a symlink to query,
129 e.g. <filename><optional>/dev</optional>/sda</filename>.
130 Note that this option usually is not very useful, since
131 <command>udev</command> can guess the type of the
132 argument, so <command>udevadm info --name=sda</command> is
133 equivalent to <command>udevadm info /dev/sda</command>.</para>
134 </listitem>
135 </varlistentry>
136 <varlistentry>
137 <term><option>-r</option></term>
138 <term><option>--root</option></term>
139 <listitem>
140 <para>Print absolute paths in <command>name</command> or <command>symlink</command>
141 query.</para>
142 </listitem>
143 </varlistentry>
144 <varlistentry>
145 <term><option>-a</option></term>
146 <term><option>--attribute-walk</option></term>
147 <listitem>
148 <para>Print all sysfs properties of the specified device that can be used
149 in udev rules to match the specified device. It prints all devices
150 along the chain, up to the root of sysfs that can be used in udev rules.</para>
151 </listitem>
152 </varlistentry>
153 <varlistentry>
154 <term><option>-x</option></term>
155 <term><option>--export</option></term>
156 <listitem>
157 <para>Print output as key/value pairs. Values are enclosed in single quotes.</para>
158 </listitem>
159 </varlistentry>
160 <varlistentry>
161 <term><option>-P</option></term>
162 <term><option>--export-prefix=<replaceable>NAME</replaceable></option></term>
163 <listitem>
164 <para>Add a prefix to the key name of exported values.</para>
165 </listitem>
166 </varlistentry>
167 <varlistentry>
168 <term><option>-d</option></term>
169 <term><option>--device-id-of-file=<replaceable>FILE</replaceable></option></term>
170 <listitem>
171 <para>Print major/minor numbers of the underlying device, where the file
172 lives on.</para>
173 </listitem>
174 </varlistentry>
175 <varlistentry>
176 <term><option>-e</option></term>
177 <term><option>--export-db</option></term>
178 <listitem>
179 <para>Export the content of the udev database.</para>
180 </listitem>
181 </varlistentry>
182 <varlistentry>
183 <term><option>-c</option></term>
184 <term><option>--cleanup-db</option></term>
185 <listitem>
186 <para>Cleanup the udev database.</para>
187 </listitem>
188 </varlistentry>
189
190 <xi:include href="standard-options.xml" xpointer="help" />
191 </variablelist>
192
193 <para>In addition, an optional positional argument can be used
194 to specify a device name or a sys path. It must start with
195 <filename>/dev</filename> or <filename>/sys</filename>
196 respectively.</para>
197 </refsect2>
198
199 <refsect2><title>udevadm trigger
200 <arg choice="opt"><replaceable>options</replaceable></arg>
201 <arg choice="opt" rep="repeat"><replaceable>devpath</replaceable>|<replaceable>file</replaceable></arg></title>
202 <para>Request device events from the kernel. Primarily used to replay events at system coldplug time.</para>
203 <variablelist>
204 <varlistentry>
205 <term><option>-v</option></term>
206 <term><option>--verbose</option></term>
207 <listitem>
208 <para>Print the list of devices which will be triggered.</para>
209 </listitem>
210 </varlistentry>
211 <varlistentry>
212 <term><option>-n</option></term>
213 <term><option>--dry-run</option></term>
214 <listitem>
215 <para>Do not actually trigger the event.</para>
216 </listitem>
217 </varlistentry>
218 <varlistentry>
219 <term><option>-t</option></term>
220 <term><option>--type=<replaceable>TYPE</replaceable></option></term>
221 <listitem>
222 <para>Trigger a specific type of devices. Valid types are:
223 <command>devices</command>, <command>subsystems</command>.
224 The default value is <command>devices</command>.</para>
225 </listitem>
226 </varlistentry>
227 <varlistentry>
228 <term><option>-c</option></term>
229 <term><option>--action=<replaceable>ACTION</replaceable></option></term>
230 <listitem>
231 <para>Type of event to be triggered. The default value is
232 <command>change</command>.</para>
233 </listitem>
234 </varlistentry>
235 <varlistentry>
236 <term><option>-s</option></term>
237 <term><option>--subsystem-match=<replaceable>SUBSYSTEM</replaceable></option></term>
238 <listitem>
239 <para>Trigger events for devices which belong to a
240 matching subsystem. This option can be specified multiple
241 times and supports shell style pattern matching.</para>
242 </listitem>
243 </varlistentry>
244 <varlistentry>
245 <term><option>-S</option></term>
246 <term><option>--subsystem-nomatch=<replaceable>SUBSYSTEM</replaceable></option></term>
247 <listitem>
248 <para>Do not trigger events for devices which belong to a matching subsystem. This option
249 can be specified multiple times and supports shell style pattern matching.</para>
250 </listitem>
251 </varlistentry>
252 <varlistentry>
253 <term><option>-a</option></term>
254 <term><option>--attr-match=<replaceable>ATTRIBUTE</replaceable>=<replaceable>VALUE</replaceable></option></term>
255 <listitem>
256 <para>Trigger events for devices with a matching sysfs
257 attribute. If a value is specified along with the
258 attribute name, the content of the attribute is matched
259 against the given value using shell style pattern
260 matching. If no value is specified, the existence of the
261 sysfs attribute is checked. This option can be specified
262 multiple times.</para>
263 </listitem>
264 </varlistentry>
265 <varlistentry>
266 <term><option>-A</option></term>
267 <term><option>--attr-nomatch=<replaceable>ATTRIBUTE</replaceable>=<replaceable>VALUE</replaceable></option></term>
268 <listitem>
269 <para>Do not trigger events for devices with a matching
270 sysfs attribute. If a value is specified along with the
271 attribute name, the content of the attribute is matched
272 against the given value using shell style pattern
273 matching. If no value is specified, the existence of the
274 sysfs attribute is checked. This option can be specified
275 multiple times.</para>
276 </listitem>
277 </varlistentry>
278 <varlistentry>
279 <term><option>-p</option></term>
280 <term><option>--property-match=<replaceable>PROPERTY</replaceable>=<replaceable>VALUE</replaceable></option></term>
281 <listitem>
282 <para>Trigger events for devices with a matching property
283 value. This option can be specified multiple times and
284 supports shell style pattern matching.</para>
285 </listitem>
286 </varlistentry>
287 <varlistentry>
288 <term><option>-g</option></term>
289 <term><option>--tag-match=<replaceable>PROPERTY</replaceable></option></term>
290 <listitem>
291 <para>Trigger events for devices with a matching tag. This
292 option can be specified multiple times.</para>
293 </listitem>
294 </varlistentry>
295 <varlistentry>
296 <term><option>-y</option></term>
297 <term><option>--sysname-match=<replaceable>PATH</replaceable></option></term>
298 <listitem>
299 <para>Trigger events for devices for which the last component
300 (i.e. the filename) of the <filename>/sys</filename> path matches
301 the specified <replaceable>PATH</replaceable>. This option can be
302 specified multiple times and also supports shell style pattern
303 matching.</para>
304 </listitem>
305 </varlistentry>
306 <varlistentry>
307 <term><option>--name-match=<replaceable>NAME</replaceable></option></term>
308 <listitem>
309 <para>Trigger events for devices with a matching
310 device path. This option can be specified multiple
311 times.</para>
312 </listitem>
313 </varlistentry>
314 <varlistentry>
315 <term><option>-b</option></term>
316 <term><option>--parent-match=<replaceable>SYSPATH</replaceable></option></term>
317 <listitem>
318 <para>Trigger events for all children of a given
319 device.</para>
320 </listitem>
321 </varlistentry>
322 <varlistentry>
323 <term><option>-w</option></term>
324 <term><option>--settle</option></term>
325 <listitem>
326 <para>Apart from triggering events, also waits for those events to
327 finish. Note that this is different from calling <command>udevadm
328 settle</command>. <command>udevadm settle</command> waits for all
329 events to finish. This option only waits for events triggered by
330 the same command to finish.</para>
331 </listitem>
332 </varlistentry>
333
334 <xi:include href="standard-options.xml" xpointer="help" />
335 </variablelist>
336
337 <para>In addition, optional positional arguments can be used
338 to specify device names or sys paths. They must start with
339 <filename>/dev</filename> or <filename>/sys</filename>
340 respectively.</para>
341 </refsect2>
342
343 <refsect2><title>udevadm settle
344 <arg choice="opt"><replaceable>options</replaceable></arg>
345 </title>
346 <para>Watches the udev event queue, and exits if all current events are handled.</para>
347 <variablelist>
348 <varlistentry>
349 <term><option>-t</option></term>
350 <term><option>--timeout=<replaceable>SECONDS</replaceable></option></term>
351 <listitem>
352 <para>Maximum number of seconds to wait for the event
353 queue to become empty. The default value is 120 seconds. A
354 value of 0 will check if the queue is empty and always
355 return immediately.</para>
356 </listitem>
357 </varlistentry>
358 <varlistentry>
359 <term><option>-E</option></term>
360 <term><option>--exit-if-exists=<replaceable>FILE</replaceable></option></term>
361 <listitem>
362 <para>Stop waiting if file exists.</para>
363 </listitem>
364 </varlistentry>
365
366 <xi:include href="standard-options.xml" xpointer="help" />
367 </variablelist>
368 </refsect2>
369
370 <refsect2><title>udevadm control <replaceable>option</replaceable></title>
371 <para>Modify the internal state of the running udev daemon.</para>
372 <variablelist>
373 <varlistentry>
374 <term><option>-e</option></term>
375 <term><option>--exit</option></term>
376 <listitem>
377 <para>Signal and wait for systemd-udevd to exit.</para>
378 </listitem>
379 </varlistentry>
380 <varlistentry>
381 <term><option>-l</option></term>
382 <term><option>--log-priority=<replaceable>value</replaceable></option></term>
383 <listitem>
384 <para>Set the internal log level of
385 <filename>systemd-udevd</filename>. Valid values are the
386 numerical syslog priorities or their textual
387 representations: <option>emerg</option>,
388 <option>alert</option>, <option>crit</option>,
389 <option>err</option>, <option>warning</option>,
390 <option>notice</option>, <option>info</option>, and
391 <option>debug</option>.</para>
392 </listitem>
393 </varlistentry>
394 <varlistentry>
395 <term><option>-s</option></term>
396 <term><option>--stop-exec-queue</option></term>
397 <listitem>
398 <para>Signal systemd-udevd to stop executing new events. Incoming events
399 will be queued.</para>
400 </listitem>
401 </varlistentry>
402 <varlistentry>
403 <term><option>-S</option></term>
404 <term><option>--start-exec-queue</option></term>
405 <listitem>
406 <para>Signal systemd-udevd to enable the execution of events.</para>
407 </listitem>
408 </varlistentry>
409 <varlistentry>
410 <term><option>-R</option></term>
411 <term><option>--reload</option></term>
412 <listitem>
413 <para>Signal systemd-udevd to reload the rules files and other databases like the kernel
414 module index. Reloading rules and databases does not apply any changes to already
415 existing devices; the new configuration will only be applied to new events.</para>
416 </listitem>
417 </varlistentry>
418 <varlistentry>
419 <term><option>-p</option></term>
420 <term><option>--property=<replaceable>KEY</replaceable>=<replaceable>value</replaceable></option></term>
421 <listitem>
422 <para>Set a global property for all events.</para>
423 </listitem>
424 </varlistentry>
425 <varlistentry>
426 <term><option>-m</option></term>
427 <term><option>--children-max=</option><replaceable>value</replaceable></term>
428 <listitem>
429 <para>Set the maximum number of events, systemd-udevd will handle at the
430 same time.</para>
431 </listitem>
432 </varlistentry>
433 <varlistentry>
434 <term><option>-t</option></term>
435 <term><option>--timeout=</option><replaceable>seconds</replaceable></term>
436 <listitem>
437 <para>The maximum number of seconds to wait for a reply from systemd-udevd.</para>
438 </listitem>
439 </varlistentry>
440
441 <xi:include href="standard-options.xml" xpointer="help" />
442 </variablelist>
443 </refsect2>
444
445 <refsect2><title>udevadm monitor
446 <arg choice="opt"><replaceable>options</replaceable></arg>
447 </title>
448 <para>Listens to the kernel uevents and events sent out by a udev rule
449 and prints the devpath of the event to the console. It can be used to analyze the
450 event timing, by comparing the timestamps of the kernel uevent and the udev event.
451 </para>
452 <variablelist>
453 <varlistentry>
454 <term><option>-k</option></term>
455 <term><option>--kernel</option></term>
456 <listitem>
457 <para>Print the kernel uevents.</para>
458 </listitem>
459 </varlistentry>
460 <varlistentry>
461 <term><option>-u</option></term>
462 <term><option>--udev</option></term>
463 <listitem>
464 <para>Print the udev event after the rule processing.</para>
465 </listitem>
466 </varlistentry>
467 <varlistentry>
468 <term><option>-p</option></term>
469 <term><option>--property</option></term>
470 <listitem>
471 <para>Also print the properties of the event.</para>
472 </listitem>
473 </varlistentry>
474 <varlistentry>
475 <term><option>-s</option></term>
476 <term><option>--subsystem-match=<replaceable>string[/string]</replaceable></option></term>
477 <listitem>
478 <para>Filter kernel uevents and udev events by subsystem[/devtype]. Only events with a matching subsystem value will pass.</para>
479 </listitem>
480 </varlistentry>
481 <varlistentry>
482 <term><option>-t</option></term>
483 <term><option>--tag-match=<replaceable>string</replaceable></option></term>
484 <listitem>
485 <para>Filter udev events by tag. Only udev events with a given tag attached will pass.</para>
486 </listitem>
487 </varlistentry>
488
489 <xi:include href="standard-options.xml" xpointer="help" />
490 </variablelist>
491 </refsect2>
492
493 <refsect2><title>udevadm test
494 <arg choice="opt"><replaceable>options</replaceable></arg>
495 <arg><replaceable>devpath</replaceable></arg>
496 </title>
497 <para>Simulate a udev event run for the given device, and print debug output.</para>
498 <variablelist>
499 <varlistentry>
500 <term><option>-a</option></term>
501 <term><option>--action=<replaceable>string</replaceable></option></term>
502 <listitem>
503 <para>The action string.</para>
504 </listitem>
505 </varlistentry>
506 <varlistentry>
507 <term><option>-N</option></term>
508 <term><option>--resolve-names=<constant>early</constant>|<constant>late</constant>|<constant>never</constant></option></term>
509 <listitem>
510 <para>Specify when udevadm should resolve names of users
511 and groups. When set to <constant>early</constant> (the
512 default), names will be resolved when the rules are
513 parsed. When set to <constant>late</constant>, names will
514 be resolved for every event. When set to
515 <constant>never</constant>, names will never be resolved
516 and all devices will be owned by root.</para>
517 </listitem>
518 </varlistentry>
519
520 <xi:include href="standard-options.xml" xpointer="help" />
521 </variablelist>
522 </refsect2>
523
524 <refsect2><title>udevadm test-builtin
525 <arg choice="opt"><replaceable>options</replaceable></arg>
526 <arg><replaceable>command</replaceable></arg>
527 <arg><replaceable>devpath</replaceable></arg>
528 </title>
529 <para>Run a built-in command <replaceable>COMMAND</replaceable>
530 for device <replaceable>DEVPATH</replaceable>, and print debug
531 output.</para>
532 <variablelist>
533 <xi:include href="standard-options.xml" xpointer="help" />
534 </variablelist>
535 </refsect2>
536 </refsect1>
537
538 <refsect1>
539 <title>See Also</title>
540 <para><citerefentry>
541 <refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum>
542 </citerefentry>,
543 <citerefentry>
544 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
545 </citerefentry></para>
546 </refsect1>
547 </refentry>