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