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