]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/udevadm.xml
Merge pull request #11512 from poettering/resolved-stub-pipeline
[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" rep="repeat"><replaceable>devpath</replaceable>|<replaceable>file</replaceable>|<replaceable>unit</replaceable></arg>
80 </title>
81
82 <para>Query the udev database for device information.</para>
83
84 <para>Positional arguments should be used to specify one or more devices. Each one may be a device name
85 (in which case it must start with <filename>/dev/</filename>), a sys path (in which case it must start
86 with <filename>/sys/</filename>), or a systemd device unit name (in which case it must end with
87 <literal>.device</literal>, see
88 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
89 </para>
90
91 <variablelist>
92 <varlistentry>
93 <term><option>-q</option></term>
94 <term><option>--query=<replaceable>TYPE</replaceable></option></term>
95 <listitem>
96 <para>Query the database for the specified type of device data.
97 Valid <replaceable>TYPE</replaceable>s are:
98 <constant>name</constant>, <constant>symlink</constant>,
99 <constant>path</constant>, <constant>property</constant>,
100 <constant>all</constant>.</para>
101 </listitem>
102 </varlistentry>
103
104 <varlistentry>
105 <term><option>-p</option></term>
106 <term><option>--path=<replaceable>DEVPATH</replaceable></option></term>
107 <listitem>
108 <para>The <filename>/sys</filename> path of the device to query, e.g.
109 <filename><optional>/sys</optional>/class/block/sda</filename>. This option is an alternative to
110 the positional argument with a <filename>/sys/</filename> prefix. <command>udevadm info
111 --path=/class/block/sda</command> is equivalent to <command>udevadm info
112 /sys/class/block/sda</command>.</para>
113 </listitem>
114 </varlistentry>
115 <varlistentry>
116 <term><option>-n</option></term>
117 <term><option>--name=<replaceable>FILE</replaceable></option></term>
118 <listitem>
119 <para>The name of the device node or a symlink to query,
120 e.g. <filename><optional>/dev</optional>/sda</filename>. This option is an alternative to the
121 positional argument with a <filename>/dev/</filename> prefix. <command>udevadm info
122 --name=sda</command> is equivalent to <command>udevadm info /dev/sda</command>.</para>
123 </listitem>
124 </varlistentry>
125 <varlistentry>
126 <term><option>-r</option></term>
127 <term><option>--root</option></term>
128 <listitem>
129 <para>Print absolute paths in <command>name</command> or <command>symlink</command>
130 query.</para>
131 </listitem>
132 </varlistentry>
133 <varlistentry>
134 <term><option>-a</option></term>
135 <term><option>--attribute-walk</option></term>
136 <listitem>
137 <para>Print all sysfs properties of the specified device that can be used
138 in udev rules to match the specified device. It prints all devices
139 along the chain, up to the root of sysfs that can be used in udev rules.</para>
140 </listitem>
141 </varlistentry>
142 <varlistentry>
143 <term><option>-x</option></term>
144 <term><option>--export</option></term>
145 <listitem>
146 <para>Print output as key/value pairs. Values are enclosed in single quotes.
147 This takes effects only when <option>--query=property</option> or
148 <option>--device-id-of-file=<replaceable>FILE</replaceable></option> is specified.</para>
149 </listitem>
150 </varlistentry>
151 <varlistentry>
152 <term><option>-P</option></term>
153 <term><option>--export-prefix=<replaceable>NAME</replaceable></option></term>
154 <listitem>
155 <para>Add a prefix to the key name of exported values.
156 This implies <option>--export</option>.</para>
157 </listitem>
158 </varlistentry>
159 <varlistentry>
160 <term><option>-d</option></term>
161 <term><option>--device-id-of-file=<replaceable>FILE</replaceable></option></term>
162 <listitem>
163 <para>Print major/minor numbers of the underlying device, where the file lives on.
164 If this is specified, all positional arguments are ignored.</para>
165 </listitem>
166 </varlistentry>
167 <varlistentry>
168 <term><option>-e</option></term>
169 <term><option>--export-db</option></term>
170 <listitem>
171 <para>Export the content of the udev database.</para>
172 </listitem>
173 </varlistentry>
174 <varlistentry>
175 <term><option>-c</option></term>
176 <term><option>--cleanup-db</option></term>
177 <listitem>
178 <para>Cleanup the udev database.</para>
179 </listitem>
180 </varlistentry>
181
182 <xi:include href="standard-options.xml" xpointer="help" />
183 </variablelist>
184 </refsect2>
185
186 <refsect2><title>udevadm trigger
187 <arg choice="opt"><replaceable>options</replaceable></arg>
188 <arg choice="opt"><replaceable>devpath</replaceable>|<replaceable>file</replaceable>|<replaceable>unit</replaceable></arg>
189 </title>
190 <para>Request device events from the kernel. Primarily used to replay events at system coldplug time.</para>
191
192 <para>Takes device specifications as positional arguments. See the description of <command>info</command>
193 above.</para>
194
195 <variablelist>
196 <varlistentry>
197 <term><option>-v</option></term>
198 <term><option>--verbose</option></term>
199 <listitem>
200 <para>Print the list of devices which will be triggered.</para>
201 </listitem>
202 </varlistentry>
203 <varlistentry>
204 <term><option>-n</option></term>
205 <term><option>--dry-run</option></term>
206 <listitem>
207 <para>Do not actually trigger the event.</para>
208 </listitem>
209 </varlistentry>
210 <varlistentry>
211 <term><option>-t</option></term>
212 <term><option>--type=<replaceable>TYPE</replaceable></option></term>
213 <listitem>
214 <para>Trigger a specific type of devices. Valid types are:
215 <command>devices</command>, <command>subsystems</command>.
216 The default value is <command>devices</command>.</para>
217 </listitem>
218 </varlistentry>
219 <varlistentry>
220 <term><option>-c</option></term>
221 <term><option>--action=<replaceable>ACTION</replaceable></option></term>
222 <listitem>
223 <para>Type of event to be triggered. The default value is
224 <command>change</command>.</para>
225 </listitem>
226 </varlistentry>
227 <varlistentry>
228 <term><option>-s</option></term>
229 <term><option>--subsystem-match=<replaceable>SUBSYSTEM</replaceable></option></term>
230 <listitem>
231 <para>Trigger events for devices which belong to a
232 matching subsystem. This option supports shell style pattern matching.
233 When this option is specified more than once, then each matching result is ORed, that is,
234 all the devices in each subsystem are triggered.</para>
235 </listitem>
236 </varlistentry>
237 <varlistentry>
238 <term><option>-S</option></term>
239 <term><option>--subsystem-nomatch=<replaceable>SUBSYSTEM</replaceable></option></term>
240 <listitem>
241 <para>Do not trigger events for devices which belong to a matching subsystem. This option
242 supports shell style pattern matching. When this option is specified more than once,
243 then each matching result is ANDed, that is, devices which do not match all specified
244 subsystems are triggered.</para>
245 </listitem>
246 </varlistentry>
247 <varlistentry>
248 <term><option>-a</option></term>
249 <term><option>--attr-match=<replaceable>ATTRIBUTE</replaceable>=<replaceable>VALUE</replaceable></option></term>
250 <listitem>
251 <para>Trigger events for devices with a matching sysfs attribute. If a value is specified along
252 with the attribute name, the content of the attribute is matched against the given value using
253 shell style pattern matching. If no value is specified, the existence of the sysfs attribute is
254 checked. When this option is specified multiple times, then each matching result is ANDed,
255 that is, only devices which have all specified attributes are triggered.</para>
256 </listitem>
257 </varlistentry>
258 <varlistentry>
259 <term><option>-A</option></term>
260 <term><option>--attr-nomatch=<replaceable>ATTRIBUTE</replaceable>=<replaceable>VALUE</replaceable></option></term>
261 <listitem>
262 <para>Do not trigger events for devices with a matching sysfs attribute. If a value is specified
263 along with the attribute name, the content of the attribute is matched against the given value
264 using shell style pattern matching. If no value is specified, the existence of the sysfs attribute
265 is checked. When this option is specified multiple times, then each matching result is ANDed,
266 that is, only devices which have none of the specified attributes are triggered.</para>
267 </listitem>
268 </varlistentry>
269 <varlistentry>
270 <term><option>-p</option></term>
271 <term><option>--property-match=<replaceable>PROPERTY</replaceable>=<replaceable>VALUE</replaceable></option></term>
272 <listitem>
273 <para>Trigger events for devices with a matching property value. This option supports shell style
274 pattern matching. When this option is specified more than once, then each matching result is ORed,
275 that is, devices which have one of the specified properties are triggered.</para>
276 </listitem>
277 </varlistentry>
278 <varlistentry>
279 <term><option>-g</option></term>
280 <term><option>--tag-match=<replaceable>PROPERTY</replaceable></option></term>
281 <listitem>
282 <para>Trigger events for devices with a matching tag. When this option is specified multiple times,
283 then each matching result is ANDed, that is, devices which have all specified tags are triggered.</para>
284 </listitem>
285 </varlistentry>
286 <varlistentry>
287 <term><option>-y</option></term>
288 <term><option>--sysname-match=<replaceable>NAME</replaceable></option></term>
289 <listitem>
290 <para>Trigger events for devices for which the last component (i.e. the filename) of the
291 <filename>/sys</filename> path matches the specified <replaceable>PATH</replaceable>. This option
292 supports shell style pattern matching. When this option is specified more than once, then each
293 matching result is ORed, that is, all devices which have any of the specified
294 <replaceable>NAME</replaceable> are triggered.</para>
295 </listitem>
296 </varlistentry>
297 <varlistentry>
298 <term><option>--name-match=<replaceable>NAME</replaceable></option></term>
299 <listitem>
300 <para>Trigger events for devices with a matching device path. When this option is specified more than once,
301 then each matching result is ORed, that is, all specified devices are triggered.</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 device. When this option is specified more than once,
309 then each matching result is ORed, that is, all children of each specified device are triggered.</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 <varlistentry>
324 <term><option>--wait-daemon[=<replaceable>SECONDS</replaceable>]</option></term>
325 <listitem>
326 <para>Before triggering uevents, wait for systemd-udevd daemon to be initialized.
327 Optionally takes timeout value. Default timeout is 5 seconds. This is equivalent to invoke
328 invoking <command>udevadm control --ping</command> before <command>udevadm trigger</command>.</para>
329 </listitem>
330 </varlistentry>
331
332 <xi:include href="standard-options.xml" xpointer="help" />
333 </variablelist>
334
335 <para>In addition, optional positional arguments can be used
336 to specify device names or sys paths. They must start with
337 <filename>/dev</filename> or <filename>/sys</filename>
338 respectively.</para>
339 </refsect2>
340
341 <refsect2><title>udevadm settle
342 <arg choice="opt"><replaceable>options</replaceable></arg>
343 </title>
344 <para>Watches the udev event queue, and exits if all current events are handled.</para>
345 <variablelist>
346 <varlistentry>
347 <term><option>-t</option></term>
348 <term><option>--timeout=<replaceable>SECONDS</replaceable></option></term>
349 <listitem>
350 <para>Maximum number of seconds to wait for the event
351 queue to become empty. The default value is 120 seconds. A
352 value of 0 will check if the queue is empty and always
353 return immediately.</para>
354 </listitem>
355 </varlistentry>
356 <varlistentry>
357 <term><option>-E</option></term>
358 <term><option>--exit-if-exists=<replaceable>FILE</replaceable></option></term>
359 <listitem>
360 <para>Stop waiting if file exists.</para>
361 </listitem>
362 </varlistentry>
363
364 <xi:include href="standard-options.xml" xpointer="help" />
365 </variablelist>
366 </refsect2>
367
368 <refsect2><title>udevadm control <replaceable>option</replaceable></title>
369 <para>Modify the internal state of the running udev daemon.</para>
370 <variablelist>
371 <varlistentry>
372 <term><option>-e</option></term>
373 <term><option>--exit</option></term>
374 <listitem>
375 <para>Signal and wait for systemd-udevd to exit. No option except for
376 <option>--timeout</option> can be specified after this option.
377 Note that <filename>systemd-udevd.service</filename> contains
378 <option>Restart=always</option> and so as a result, this option restarts systemd-udevd.
379 If you want to stop <filename>systemd-udevd.service</filename>, please use the following:
380 <programlisting>systemctl stop systemd-udevd-control.socket systemd-udevd-kernel.socket systemd-udevd.service</programlisting>
381 </para>
382 </listitem>
383 </varlistentry>
384 <varlistentry>
385 <term><option>-l</option></term>
386 <term><option>--log-priority=<replaceable>value</replaceable></option></term>
387 <listitem>
388 <para>Set the internal log level of
389 <filename>systemd-udevd</filename>. Valid values are the
390 numerical syslog priorities or their textual
391 representations: <option>emerg</option>,
392 <option>alert</option>, <option>crit</option>,
393 <option>err</option>, <option>warning</option>,
394 <option>notice</option>, <option>info</option>, and
395 <option>debug</option>.</para>
396 </listitem>
397 </varlistentry>
398 <varlistentry>
399 <term><option>-s</option></term>
400 <term><option>--stop-exec-queue</option></term>
401 <listitem>
402 <para>Signal systemd-udevd to stop executing new events. Incoming events
403 will be queued.</para>
404 </listitem>
405 </varlistentry>
406 <varlistentry>
407 <term><option>-S</option></term>
408 <term><option>--start-exec-queue</option></term>
409 <listitem>
410 <para>Signal systemd-udevd to enable the execution of events.</para>
411 </listitem>
412 </varlistentry>
413 <varlistentry>
414 <term><option>-R</option></term>
415 <term><option>--reload</option></term>
416 <listitem>
417 <para>Signal systemd-udevd to reload the rules files and other databases like the kernel
418 module index. Reloading rules and databases does not apply any changes to already
419 existing devices; the new configuration will only be applied to new events.</para>
420 </listitem>
421 </varlistentry>
422 <varlistentry>
423 <term><option>-p</option></term>
424 <term><option>--property=<replaceable>KEY</replaceable>=<replaceable>value</replaceable></option></term>
425 <listitem>
426 <para>Set a global property for all events.</para>
427 </listitem>
428 </varlistentry>
429 <varlistentry>
430 <term><option>-m</option></term>
431 <term><option>--children-max=</option><replaceable>value</replaceable></term>
432 <listitem>
433 <para>Set the maximum number of events, systemd-udevd will handle at the
434 same time.</para>
435 </listitem>
436 </varlistentry>
437 <varlistentry>
438 <term><option>--ping</option></term>
439 <listitem>
440 <para>Send a ping message to systemd-udevd and wait for the reply. This may be useful to check that
441 systemd-udevd daemon is running.</para>
442 </listitem>
443 </varlistentry>
444 <varlistentry>
445 <term><option>-t</option></term>
446 <term><option>--timeout=</option><replaceable>seconds</replaceable></term>
447 <listitem>
448 <para>The maximum number of seconds to wait for a reply from systemd-udevd.</para>
449 </listitem>
450 </varlistentry>
451
452 <xi:include href="standard-options.xml" xpointer="help" />
453 </variablelist>
454 </refsect2>
455
456 <refsect2><title>udevadm monitor
457 <arg choice="opt"><replaceable>options</replaceable></arg>
458 </title>
459 <para>Listens to the kernel uevents and events sent out by a udev rule
460 and prints the devpath of the event to the console. It can be used to analyze the
461 event timing, by comparing the timestamps of the kernel uevent and the udev event.
462 </para>
463 <variablelist>
464 <varlistentry>
465 <term><option>-k</option></term>
466 <term><option>--kernel</option></term>
467 <listitem>
468 <para>Print the kernel uevents.</para>
469 </listitem>
470 </varlistentry>
471 <varlistentry>
472 <term><option>-u</option></term>
473 <term><option>--udev</option></term>
474 <listitem>
475 <para>Print the udev event after the rule processing.</para>
476 </listitem>
477 </varlistentry>
478 <varlistentry>
479 <term><option>-p</option></term>
480 <term><option>--property</option></term>
481 <listitem>
482 <para>Also print the properties of the event.</para>
483 </listitem>
484 </varlistentry>
485 <varlistentry>
486 <term><option>-s</option></term>
487 <term><option>--subsystem-match=<replaceable>string[/string]</replaceable></option></term>
488 <listitem>
489 <para>Filter kernel uevents and udev events by subsystem[/devtype]. Only events with a matching subsystem value will pass.
490 When this option is specified more than once, then each matching result is ORed, that is, all devices in the specified
491 subsystems are monitored.</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 udev events by tag. Only udev events with a given tag attached will pass.
499 When this option is specified more than once, then each matching result is ORed, that is, devices which have one of the
500 specified tags are monitored.</para>
501 </listitem>
502 </varlistentry>
503
504 <xi:include href="standard-options.xml" xpointer="help" />
505 </variablelist>
506 </refsect2>
507
508 <refsect2><title>udevadm test
509 <arg choice="opt"><replaceable>options</replaceable></arg>
510 <arg><replaceable>devpath</replaceable></arg>
511 </title>
512 <para>Simulate a udev event run for the given device, and print debug output.</para>
513 <variablelist>
514 <varlistentry>
515 <term><option>-a</option></term>
516 <term><option>--action=<replaceable>string</replaceable></option></term>
517 <listitem>
518 <para>The action string.</para>
519 </listitem>
520 </varlistentry>
521 <varlistentry>
522 <term><option>-N</option></term>
523 <term><option>--resolve-names=<constant>early</constant>|<constant>late</constant>|<constant>never</constant></option></term>
524 <listitem>
525 <para>Specify when udevadm should resolve names of users
526 and groups. When set to <constant>early</constant> (the
527 default), names will be resolved when the rules are
528 parsed. When set to <constant>late</constant>, names will
529 be resolved for every event. When set to
530 <constant>never</constant>, names will never be resolved
531 and all devices will be owned by root.</para>
532 </listitem>
533 </varlistentry>
534
535 <xi:include href="standard-options.xml" xpointer="help" />
536 </variablelist>
537 </refsect2>
538
539 <refsect2><title>udevadm test-builtin
540 <arg choice="opt"><replaceable>options</replaceable></arg>
541 <arg><replaceable>command</replaceable></arg>
542 <arg><replaceable>devpath</replaceable></arg>
543 </title>
544 <para>Run a built-in command <replaceable>COMMAND</replaceable>
545 for device <replaceable>DEVPATH</replaceable>, and print debug
546 output.</para>
547 <variablelist>
548 <xi:include href="standard-options.xml" xpointer="help" />
549 </variablelist>
550 </refsect2>
551 </refsect1>
552
553 <refsect1>
554 <title>See Also</title>
555 <para><citerefentry>
556 <refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum>
557 </citerefentry>,
558 <citerefentry>
559 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
560 </citerefentry></para>
561 </refsect1>
562 </refentry>