chiark / gitweb /
bus: always explicitly close bus from main programs
[elogind.git] / man / udevadm.xml
1 <?xml version='1.0'?>
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 <optional><replaceable>OPTIONS</replaceable></optional> <optional><replaceable>DEVPATH</replaceable>|<replaceable>FILE</replaceable></optional></title>
93       <para>Queries the udev database for device information
94       stored in the udev database. It can also query the properties
95       of a device from its sysfs representation to help creating udev
96       rules that match this device.</para>
97       <variablelist>
98         <varlistentry>
99           <term><option>-q</option></term>
100           <term><option>--query=<replaceable>TYPE</replaceable></option></term>
101           <listitem>
102             <para>Query the database for the specified type of device
103             data. It needs the <option>--path</option> or
104             <option>--name</option> to identify the specified device.
105             Valid <replaceable>TYPE</replaceable>s are:
106             <constant>name</constant>, <constant>symlink</constant>,
107             <constant>path</constant>, <constant>property</constant>,
108             <constant>all</constant>.</para>
109           </listitem>
110         </varlistentry>
111         <varlistentry>
112           <term><option>-p</option></term>
113           <term><option>--path=<replaceable>DEVPATH</replaceable></option></term>
114           <listitem>
115             <para>The <filename>/sys</filename> path of the device to
116             query, e.g.
117             <filename><optional>/sys</optional>/class/block/sda</filename>.
118             Note that this option usually is not very useful, since
119             <command>udev</command> can guess the type of the
120             argument, so <command>udevadm
121             --devpath=/class/block/sda</command> is equivalent to
122             <command>udevadm /sys/class/block/sda</command>.</para>
123           </listitem>
124         </varlistentry>
125         <varlistentry>
126           <term><option>-n</option></term>
127           <term><option>--name=<replaceable>FILE</replaceable></option></term>
128           <listitem>
129             <para>The name of the device node or a symlink to query,
130             e.g. <filename><optional>/dev</optional>/sda</filename>.
131             Note that this option usually is not very useful, since
132             <command>udev</command> can guess the type of the
133             argument, so <command>udevadm --name=sda</command> is
134             equivalent to <command>udevadm /dev/sda</command>.</para>
135           </listitem>
136         </varlistentry>
137         <varlistentry>
138           <term><option>-r</option></term>
139           <term><option>--root</option></term>
140           <listitem>
141             <para>Print absolute paths in <command>name</command> or <command>symlink</command>
142             query.</para>
143           </listitem>
144         </varlistentry>
145         <varlistentry>
146           <term><option>-a</option></term>
147           <term><option>--attribute-walk</option></term>
148           <listitem>
149             <para>Print all sysfs properties of the specified device that can be used
150             in udev rules to match the specified device. It prints all devices
151             along the chain, up to the root of sysfs that can be used in udev rules.</para>
152           </listitem>
153         </varlistentry>
154         <varlistentry>
155           <term><option>-x</option></term>
156           <term><option>--export</option></term>
157           <listitem>
158             <para>Print output as key/value pairs. Values are enclosed in single quotes.</para>
159           </listitem>
160         </varlistentry>
161         <varlistentry>
162           <term><option>-P</option></term>
163           <term><option>--export-prefix=<replaceable>NAME</replaceable></option></term>
164           <listitem>
165             <para>Add a prefix to the key name of exported values.</para>
166           </listitem>
167         </varlistentry>
168         <varlistentry>
169           <term><option>-d</option></term>
170           <term><option>--device-id-of-file=<replaceable>FILE</replaceable></option></term>
171           <listitem>
172             <para>Print major/minor numbers of the underlying device, where the file
173             lives on.</para>
174           </listitem>
175         </varlistentry>
176         <varlistentry>
177           <term><option>-e</option></term>
178           <term><option>--export-db</option></term>
179           <listitem>
180             <para>Export the content of the udev database.</para>
181           </listitem>
182         </varlistentry>
183         <varlistentry>
184           <term><option>-c</option></term>
185           <term><option>--cleanup-db</option></term>
186           <listitem>
187             <para>Cleanup the udev database.</para>
188           </listitem>
189         </varlistentry>
190         <varlistentry>
191           <term><option>--version</option></term>
192           <listitem>
193             <para>Print version.</para>
194           </listitem>
195         </varlistentry>
196         <varlistentry>
197           <term><option>-h</option></term>
198           <term><option>--help</option></term>
199           <listitem>
200             <para>Print help text.</para>
201           </listitem>
202         </varlistentry>
203       </variablelist>
204     </refsect2>
205
206     <refsect2><title>udevadm trigger <optional>options</optional></title>
207       <para>Request device events from the kernel. Primarily used to replay events at system coldplug time.</para>
208       <variablelist>
209         <varlistentry>
210           <term><option>-v</option></term>
211           <term><option>--verbose</option></term>
212           <listitem>
213             <para>Print the list of devices which will be triggered.</para>
214           </listitem>
215         </varlistentry>
216         <varlistentry>
217           <term><option>-n</option></term>
218           <term><option>--dry-run</option></term>
219           <listitem>
220             <para>Do not actually trigger the event.</para>
221           </listitem>
222         </varlistentry>
223         <varlistentry>
224           <term><option>-t</option></term>
225           <term><option>--type=<replaceable>TYPE</replaceable></option></term>
226           <listitem>
227             <para>Trigger a specific type of devices. Valid types are:
228             <command>devices</command>, <command>subsystems</command>.
229             The default value is <command>devices</command>.</para>
230           </listitem>
231         </varlistentry>
232         <varlistentry>
233           <term><option>-c</option></term>
234           <term><option>--action=<replaceable>ACTION</replaceable></option></term>
235           <listitem>
236             <para>Type of event to be triggered. The default value is
237             <command>change</command>.</para>
238           </listitem>
239         </varlistentry>
240         <varlistentry>
241           <term><option>-s</option></term>
242           <term><option>--subsystem-match=<replaceable>SUBSYSTEM</replaceable></option></term>
243           <listitem>
244             <para>Trigger events for devices which belong to a
245             matching subsystem. This option can be specified multiple
246             times and supports shell style pattern matching.</para>
247           </listitem>
248         </varlistentry>
249         <varlistentry>
250           <term><option>-S</option></term>
251           <term><option>--subsystem-nomatch=<replaceable>SUBSYSTEM</replaceable></option></term>
252           <listitem>
253             <para>Do not trigger events for devices which belong to a matching subsystem. This option
254             can be specified multiple times and supports shell style pattern matching.</para>
255           </listitem>
256         </varlistentry>
257         <varlistentry>
258           <term><option>-a</option></term>
259           <term><option>--attr-match=<replaceable>ATTRIBUTE</replaceable>=<replaceable>VALUE</replaceable></option></term>
260           <listitem>
261             <para>Trigger events for devices with a matching sysfs
262             attribute. If a value is specified along with the
263             attribute name, the content of the attribute is matched
264             against the given value using shell style pattern
265             matching. If no value is specified, the existence of the
266             sysfs attribute is checked. This option can be specified
267             multiple times.</para>
268           </listitem>
269         </varlistentry>
270         <varlistentry>
271           <term><option>-A</option></term>
272           <term><option>--attr-nomatch=<replaceable>ATTRIBUTE</replaceable>=<replaceable>VALUE</replaceable></option></term>
273           <listitem>
274             <para>Do not trigger events for devices with a matching
275             sysfs attribute. If a value is specified along with the
276             attribute name, the content of the attribute is matched
277             against the given value using shell style pattern
278             matching. If no value is specified, the existence of the
279             sysfs attribute is checked. This option can be specified
280             multiple times.</para>
281           </listitem>
282         </varlistentry>
283         <varlistentry>
284           <term><option>-p</option></term>
285           <term><option>--property-match=<replaceable>PROPERTY</replaceable>=<replaceable>VALUE</replaceable></option></term>
286           <listitem>
287             <para>Trigger events for devices with a matching property
288             value. This option can be specified multiple times and
289             supports shell style pattern matching.</para>
290           </listitem>
291         </varlistentry>
292         <varlistentry>
293           <term><option>-g</option></term>
294           <term><option>--tag-match=<replaceable>PROPERTY</replaceable></option></term>
295           <listitem>
296             <para>Trigger events for devices with a matching tag. This
297             option can be specified multiple times.</para>
298           </listitem>
299         </varlistentry>
300         <varlistentry>
301           <term><option>-y</option></term>
302           <term><option>--sysname-match=<replaceable>NAME</replaceable></option></term>
303           <listitem>
304             <para>Trigger events for devices with a matching sys
305             device name. This option can be specified multiple times
306             and supports shell style pattern matching.</para>
307           </listitem>
308         </varlistentry>
309         <varlistentry>
310           <term><option>-b</option></term>
311           <term><option>--parent-match=<replaceable>SYSPATH</replaceable></option></term>
312           <listitem>
313             <para>Trigger events for all children of a given
314             device.</para>
315           </listitem>
316         </varlistentry>
317         <varlistentry>
318           <term><option>-h</option></term>
319           <term><option>--help</option></term>
320           <listitem>
321             <para>Print help text.</para>
322           </listitem>
323         </varlistentry>
324       </variablelist>
325     </refsect2>
326
327     <refsect2><title>udevadm settle <optional>options</optional></title>
328       <para>Watches the udev event queue, and exits if all current events are handled.</para>
329       <variablelist>
330         <varlistentry>
331           <term><option>-t</option></term>
332           <term><option>--timeout=<replaceable>SECONDS</replaceable></option></term>
333           <listitem>
334             <para>Maximum number of seconds to wait for the event
335             queue to become empty. The default value is 120 seconds. A
336             value of 0 will check if the queue is empty and always
337             return immediately.</para>
338           </listitem>
339         </varlistentry>
340         <varlistentry>
341           <term><option>-E</option></term>
342           <term><option>--exit-if-exists=<replaceable>FILE</replaceable></option></term>
343           <listitem>
344             <para>Stop waiting if file exists.</para>
345           </listitem>
346         </varlistentry>
347         <varlistentry>
348           <term><option>-h</option></term>
349           <term><option>--help</option></term>
350           <listitem>
351             <para>Print help text.</para>
352           </listitem>
353         </varlistentry>
354       </variablelist>
355     </refsect2>
356
357     <refsect2><title>udevadm control <replaceable>command</replaceable></title>
358       <para>Modify the internal state of the running udev daemon.</para>
359       <variablelist>
360         <varlistentry>
361           <term><option>-x</option></term>
362           <term><option>--exit</option></term>
363           <listitem>
364             <para>Signal and wait for systemd-udevd to exit.</para>
365           </listitem>
366         </varlistentry>
367         <varlistentry>
368           <term><option>-l</option></term>
369           <term><option>--log-priority=<replaceable>value</replaceable></option></term>
370           <listitem>
371             <para>Set the internal log level of systemd-udevd. Valid values are the numerical
372             syslog priorities or their textual representations: <option>err</option>,
373             <option>info</option> and <option>debug</option>.</para>
374           </listitem>
375         </varlistentry>
376         <varlistentry>
377           <term><option>-s</option></term>
378           <term><option>--stop-exec-queue</option></term>
379           <listitem>
380             <para>Signal systemd-udevd to stop executing new events. Incoming events
381             will be queued.</para>
382           </listitem>
383         </varlistentry>
384         <varlistentry>
385           <term><option>-S</option></term>
386           <term><option>--start-exec-queue</option></term>
387           <listitem>
388             <para>Signal systemd-udevd to enable the execution of events.</para>
389           </listitem>
390         </varlistentry>
391         <varlistentry>
392           <term><option>-R</option></term>
393           <term><option>--reload</option></term>
394           <listitem>
395             <para>Signal systemd-udevd to reload the rules files and other databases like the kernel
396             module index. Reloading rules and databases does not apply any changes to already
397             existing devices; the new configuration will only be applied to new events.</para>
398           </listitem>
399         </varlistentry>
400         <varlistentry>
401           <term><option>-p</option></term>
402           <term><option>--property=<replaceable>KEY</replaceable>=<replaceable>value</replaceable></option></term>
403           <listitem>
404             <para>Set a global property for all events.</para>
405           </listitem>
406         </varlistentry>
407         <varlistentry>
408           <term><option>-m</option></term>
409           <term><option>--children-max=</option><replaceable>value</replaceable></term>
410           <listitem>
411             <para>Set the maximum number of events, systemd-udevd will handle at the
412             same time.</para>
413           </listitem>
414         </varlistentry>
415         <varlistentry>
416           <term><option>--timeout=</option><replaceable>seconds</replaceable></term>
417           <listitem>
418             <para>The maximum number of seconds to wait for a reply from systemd-udevd.</para>
419           </listitem>
420         </varlistentry>
421         <varlistentry>
422           <term><option>-h</option></term>
423           <term><option>--help</option></term>
424           <listitem>
425             <para>Print help text.</para>
426           </listitem>
427         </varlistentry>
428       </variablelist>
429     </refsect2>
430
431     <refsect2><title>udevadm monitor <optional>options</optional></title>
432       <para>Listens to the kernel uevents and events sent out by a udev rule
433       and prints the devpath of the event to the console. It can be used to analyze the
434       event timing, by comparing the timestamps of the kernel uevent and the udev event.
435       </para>
436       <variablelist>
437         <varlistentry>
438           <term><option>-k</option></term>
439           <term><option>--kernel</option></term>
440           <listitem>
441             <para>Print the kernel uevents.</para>
442           </listitem>
443         </varlistentry>
444         <varlistentry>
445           <term><option>-u</option></term>
446           <term><option>--udev</option></term>
447           <listitem>
448             <para>Print the udev event after the rule processing.</para>
449           </listitem>
450         </varlistentry>
451         <varlistentry>
452           <term><option>-p</option></term>
453           <term><option>--property</option></term>
454           <listitem>
455             <para>Also print the properties of the event.</para>
456           </listitem>
457         </varlistentry>
458         <varlistentry>
459           <term><option>-s</option></term>
460           <term><option>--subsystem-match=<replaceable>string[/string]</replaceable></option></term>
461           <listitem>
462             <para>Filter events by subsystem[/devtype]. Only udev events with a matching subsystem value will pass.</para>
463           </listitem>
464         </varlistentry>
465         <varlistentry>
466           <term><option>-t</option></term>
467           <term><option>--tag-match=<replaceable>string</replaceable></option></term>
468           <listitem>
469             <para>Filter events by property. Only udev events with a given tag attached will pass.</para>
470           </listitem>
471         </varlistentry>
472         <varlistentry>
473           <term><option>-h</option></term>
474           <term><option>--help</option></term>
475           <listitem>
476             <para>Print help text.</para>
477           </listitem>
478         </varlistentry>
479       </variablelist>
480     </refsect2>
481
482     <refsect2><title>udevadm hwdb <optional>options</optional></title>
483       <para>Maintain the hardware database index in <filename>/etc/udev/hwdb.bin</filename>.</para>
484       <variablelist>
485         <varlistentry>
486           <term><option>-u</option></term>
487           <term><option>--update</option></term>
488           <listitem>
489             <para>Compile the hardware database information located in /usr/lib/udev/hwdb.d/,
490             /etc/udev/hwdb.d/ and store it in <filename>/etc/udev/hwdb.bin</filename>. This should be done after
491             any update to the source files; it will not be called automatically. The running
492             udev daemon will detect a new database on its own and does not need to be
493             notified about it.</para>
494           </listitem>
495         </varlistentry>
496         <varlistentry>
497           <term><option>-t</option></term>
498           <term><option>--test=<replaceable>string</replaceable></option></term>
499           <listitem>
500             <para>Query the database with a modalias string, and print the
501             retrieved properties.</para>
502           </listitem>
503         </varlistentry>
504         <varlistentry>
505           <term><option>-r</option></term>
506           <term><option>--root=<replaceable>string</replaceable></option></term>
507           <listitem>
508             <para>Alternative root path in the file system for reading and writing files.</para>
509           </listitem>
510         </varlistentry>
511         <varlistentry>
512           <term><option>-h</option></term>
513           <term><option>--help</option></term>
514           <listitem>
515             <para>Print help text.</para>
516           </listitem>
517         </varlistentry>
518       </variablelist>
519     </refsect2>
520
521     <refsect2><title>udevadm test <optional>options</optional> <replaceable>devpath</replaceable></title>
522       <para>Simulate a udev event run for the given device, and print debug output.</para>
523       <variablelist>
524         <varlistentry>
525           <term><option>-a</option></term>
526           <term><option>--action=<replaceable>string</replaceable></option></term>
527           <listitem>
528             <para>The action string.</para>
529           </listitem>
530         </varlistentry>
531         <varlistentry>
532           <term><option>-N</option></term>
533           <term><option>--resolve-names=<constant>early</constant>|<constant>late</constant>|<constant>never</constant></option></term>
534           <listitem>
535             <para>Specify when udevadm should resolve names of users
536             and groups.  When set to <constant>early</constant> (the
537             default), names will be resolved when the rules are
538             parsed. When set to <constant>late</constant>, names will
539             be resolved for every event. When set to
540             <constant>never</constant>, names will never be resolved
541             and all devices will be owned by root.</para>
542           </listitem>
543         </varlistentry>
544         <varlistentry>
545           <term><option>-h</option></term>
546           <term><option>--help</option></term>
547           <listitem>
548             <para>Print help text.</para>
549           </listitem>
550         </varlistentry>
551       </variablelist>
552     </refsect2>
553
554     <refsect2><title>udevadm test-builtin <optional>options</optional> <replaceable>COMMAND</replaceable> <replaceable>DEVPATH</replaceable></title>
555       <para>Run a built-in command <replaceable>COMMAND</replaceable>
556       for device <replaceable>DEVPATH</replaceable>, and print debug
557       output.</para>
558       <variablelist>
559         <varlistentry>
560           <term><option>-h</option></term>
561           <term><option>--help</option></term>
562           <listitem>
563             <para>Print help text.</para>
564           </listitem>
565         </varlistentry>
566       </variablelist>
567     </refsect2>
568   </refsect1>
569
570   <refsect1>
571     <title>See Also</title>
572     <para><citerefentry>
573         <refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum>
574     </citerefentry>,
575     <citerefentry>
576         <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
577     </citerefentry></para>
578   </refsect1>
579 </refentry>