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