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