]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/udevadm.xml
test-execute: Add tests for new PassEnvironment= directive
[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 <refentry id="udevadm">
6 <refentryinfo>
7 <title>udevadm</title>
8 <productname>systemd</productname>
9 <authorgroup>
10 <author>
11 <contrib>Developer</contrib>
12 <firstname>Kay</firstname>
13 <surname>Sievers</surname>
14 <email>kay@vrfy.org</email>
15 </author>
16 </authorgroup>
17 </refentryinfo>
18
19 <refmeta>
20 <refentrytitle>udevadm</refentrytitle>
21 <manvolnum>8</manvolnum>
22 </refmeta>
23
24 <refnamediv>
25 <refname>udevadm</refname><refpurpose>udev management tool</refpurpose>
26 </refnamediv>
27
28 <refsynopsisdiv>
29 <cmdsynopsis>
30 <command>udevadm</command>
31 <arg><option>--debug</option></arg>
32 <arg><option>--version</option></arg>
33 <arg><option>--help</option></arg>
34 </cmdsynopsis>
35 <cmdsynopsis>
36 <command>udevadm info <replaceable>options</replaceable></command>
37 </cmdsynopsis>
38 <cmdsynopsis>
39 <command>udevadm trigger <optional>options</optional></command>
40 </cmdsynopsis>
41 <cmdsynopsis>
42 <command>udevadm settle <optional>options</optional></command>
43 </cmdsynopsis>
44 <cmdsynopsis>
45 <command>udevadm control <replaceable>command</replaceable></command>
46 </cmdsynopsis>
47 <cmdsynopsis>
48 <command>udevadm monitor <optional>options</optional></command>
49 </cmdsynopsis>
50 <cmdsynopsis>
51 <command>udevadm test <optional>options</optional> <replaceable>devpath</replaceable></command>
52 </cmdsynopsis>
53 <cmdsynopsis>
54 <command>udevadm test-builtin <optional>options</optional> <replaceable>command</replaceable> <replaceable>devpath</replaceable></command>
55 </cmdsynopsis>
56 </refsynopsisdiv>
57
58 <refsect1><title>Description</title>
59 <para><command>udevadm</command> expects a command and command
60 specific options. It controls the runtime behavior of
61 <command>systemd-udevd</command>, requests kernel events, manages
62 the event queue, and provides simple debugging mechanisms.</para>
63 </refsect1>
64
65 <refsect1><title>Options</title>
66 <variablelist>
67 <varlistentry>
68 <term><option>--debug</option></term>
69 <listitem>
70 <para>Print debug messages to standard error.</para>
71 </listitem>
72 </varlistentry>
73 <varlistentry>
74 <term><option>--version</option></term>
75 <listitem>
76 <para>Print version number.</para>
77 </listitem>
78 </varlistentry>
79 <varlistentry>
80 <term><option>-h</option></term>
81 <term><option>--help</option></term>
82 <listitem>
83 <para>Print help text.</para>
84 </listitem>
85 </varlistentry>
86 </variablelist>
87
88 <refsect2><title>udevadm info
89 <arg choice="opt"><replaceable>options</replaceable></arg>
90 <arg choice="opt"><replaceable>devpath</replaceable>|<replaceable>file</replaceable></arg>
91 </title>
92
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
205 <para>In addition, an optional positional argument can be used
206 to specify a device name or a sys path. It must start with
207 <filename>/dev</filename> or <filename>/sys</filename>
208 respectively.</para>
209 </refsect2>
210
211 <refsect2><title>udevadm trigger
212 <arg choice="opt"><replaceable>options</replaceable></arg>
213 <arg choice="opt" rep="repeat"><replaceable>devpath</replaceable>|<replaceable>file</replaceable></arg></title>
214 <para>Request device events from the kernel. Primarily used to replay events at system coldplug time.</para>
215 <variablelist>
216 <varlistentry>
217 <term><option>-v</option></term>
218 <term><option>--verbose</option></term>
219 <listitem>
220 <para>Print the list of devices which will be triggered.</para>
221 </listitem>
222 </varlistentry>
223 <varlistentry>
224 <term><option>-n</option></term>
225 <term><option>--dry-run</option></term>
226 <listitem>
227 <para>Do not actually trigger the event.</para>
228 </listitem>
229 </varlistentry>
230 <varlistentry>
231 <term><option>-t</option></term>
232 <term><option>--type=<replaceable>TYPE</replaceable></option></term>
233 <listitem>
234 <para>Trigger a specific type of devices. Valid types are:
235 <command>devices</command>, <command>subsystems</command>.
236 The default value is <command>devices</command>.</para>
237 </listitem>
238 </varlistentry>
239 <varlistentry>
240 <term><option>-c</option></term>
241 <term><option>--action=<replaceable>ACTION</replaceable></option></term>
242 <listitem>
243 <para>Type of event to be triggered. The default value is
244 <command>change</command>.</para>
245 </listitem>
246 </varlistentry>
247 <varlistentry>
248 <term><option>-s</option></term>
249 <term><option>--subsystem-match=<replaceable>SUBSYSTEM</replaceable></option></term>
250 <listitem>
251 <para>Trigger events for devices which belong to a
252 matching subsystem. This option can be specified multiple
253 times and supports shell style pattern matching.</para>
254 </listitem>
255 </varlistentry>
256 <varlistentry>
257 <term><option>-S</option></term>
258 <term><option>--subsystem-nomatch=<replaceable>SUBSYSTEM</replaceable></option></term>
259 <listitem>
260 <para>Do not trigger events for devices which belong to a matching subsystem. This option
261 can be specified multiple times and supports shell style pattern matching.</para>
262 </listitem>
263 </varlistentry>
264 <varlistentry>
265 <term><option>-a</option></term>
266 <term><option>--attr-match=<replaceable>ATTRIBUTE</replaceable>=<replaceable>VALUE</replaceable></option></term>
267 <listitem>
268 <para>Trigger events for devices with a matching sysfs
269 attribute. If a value is specified along with the
270 attribute name, the content of the attribute is matched
271 against the given value using shell style pattern
272 matching. If no value is specified, the existence of the
273 sysfs attribute is checked. This option can be specified
274 multiple times.</para>
275 </listitem>
276 </varlistentry>
277 <varlistentry>
278 <term><option>-A</option></term>
279 <term><option>--attr-nomatch=<replaceable>ATTRIBUTE</replaceable>=<replaceable>VALUE</replaceable></option></term>
280 <listitem>
281 <para>Do not trigger events for devices with a matching
282 sysfs attribute. If a value is specified along with the
283 attribute name, the content of the attribute is matched
284 against the given value using shell style pattern
285 matching. If no value is specified, the existence of the
286 sysfs attribute is checked. This option can be specified
287 multiple times.</para>
288 </listitem>
289 </varlistentry>
290 <varlistentry>
291 <term><option>-p</option></term>
292 <term><option>--property-match=<replaceable>PROPERTY</replaceable>=<replaceable>VALUE</replaceable></option></term>
293 <listitem>
294 <para>Trigger events for devices with a matching property
295 value. This option can be specified multiple times and
296 supports shell style pattern matching.</para>
297 </listitem>
298 </varlistentry>
299 <varlistentry>
300 <term><option>-g</option></term>
301 <term><option>--tag-match=<replaceable>PROPERTY</replaceable></option></term>
302 <listitem>
303 <para>Trigger events for devices with a matching tag. This
304 option can be specified multiple times.</para>
305 </listitem>
306 </varlistentry>
307 <varlistentry>
308 <term><option>-y</option></term>
309 <term><option>--sysname-match=<replaceable>PATH</replaceable></option></term>
310 <listitem>
311 <para>Trigger events for devices with a matching sys
312 device path. This option can be specified multiple times
313 and supports shell style pattern matching.</para>
314 </listitem>
315 </varlistentry>
316 <varlistentry>
317 <term><option>--name-match=<replaceable>NAME</replaceable></option></term>
318 <listitem>
319 <para>Trigger events for devices with a matching
320 device path. This option can be specified multiple
321 times.</para>
322 </listitem>
323 </varlistentry>
324 <varlistentry>
325 <term><option>-b</option></term>
326 <term><option>--parent-match=<replaceable>SYSPATH</replaceable></option></term>
327 <listitem>
328 <para>Trigger events for all children of a given
329 device.</para>
330 </listitem>
331 </varlistentry>
332 <varlistentry>
333 <term><option>-h</option></term>
334 <term><option>--help</option></term>
335 <listitem>
336 <para>Print help text.</para>
337 </listitem>
338 </varlistentry>
339 </variablelist>
340
341 <para>In addition, optional positional arguments can be used
342 to specify device names or sys paths. They must start with
343 <filename>/dev</filename> or <filename>/sys</filename>
344 respectively.</para>
345 </refsect2>
346
347 <refsect2><title>udevadm settle
348 <arg choice="opt"><replaceable>options</replaceable></arg>
349 </title>
350 <para>Watches the udev event queue, and exits if all current events are handled.</para>
351 <variablelist>
352 <varlistentry>
353 <term><option>-t</option></term>
354 <term><option>--timeout=<replaceable>SECONDS</replaceable></option></term>
355 <listitem>
356 <para>Maximum number of seconds to wait for the event
357 queue to become empty. The default value is 120 seconds. A
358 value of 0 will check if the queue is empty and always
359 return immediately.</para>
360 </listitem>
361 </varlistentry>
362 <varlistentry>
363 <term><option>-E</option></term>
364 <term><option>--exit-if-exists=<replaceable>FILE</replaceable></option></term>
365 <listitem>
366 <para>Stop waiting if file exists.</para>
367 </listitem>
368 </varlistentry>
369 <varlistentry>
370 <term><option>-h</option></term>
371 <term><option>--help</option></term>
372 <listitem>
373 <para>Print help text.</para>
374 </listitem>
375 </varlistentry>
376 </variablelist>
377 </refsect2>
378
379 <refsect2><title>udevadm control <replaceable>command</replaceable></title>
380 <para>Modify the internal state of the running udev daemon.</para>
381 <variablelist>
382 <varlistentry>
383 <term><option>-x</option></term>
384 <term><option>--exit</option></term>
385 <listitem>
386 <para>Signal and wait for systemd-udevd to exit.</para>
387 </listitem>
388 </varlistentry>
389 <varlistentry>
390 <term><option>-l</option></term>
391 <term><option>--log-priority=<replaceable>value</replaceable></option></term>
392 <listitem>
393 <para>Set the internal log level of
394 <filename>systemd-udevd</filename>. Valid values are the
395 numerical syslog priorities or their textual
396 representations: <option>emerg</option>,
397 <option>alert</option>, <option>crit</option>,
398 <option>err</option>, <option>warning</option>,
399 <option>notice</option>, <option>info</option>, and
400 <option>debug</option>.</para>
401 </listitem>
402 </varlistentry>
403 <varlistentry>
404 <term><option>-s</option></term>
405 <term><option>--stop-exec-queue</option></term>
406 <listitem>
407 <para>Signal systemd-udevd to stop executing new events. Incoming events
408 will be queued.</para>
409 </listitem>
410 </varlistentry>
411 <varlistentry>
412 <term><option>-S</option></term>
413 <term><option>--start-exec-queue</option></term>
414 <listitem>
415 <para>Signal systemd-udevd to enable the execution of events.</para>
416 </listitem>
417 </varlistentry>
418 <varlistentry>
419 <term><option>-R</option></term>
420 <term><option>--reload</option></term>
421 <listitem>
422 <para>Signal systemd-udevd to reload the rules files and other databases like the kernel
423 module index. Reloading rules and databases does not apply any changes to already
424 existing devices; the new configuration will only be applied to new events.</para>
425 </listitem>
426 </varlistentry>
427 <varlistentry>
428 <term><option>-p</option></term>
429 <term><option>--property=<replaceable>KEY</replaceable>=<replaceable>value</replaceable></option></term>
430 <listitem>
431 <para>Set a global property for all events.</para>
432 </listitem>
433 </varlistentry>
434 <varlistentry>
435 <term><option>-m</option></term>
436 <term><option>--children-max=</option><replaceable>value</replaceable></term>
437 <listitem>
438 <para>Set the maximum number of events, systemd-udevd will handle at the
439 same time.</para>
440 </listitem>
441 </varlistentry>
442 <varlistentry>
443 <term><option>--timeout=</option><replaceable>seconds</replaceable></term>
444 <listitem>
445 <para>The maximum number of seconds to wait for a reply from systemd-udevd.</para>
446 </listitem>
447 </varlistentry>
448 <varlistentry>
449 <term><option>-h</option></term>
450 <term><option>--help</option></term>
451 <listitem>
452 <para>Print help text.</para>
453 </listitem>
454 </varlistentry>
455 </variablelist>
456 </refsect2>
457
458 <refsect2><title>udevadm monitor
459 <arg choice="opt"><replaceable>options</replaceable></arg>
460 </title>
461 <para>Listens to the kernel uevents and events sent out by a udev rule
462 and prints the devpath of the event to the console. It can be used to analyze the
463 event timing, by comparing the timestamps of the kernel uevent and the udev event.
464 </para>
465 <variablelist>
466 <varlistentry>
467 <term><option>-k</option></term>
468 <term><option>--kernel</option></term>
469 <listitem>
470 <para>Print the kernel uevents.</para>
471 </listitem>
472 </varlistentry>
473 <varlistentry>
474 <term><option>-u</option></term>
475 <term><option>--udev</option></term>
476 <listitem>
477 <para>Print the udev event after the rule processing.</para>
478 </listitem>
479 </varlistentry>
480 <varlistentry>
481 <term><option>-p</option></term>
482 <term><option>--property</option></term>
483 <listitem>
484 <para>Also print the properties of the event.</para>
485 </listitem>
486 </varlistentry>
487 <varlistentry>
488 <term><option>-s</option></term>
489 <term><option>--subsystem-match=<replaceable>string[/string]</replaceable></option></term>
490 <listitem>
491 <para>Filter events by subsystem[/devtype]. Only udev events with a matching subsystem value will pass.</para>
492 </listitem>
493 </varlistentry>
494 <varlistentry>
495 <term><option>-t</option></term>
496 <term><option>--tag-match=<replaceable>string</replaceable></option></term>
497 <listitem>
498 <para>Filter events by property. Only udev events with a given tag attached will pass.</para>
499 </listitem>
500 </varlistentry>
501 <varlistentry>
502 <term><option>-h</option></term>
503 <term><option>--help</option></term>
504 <listitem>
505 <para>Print help text.</para>
506 </listitem>
507 </varlistentry>
508 </variablelist>
509 </refsect2>
510
511 <refsect2><title>udevadm test
512 <arg choice="opt"><replaceable>options</replaceable></arg>
513 <arg><replaceable>devpath</replaceable></arg>
514 </title>
515 <para>Simulate a udev event run for the given device, and print debug output.</para>
516 <variablelist>
517 <varlistentry>
518 <term><option>-a</option></term>
519 <term><option>--action=<replaceable>string</replaceable></option></term>
520 <listitem>
521 <para>The action string.</para>
522 </listitem>
523 </varlistentry>
524 <varlistentry>
525 <term><option>-N</option></term>
526 <term><option>--resolve-names=<constant>early</constant>|<constant>late</constant>|<constant>never</constant></option></term>
527 <listitem>
528 <para>Specify when udevadm should resolve names of users
529 and groups. When set to <constant>early</constant> (the
530 default), names will be resolved when the rules are
531 parsed. When set to <constant>late</constant>, names will
532 be resolved for every event. When set to
533 <constant>never</constant>, names will never be resolved
534 and all devices will be owned by root.</para>
535 </listitem>
536 </varlistentry>
537 <varlistentry>
538 <term><option>-h</option></term>
539 <term><option>--help</option></term>
540 <listitem>
541 <para>Print help text.</para>
542 </listitem>
543 </varlistentry>
544 </variablelist>
545 </refsect2>
546
547 <refsect2><title>udevadm test-builtin
548 <arg choice="opt"><replaceable>options</replaceable></arg>
549 <arg><replaceable>command</replaceable></arg>
550 <arg><replaceable>devpath</replaceable></arg>
551 </title>
552 <para>Run a built-in command <replaceable>COMMAND</replaceable>
553 for device <replaceable>DEVPATH</replaceable>, and print debug
554 output.</para>
555 <variablelist>
556 <varlistentry>
557 <term><option>-h</option></term>
558 <term><option>--help</option></term>
559 <listitem>
560 <para>Print help text.</para>
561 </listitem>
562 </varlistentry>
563 </variablelist>
564 </refsect2>
565 </refsect1>
566
567 <refsect1>
568 <title>See Also</title>
569 <para><citerefentry>
570 <refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum>
571 </citerefentry>,
572 <citerefentry>
573 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
574 </citerefentry></para>
575 </refsect1>
576 </refentry>