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