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