2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
7 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
10 <title>udevadm
</title>
11 <productname>systemd
</productname>
15 <refentrytitle>udevadm
</refentrytitle>
16 <manvolnum>8</manvolnum>
20 <refname>udevadm
</refname><refpurpose>udev management tool
</refpurpose>
25 <command>udevadm
</command>
26 <arg><option>--debug
</option></arg>
27 <arg><option>--version
</option></arg>
28 <arg><option>--help
</option></arg>
31 <command>udevadm info
<optional>options
</optional> <optional>devpath
</optional></command>
34 <command>udevadm trigger
<optional>options
</optional> <optional>devpath
</optional></command>
37 <command>udevadm settle
<optional>options
</optional></command>
40 <command>udevadm control
<replaceable>option
</replaceable></command>
43 <command>udevadm monitor
<optional>options
</optional></command>
46 <command>udevadm test
<optional>options
</optional> <replaceable>devpath
</replaceable></command>
49 <command>udevadm test-builtin
<optional>options
</optional> <replaceable>command
</replaceable> <replaceable>devpath
</replaceable></command>
52 <command>udevadm verify
</command>
53 <arg choice=
"opt" rep=
"repeat">options
</arg>
54 <arg choice=
"opt" rep=
"repeat"><replaceable>file
</replaceable></arg>
57 <command>udevadm wait
<optional>options
</optional> <replaceable>device|syspath
</replaceable></command>
60 <command>udevadm lock
<optional>options
</optional> <replaceable>command
</replaceable></command>
64 <refsect1><title>Description
</title>
65 <para><command>udevadm
</command> expects a command and command
66 specific options. It controls the runtime behavior of
67 <command>systemd-udevd
</command>, requests kernel events, manages
68 the event queue, and provides simple debugging mechanisms.
</para>
71 <refsect1><title>Options
</title>
74 <term><option>-d
</option></term>
75 <term><option>--debug
</option></term>
77 <para>Print debug messages to standard error. This option is implied in
<command>udevadm test
</command> and
78 <command>udevadm test-builtin
</command> commands.
</para>
82 <xi:include href=
"standard-options.xml" xpointer=
"help" />
85 <refsect2><title>udevadm info
86 <optional><replaceable>options
</replaceable></optional>
87 <optional><replaceable>devpath
</replaceable>|
<replaceable>file
</replaceable>|
<replaceable>unit
</replaceable></optional>
90 <para>Query the udev database for device information.
</para>
92 <para>Positional arguments should be used to specify one or more devices. Each one may be a device name
93 (in which case it must start with
<filename>/dev/
</filename>), a sys path (in which case it must start
94 with
<filename>/sys/
</filename>), or a systemd device unit name (in which case it must end with
95 <literal>.device
</literal>, see
96 <citerefentry><refentrytitle>systemd.device
</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
101 <term><option>-q
</option></term>
102 <term><option>--query=
<replaceable>TYPE
</replaceable></option></term>
104 <para>Query the database for the specified type of device data.
105 Valid
<replaceable>TYPE
</replaceable>s are:
106 <constant>name
</constant>,
<constant>symlink
</constant>,
107 <constant>path
</constant>,
<constant>property
</constant>,
108 <constant>all
</constant>.
</para>
113 <term><option>--property=
<replaceable>NAME
</replaceable></option></term>
115 <para>When showing device properties using the
<option>--query=property
</option>
116 option, limit display to properties specified in the argument. The argument should
117 be a comma-separated list of property names. If not specified, all known properties
120 <xi:include href=
"version-info.xml" xpointer=
"v250"/>
124 <term><option>--value
</option></term>
126 <para>When showing device properties using the
<option>--query=property
</option>
127 option, print only their values, and skip the property name and
<literal>=
</literal>.
</para>
128 <para>Cannot be used together with
<option>-x/--export
</option> or
129 <option>-P/--export-prefix
</option>.
</para>
131 <xi:include href=
"version-info.xml" xpointer=
"v250"/>
135 <term><option>-p
</option></term>
136 <term><option>--path=
<replaceable>DEVPATH
</replaceable></option></term>
138 <para>The
<filename>/sys/
</filename> path of the device to query, e.g.
139 <filename><optional>/sys/
</optional>/class/block/sda
</filename>. This option is an alternative to
140 the positional argument with a
<filename>/sys/
</filename> prefix.
<command>udevadm info
141 --path=/class/block/sda
</command> is equivalent to
<command>udevadm info
142 /sys/class/block/sda
</command>.
</para>
146 <term><option>-n
</option></term>
147 <term><option>--name=
<replaceable>FILE
</replaceable></option></term>
149 <para>The name of the device node or a symlink to query,
150 e.g.
<filename><optional>/dev/
</optional>/sda
</filename>. This option is an alternative to the
151 positional argument with a
<filename>/dev/
</filename> prefix.
<command>udevadm info
152 --name=sda
</command> is equivalent to
<command>udevadm info /dev/sda
</command>.
</para>
156 <term><option>-r
</option></term>
157 <term><option>--root
</option></term>
159 <para>Print absolute paths in
<command>name
</command> or
<command>symlink
</command>
164 <term><option>-a
</option></term>
165 <term><option>--attribute-walk
</option></term>
167 <para>Print all sysfs properties of the specified device that can be used
168 in udev rules to match the specified device. It prints all devices
169 along the chain, up to the root of sysfs that can be used in udev rules.
</para>
173 <term><option>-t
</option></term>
174 <term><option>--tree
</option></term>
176 <para>Display a sysfs tree. This recursively iterates through the sysfs hierarchy and displays it
177 in a tree structure. If a path is specified only the subtree below and its parent directories are
178 shown. This will show both device and subsystem items.
</para>
180 <xi:include href=
"version-info.xml" xpointer=
"v251"/>
184 <term><option>-x
</option></term>
185 <term><option>--export
</option></term>
187 <para>Print output as key/value pairs. Values are enclosed in single quotes.
188 This takes effects only when
<option>--query=property
</option> or
189 <option>--device-id-of-file=
<replaceable>FILE
</replaceable></option> is specified.
</para>
193 <term><option>-P
</option></term>
194 <term><option>--export-prefix=
<replaceable>NAME
</replaceable></option></term>
196 <para>Add a prefix to the key name of exported values.
197 This implies
<option>--export
</option>.
</para>
201 <term><option>-d
</option></term>
202 <term><option>--device-id-of-file=
<replaceable>FILE
</replaceable></option></term>
204 <para>Print major/minor numbers of the underlying device, where the file lives on.
205 If this is specified, all positional arguments are ignored.
</para>
209 <term><option>-e
</option></term>
210 <term><option>--export-db
</option></term>
212 <para>Export the content of the udev database.
</para>
216 <term><option>-c
</option></term>
217 <term><option>--cleanup-db
</option></term>
219 <para>Cleanup the udev database.
</para>
223 <term><option>-w
<optional>SECONDS
</optional></option></term>
224 <term><option>--wait-for-initialization
<optional>=SECONDS
</optional></option></term>
226 <para>Wait for device to be initialized. If argument
<replaceable>SECONDS
</replaceable>
227 is not specified, the default is to wait forever.
</para>
229 <xi:include href=
"version-info.xml" xpointer=
"v243"/>
233 <term><option>--subsystem-match
<optional>=SUBSYSTEM
</optional></option></term>
234 <term><option>--subsystem-nomatch
<optional>=SUBSYSTEM
</optional></option></term>
236 <para>When used with
<option>--export-db
</option>, only show devices of or not of the given
237 subsystem respectively.
</para>
239 <xi:include href=
"version-info.xml" xpointer=
"v255"/>
243 <term><option>--attr-match
<optional>=FILE[=VALUE]
</optional></option></term>
244 <term><option>--attr-nomatch
<optional>=FILE[=VALUE]
</optional></option></term>
246 <para>When used with
<option>--export-db
</option>, only show devices matching or not matching the
247 given attribute respectively.
</para>
249 <xi:include href=
"version-info.xml" xpointer=
"v255"/>
253 <term><option>--property-match
<optional>=KEY=VALUE
</optional></option></term>
255 <para>When used with
<option>--export-db
</option>, only show devices matching the given property
258 <xi:include href=
"version-info.xml" xpointer=
"v255"/>
262 <term><option>--tag-match
<optional>=TAG
</optional></option></term>
264 <para>When used with
<option>--export-db
</option>, only show devices with the given tag.
</para>
266 <xi:include href=
"version-info.xml" xpointer=
"v255"/>
270 <term><option>--sysname-match
<optional>=NAME
</optional></option></term>
272 <para>When used with
<option>--export-db
</option>, only show devices with the given
273 <literal>/sys
</literal> path.
</para>
275 <xi:include href=
"version-info.xml" xpointer=
"v255"/>
279 <term><option>--name-match
<optional>=NAME
</optional></option></term>
281 <para>When used with
<option>--export-db
</option>, only show devices with the given name in
282 <literal>/dev
</literal>.
</para>
284 <xi:include href=
"version-info.xml" xpointer=
"v255"/>
288 <term><option>--parent-match
<optional>=NAME
</optional></option></term>
290 <para>When used with
<option>--export-db
</option>, only show devices with the given parent
293 <xi:include href=
"version-info.xml" xpointer=
"v255"/>
297 <term><option>--initialized-match
</option></term>
298 <term><option>--initialized-nomatch
</option></term>
300 <para>When used with
<option>--export-db
</option>, only show devices that are initialized or not
301 initialized respectively.
</para>
303 <xi:include href=
"version-info.xml" xpointer=
"v255"/>
307 <xi:include href=
"standard-options.xml" xpointer=
"json" />
308 <xi:include href=
"standard-options.xml" xpointer=
"help" />
309 <xi:include href=
"standard-options.xml" xpointer=
"no-pager" />
312 <para>The generated output shows the current device database entry in a terse format. Each line shown
313 is prefixed with one of the following characters:
</para>
316 <title><command>udevadm info
</command> output prefixes
</title>
317 <tgroup cols='
2' align='left' colsep='
1' rowsep='
1'
>
318 <colspec colname=
"prefix" />
319 <colspec colname=
"meaning" />
322 <entry>Prefix
</entry>
323 <entry>Meaning
</entry>
328 <entry><literal>P:
</literal></entry>
329 <entry>Device path in
<filename>/sys/
</filename></entry>
332 <entry><literal>M:
</literal></entry>
333 <entry>Device name in
<filename>/sys/
</filename> (i.e. the last component of
<literal>P:
</literal>)
</entry>
336 <entry><literal>R:
</literal></entry>
337 <entry>Device number in
<filename>/sys/
</filename> (i.e. the numeric suffix of the last component of
<literal>P:
</literal>)
</entry>
340 <entry><literal>U:
</literal></entry>
341 <entry>Kernel subsystem
</entry>
344 <entry><literal>T:
</literal></entry>
345 <entry>Kernel device type within subsystem
</entry>
348 <entry><literal>D:
</literal></entry>
349 <entry>Kernel device node major/minor
</entry>
352 <entry><literal>I:
</literal></entry>
353 <entry>Network interface index
</entry>
356 <entry><literal>N:
</literal></entry>
357 <entry>Kernel device node name
</entry>
360 <entry><literal>L:
</literal></entry>
361 <entry>Device node symlink priority
</entry>
364 <entry><literal>S:
</literal></entry>
365 <entry>Device node symlink
</entry>
368 <entry><literal>Q:
</literal></entry>
369 <entry>Block device sequence number (DISKSEQ)
</entry>
372 <entry><literal>V:
</literal></entry>
373 <entry>Attached driver
</entry>
376 <entry><literal>E:
</literal></entry>
377 <entry>Device property
</entry>
384 <refsect2><title>udevadm trigger
385 <optional><replaceable>options
</replaceable></optional>
386 <optional><replaceable>devpath
</replaceable>|
<replaceable>file
</replaceable>|
<replaceable>unit
</replaceable></optional>
388 <para>Request device events from the kernel. Primarily used to replay events at system coldplug time.
</para>
390 <para>Takes device specifications as positional arguments. See the description of
<command>info
</command>
395 <term><option>-v
</option></term>
396 <term><option>--verbose
</option></term>
398 <para>Print the list of devices which will be triggered.
</para>
402 <term><option>-n
</option></term>
403 <term><option>--dry-run
</option></term>
405 <para>Do not actually trigger the event.
</para>
409 <term><option>-q
</option></term>
410 <term><option>--quiet
</option></term>
412 <para>Suppress error logging in triggering events.
</para>
414 <xi:include href=
"version-info.xml" xpointer=
"v248"/>
418 <term><option>-t
</option></term>
419 <term><option>--type=
<replaceable>TYPE
</replaceable></option></term>
421 <para>Trigger a specific type of devices. Valid types are
<literal>all
</literal>,
422 <literal>devices
</literal>, and
<literal>subsystems
</literal>. The default value is
423 <literal>devices
</literal>.
</para>
427 <term><option>-c
</option></term>
428 <term><option>--action=
<replaceable>ACTION
</replaceable></option></term>
430 <para>Type of event to be triggered. Possible actions are
<literal>add
</literal>,
431 <literal>remove
</literal>,
<literal>change
</literal>,
<literal>move
</literal>,
432 <literal>online
</literal>,
<literal>offline
</literal>,
<literal>bind
</literal>,
433 and
<literal>unbind
</literal>. Also, the special value
<literal>help
</literal> can be used
434 to list the possible actions. The default value is
<literal>change
</literal>.
439 <term><option>--prioritized-subsystem=
<replaceable>SUBSYSTEM
<optional>,
<replaceable>SUBSYSTEM
</replaceable>…
</optional></replaceable></option></term>
441 <para>Takes a comma separated list of subsystems. When triggering events for devices, the
442 devices from the specified subsystems and their parents are triggered first. For example,
443 if
<option>--prioritized-subsystem=block,net
</option>, then firstly all block devices and
444 their parents are triggered, in the next all network devices and their parents are
445 triggered, and lastly the other devices are triggered. This option can be specified
446 multiple times, and in that case the lists of the subsystems will be merged. That is,
447 <option>--prioritized-subsystem=block --prioritized-subsystem=net
</option> is equivalent to
448 <option>--prioritized-subsystem=block,net
</option>.
</para>
450 <xi:include href=
"version-info.xml" xpointer=
"v251"/>
454 <term><option>-s
</option></term>
455 <term><option>--subsystem-match=
<replaceable>SUBSYSTEM
</replaceable></option></term>
457 <para>Trigger events for devices which belong to a
458 matching subsystem. This option supports shell style pattern matching.
459 When this option is specified more than once, then each matching result is ORed, that is,
460 all the devices in each subsystem are triggered.
</para>
464 <term><option>-S
</option></term>
465 <term><option>--subsystem-nomatch=
<replaceable>SUBSYSTEM
</replaceable></option></term>
467 <para>Do not trigger events for devices which belong to a matching subsystem. This option
468 supports shell style pattern matching. When this option is specified more than once,
469 then each matching result is ANDed, that is, devices which do not match all specified
470 subsystems are triggered.
</para>
474 <term><option>-a
</option></term>
475 <term><option>--attr-match=
<replaceable>ATTRIBUTE
</replaceable>=
<replaceable>VALUE
</replaceable></option></term>
477 <para>Trigger events for devices with a matching sysfs attribute. If a value is specified along
478 with the attribute name, the content of the attribute is matched against the given value using
479 shell style pattern matching. If no value is specified, the existence of the sysfs attribute is
480 checked. When this option is specified multiple times, then each matching result is ANDed,
481 that is, only devices which have all specified attributes are triggered.
</para>
485 <term><option>-A
</option></term>
486 <term><option>--attr-nomatch=
<replaceable>ATTRIBUTE
</replaceable>=
<replaceable>VALUE
</replaceable></option></term>
488 <para>Do not trigger events for devices with a matching sysfs attribute. If a value is specified
489 along with the attribute name, the content of the attribute is matched against the given value
490 using shell style pattern matching. If no value is specified, the existence of the sysfs attribute
491 is checked. When this option is specified multiple times, then each matching result is ANDed,
492 that is, only devices which have none of the specified attributes are triggered.
</para>
496 <term><option>-p
</option></term>
497 <term><option>--property-match=
<replaceable>PROPERTY
</replaceable>=
<replaceable>VALUE
</replaceable></option></term>
499 <para>Trigger events for devices with a matching property value. This option supports shell style
500 pattern matching. When this option is specified more than once, then each matching result is ORed,
501 that is, devices which have one of the specified properties are triggered.
</para>
505 <term><option>-g
</option></term>
506 <term><option>--tag-match=
<replaceable>TAG
</replaceable></option></term>
508 <para>Trigger events for devices with a matching tag. When this option is specified multiple times,
509 then each matching result is ANDed, that is, devices which have all specified tags are triggered.
</para>
513 <term><option>-y
</option></term>
514 <term><option>--sysname-match=
<replaceable>NAME
</replaceable></option></term>
516 <para>Trigger events for devices for which the last component (i.e. the filename) of the
517 <filename>/sys/
</filename> path matches the specified
<replaceable>PATH
</replaceable>. This option
518 supports shell style pattern matching. When this option is specified more than once, then each
519 matching result is ORed, that is, all devices which have any of the specified
520 <replaceable>NAME
</replaceable> are triggered.
</para>
524 <term><option>--name-match=
<replaceable>NAME
</replaceable></option></term>
526 <para>Trigger events for devices with a matching device path. When this option is specified more than once,
527 then each matching result is ORed, that is, all specified devices are triggered.
</para>
529 <xi:include href=
"version-info.xml" xpointer=
"v218"/>
533 <term><option>-b
</option></term>
534 <term><option>--parent-match=
<replaceable>SYSPATH
</replaceable></option></term>
536 <para>Trigger events for all children of a given device. When this option is specified more than once,
537 then each matching result is ORed, that is, all children of each specified device are triggered.
</para>
541 <term><option>--initialized-match
</option></term>
542 <term><option>--initialized-nomatch
</option></term>
544 <para>When
<option>--initialized-match
</option> is specified, trigger events for devices
545 that are already initialized by
<command>systemd-udevd
</command>, and skip devices that
546 are not initialized yet.
</para>
547 <para>When
<option>--initialized-nomatch
</option> is specified, trigger events for devices
548 that are not initialized by
<command>systemd-udevd
</command> yet, and skip devices that
549 are already initialized.
</para>
550 <para>Typically, it is essential that applications which intend to use such a match, make
551 sure a suitable udev rule is installed that sets at least one property on devices that
552 shall be matched. See also Initialized Devices section below for more details.
</para>
554 <para><option>--initialized-nomatch
</option> can potentially save a significant
555 amount of time compared to re-triggering all devices in the system and e.g. can be used to
556 optimize boot time. However, this is not safe to be used in a boot sequence in general.
557 Especially, when udev rules for a device depend on its parent devices (e.g.
558 <literal>ATTRS
</literal> or
<literal>IMPORT{parent}
</literal> keys, see
559 <citerefentry><refentrytitle>udev
</refentrytitle><manvolnum>7</manvolnum></citerefentry>
560 for more details), the final state of the device becomes easily unstable with this option.
564 <xi:include href=
"version-info.xml" xpointer=
"v251"/>
568 <term><option>-w
</option></term>
569 <term><option>--settle
</option></term>
571 <para>Apart from triggering events, also waits for those events to
572 finish. Note that this is different from calling
<command>udevadm
573 settle
</command>.
<command>udevadm settle
</command> waits for all
574 events to finish. This option only waits for events triggered by
575 the same command to finish.
</para>
577 <xi:include href=
"version-info.xml" xpointer=
"v238"/>
581 <term><option>--uuid
</option></term>
583 <para>Trigger the synthetic device events, and associate a randomized UUID with each. These UUIDs
584 are printed to standard output, one line for each event. These UUIDs are included in the uevent
585 environment block (in the
<literal>SYNTH_UUID=
</literal> property) and may be used to track
586 delivery of the generated events.
</para>
588 <xi:include href=
"version-info.xml" xpointer=
"v249"/>
592 <term><option>--wait-daemon[=
<replaceable>SECONDS
</replaceable>]
</option></term>
594 <para>Before triggering uevents, wait for systemd-udevd daemon to be initialized.
595 Optionally takes timeout value. Default timeout is
5 seconds. This is equivalent to invoking
596 <command>udevadm control --ping
</command> before
<command>udevadm trigger
</command>.
</para>
598 <xi:include href=
"version-info.xml" xpointer=
"v241"/>
602 <xi:include href=
"standard-options.xml" xpointer=
"help" />
605 <para>In addition, optional positional arguments can be used
606 to specify device names or sys paths. They must start with
607 <filename>/dev/
</filename> or
<filename>/sys/
</filename>
611 <refsect2><title>udevadm settle
612 <optional><replaceable>options
</replaceable></optional>
614 <para>Watches the udev event queue, and exits if all current events are handled.
</para>
617 <term><option>-t
</option></term>
618 <term><option>--timeout=
<replaceable>SECONDS
</replaceable></option></term>
620 <para>Maximum number of seconds to wait for the event
621 queue to become empty. The default value is
120 seconds. A
622 value of
0 will check if the queue is empty and always
623 return immediately. A non-zero value will return an exit
624 code of
0 if queue became empty before timeout was reached,
625 non-zero otherwise.
</para>
629 <term><option>-E
</option></term>
630 <term><option>--exit-if-exists=
<replaceable>FILE
</replaceable></option></term>
632 <para>Stop waiting if file exists.
</para>
636 <xi:include href=
"standard-options.xml" xpointer=
"help" />
640 <citerefentry><refentrytitle>systemd-udev-settle.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
641 for more information.
</para>
644 <refsect2><title>udevadm control
<replaceable>option
</replaceable></title>
645 <para>Modify the internal state of the running udev daemon.
</para>
648 <term><option>-e
</option></term>
649 <term><option>--exit
</option></term>
651 <para>Signal and wait for systemd-udevd to exit. No option except for
652 <option>--timeout
</option> can be specified after this option.
653 Note that
<filename>systemd-udevd.service
</filename> contains
654 <option>Restart=always
</option> and so as a result, this option restarts systemd-udevd.
655 If you want to stop
<filename>systemd-udevd.service
</filename>, please use the following:
656 <programlisting>systemctl stop systemd-udevd-control.socket systemd-udevd-kernel.socket systemd-udevd.service
</programlisting>
661 <term><option>-l
</option></term>
662 <term><option>--log-level=
<replaceable>value
</replaceable></option></term>
664 <para>Set the internal log level of
665 <filename>systemd-udevd
</filename>. Valid values are the
666 numerical syslog priorities or their textual
667 representations:
<option>emerg
</option>,
668 <option>alert
</option>,
<option>crit
</option>,
669 <option>err
</option>,
<option>warning
</option>,
670 <option>notice
</option>,
<option>info
</option>, and
671 <option>debug
</option>.
</para>
675 <term><option>-s
</option></term>
676 <term><option>--stop-exec-queue
</option></term>
678 <para>Signal systemd-udevd to stop executing new events. Incoming events
679 will be queued.
</para>
683 <term><option>-S
</option></term>
684 <term><option>--start-exec-queue
</option></term>
686 <para>Signal systemd-udevd to enable the execution of events.
</para>
690 <term><option>-R
</option></term>
691 <term><option>--reload
</option></term>
693 <para>Signal systemd-udevd to reload the rules files and other databases like the kernel
694 module index. Reloading rules and databases does not apply any changes to already
695 existing devices; the new configuration will only be applied to new events.
</para>
699 <term><option>-p
</option></term>
700 <term><option>--property=
<replaceable>KEY
</replaceable>=
<replaceable>value
</replaceable></option></term>
702 <para>Set a global property for all events.
</para>
706 <term><option>-m
</option></term>
707 <term><option>--children-max=
<replaceable>value
</replaceable></option></term>
709 <para>Set the maximum number of events, systemd-udevd will handle at the same time. When
0 is
710 specified, then the maximum is determined based on the system resources.
</para>
714 <term><option>--ping
</option></term>
716 <para>Send a ping message to systemd-udevd and wait for the reply. This may be useful to check that
717 systemd-udevd daemon is running.
</para>
719 <xi:include href=
"version-info.xml" xpointer=
"v241"/>
723 <term><option>-t
</option></term>
724 <term><option>--timeout=
<replaceable>seconds
</replaceable></option></term>
726 <para>The maximum number of seconds to wait for a reply from systemd-udevd.
</para>
731 <term><option>--load-credentials
</option></term>
733 <para>When specified, the following credentials are used when passed in:
</para>
737 <term><varname>udev.conf.*
</varname></term>
739 <para>These credentials should contain valid
740 <citerefentry><refentrytitle>udev.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
741 configuration data. From each matching credential a separate file is created. Example: a
742 passed credential
<filename>udev.conf
.50-foobar
</filename> will be copied into a
743 configuration file
<filename>/run/udev/udev.conf.d/
50-foobar.conf
</filename>.
</para>
745 <xi:include href=
"version-info.xml" xpointer=
"v256"/>
749 <term><varname>udev.rules.*
</varname></term>
751 <para>These credentials should contain valid
752 <citerefentry><refentrytitle>udev
</refentrytitle><manvolnum>7</manvolnum></citerefentry>
753 rules. From each matching credential a separate file is created. Example: a passed credential
754 <filename>udev.rules
.50-foobar
</filename> will be copied into a configuration file
755 <filename>/run/udev/rules.d/
50-foobar.rules
</filename>.
</para>
757 <xi:include href=
"version-info.xml" xpointer=
"v256"/>
762 <para>Note, this
<emphasis>does not
</emphasis> imply
<option>--reload
</option> option. So, if
763 <command>systemd-udevd
</command> is already running, please consider to also specify
764 <option>-reload
</option> to make the copied udev rules files used by
765 <command>systemd-udevd
</command>.
</para>
767 <xi:include href=
"version-info.xml" xpointer=
"v256"/>
771 <xi:include href=
"standard-options.xml" xpointer=
"help" />
775 <refsect2><title>udevadm monitor
776 <optional><replaceable>options
</replaceable></optional>
778 <para>Listens to the kernel uevents and events sent out by a udev rule
779 and prints the devpath of the event to the console. It can be used to analyze the
780 event timing, by comparing the timestamps of the kernel uevent and the udev event.
784 <term><option>-k
</option></term>
785 <term><option>--kernel
</option></term>
787 <para>Print the kernel uevents.
</para>
791 <term><option>-u
</option></term>
792 <term><option>--udev
</option></term>
794 <para>Print the udev event after the rule processing.
</para>
798 <term><option>-p
</option></term>
799 <term><option>--property
</option></term>
801 <para>Also print the properties of the event.
</para>
805 <term><option>-s
</option></term>
806 <term><option>--subsystem-match=
<replaceable>string[/string]
</replaceable></option></term>
808 <para>Filter kernel uevents and udev events by subsystem[/devtype]. Only events with a matching subsystem value will pass.
809 When this option is specified more than once, then each matching result is ORed, that is, all devices in the specified
810 subsystems are monitored.
</para>
814 <term><option>-t
</option></term>
815 <term><option>--tag-match=
<replaceable>string
</replaceable></option></term>
817 <para>Filter udev events by tag. Only udev events with a given tag attached will pass.
818 When this option is specified more than once, then each matching result is ORed, that is, devices which have one of the
819 specified tags are monitored.
</para>
823 <xi:include href=
"standard-options.xml" xpointer=
"help" />
827 <refsect2><title>udevadm test
828 <optional><replaceable>options
</replaceable></optional>
829 <optional><replaceable>devpath
</replaceable>|
<replaceable>file
</replaceable>|
<replaceable>unit
</replaceable></optional>
831 <para>Simulate a udev event run for the given device, and print debug output.
</para>
834 <term><option>-a
</option></term>
835 <term><option>--action=
<replaceable>ACTION
</replaceable></option></term>
837 <para>Type of event to be simulated. Possible actions are
<literal>add
</literal>,
838 <literal>remove
</literal>,
<literal>change
</literal>,
<literal>move
</literal>,
839 <literal>online
</literal>,
<literal>offline
</literal>,
<literal>bind
</literal>,
840 and
<literal>unbind
</literal>. Also, the special value
<literal>help
</literal> can be used
841 to list the possible actions. The default value is
<literal>add
</literal>.
</para>
845 <term><option>-N
</option></term>
846 <term><option>--resolve-names=
<constant>early
</constant>|
<constant>late
</constant>|
<constant>never
</constant></option></term>
848 <para>Specify when udevadm should resolve names of users
849 and groups. When set to
<constant>early
</constant> (the
850 default), names will be resolved when the rules are
851 parsed. When set to
<constant>late
</constant>, names will
852 be resolved for every event. When set to
853 <constant>never
</constant>, names will never be resolved
854 and all devices will be owned by root.
</para>
856 <xi:include href=
"version-info.xml" xpointer=
"v209"/>
860 <xi:include href=
"standard-options.xml" xpointer=
"help" />
864 <refsect2><title>udevadm test-builtin
865 <optional><replaceable>options
</replaceable></optional>
866 <replaceable>command
</replaceable>
867 <optional><replaceable>devpath
</replaceable>|
<replaceable>file
</replaceable>|
<replaceable>unit
</replaceable></optional>
869 <para>Run a built-in command
<replaceable>COMMAND
</replaceable>
870 for device
<replaceable>DEVPATH
</replaceable>, and print debug
874 <term><option>-a
</option></term>
875 <term><option>--action=
<replaceable>ACTION
</replaceable></option></term>
877 <para>Type of event to be simulated. Possible actions are
<literal>add
</literal>,
878 <literal>remove
</literal>,
<literal>change
</literal>,
<literal>move
</literal>,
879 <literal>online
</literal>,
<literal>offline
</literal>,
<literal>bind
</literal>,
880 and
<literal>unbind
</literal>. Also, the special value
<literal>help
</literal> can be used
881 to list the possible actions. The default value is
<literal>add
</literal>.
</para>
883 <xi:include href=
"version-info.xml" xpointer=
"v250"/>
887 <xi:include href=
"standard-options.xml" xpointer=
"help" />
888 <xi:include href=
"standard-options.xml" xpointer=
"version" />
893 <title>udevadm verify
894 <optional><replaceable>options
</replaceable></optional>
895 <optional><replaceable>file
</replaceable></optional>
899 <para>Verify syntactic, semantic, and stylistic correctness of udev rules files.
</para>
901 <para>Positional arguments could be used to specify one or more files to check.
902 If no files are specified, the udev rules are read from the files located in
903 the same udev/rules.d directories that are processed by the udev daemon.
</para>
905 <para>The exit status is
<constant>0</constant> if all specified udev
906 rules files are syntactically, semantically, and stylistically correct,
907 and a non-zero error code otherwise.
</para>
911 <term><option>-N
</option></term>
912 <term><option>--resolve-names=
<constant>early
</constant>|
<constant>never
</constant></option></term>
914 <para>Specify when udevadm should resolve names of users
915 and groups. When set to
<constant>early
</constant> (the
916 default), names will be resolved when the rules are
917 parsed. When set to
<constant>never
</constant>, names will
918 never be resolved.
</para>
920 <xi:include href=
"version-info.xml" xpointer=
"v254"/>
925 <term><option>--root=
<replaceable>PATH
</replaceable></option></term>
927 <para>When looking for udev rules files located in udev/rules.d directories,
928 operate on files underneath the specified root path
<replaceable>PATH
</replaceable>.
</para>
930 <xi:include href=
"version-info.xml" xpointer=
"v254"/>
935 <term><option>--no-summary
</option></term>
937 <para>Do not show summary.
</para>
939 <xi:include href=
"version-info.xml" xpointer=
"v254"/>
944 <term><option>--no-style
</option></term>
946 <para>Ignore style issues. When specified, even if style issues are found in udev rules files,
947 the exit status is
<constant>0</constant> if no syntactic or semantic errors are found.
</para>
949 <xi:include href=
"version-info.xml" xpointer=
"v254"/>
953 <xi:include href=
"standard-options.xml" xpointer=
"help" />
959 <optional><replaceable>options
</replaceable></optional>
960 <optional><replaceable>device|syspath
</replaceable></optional>
964 <para>Wait for devices or device symlinks being created and initialized by
965 <command>systemd-udevd
</command>. Each device path must start with
966 <literal>/dev/
</literal> or
<literal>/sys/
</literal>, e.g.
<literal>/dev/sda
</literal>,
967 <literal>/dev/disk/by-path/pci-
0000:
3c:
00.0-nvme-
1-part1
</literal>,
968 <literal>/sys/devices/pci0000:
00/
0000:
00:
1f
.6/net/eth0
</literal>, or
969 <literal>/sys/class/net/eth0
</literal>. This can take multiple devices. This may be useful for
970 waiting for devices being processed by
<command>systemd-udevd
</command> after e.g. partitioning
971 or formatting the devices.
</para>
975 <term><option>-t
</option></term>
976 <term><option>--timeout=
<replaceable>SECONDS
</replaceable></option></term>
978 <para>Maximum number of seconds to wait for the specified devices or device symlinks being
979 created, initialized, or removed. The default value is
<literal>infinity
</literal>.
</para>
981 <xi:include href=
"version-info.xml" xpointer=
"v251"/>
986 <term><option>--initialized=
<replaceable>BOOL
</replaceable></option></term>
988 <para>Check if
<command>systemd-udevd
</command> initialized devices. Defaults to true. When
989 false, the command only checks if the specified devices exist. Set false to this setting if
990 there is no udev rules for the specified devices, as the devices will never be considered
991 as initialized in that case. See Initialized Devices section below for more details.
</para>
993 <xi:include href=
"version-info.xml" xpointer=
"v251"/>
998 <term><option>--removed
</option></term>
1000 <para>When specified, the command wait for devices being removed instead of created or
1001 initialized. If this is specified,
<option>--initialized=
</option> will be ignored.
</para>
1003 <xi:include href=
"version-info.xml" xpointer=
"v251"/>
1008 <term><option>--settle
</option></term>
1010 <para>When specified, also watches the udev event queue, and wait for all queued events
1011 being processed by
<command>systemd-udevd
</command>.
</para>
1013 <xi:include href=
"version-info.xml" xpointer=
"v251"/>
1017 <xi:include href=
"standard-options.xml" xpointer=
"help" />
1023 <optional><replaceable>options
</replaceable></optional>
1024 <optional><replaceable>command
</replaceable></optional>
1028 <para><command>udevadm lock
</command> takes an (advisory) exclusive lock on a block device (or all
1029 specified devices), as per
<ulink url=
"https://systemd.io/BLOCK_DEVICE_LOCKING">Locking Block Device
1030 Access
</ulink> and invokes a program with the locks taken. When the invoked program exits the locks
1031 are automatically released and its return value is propagated as exit code of
<command>udevadm
1032 lock
</command>.
</para>
1034 <para>This tool is in particular useful to ensure that
1035 <citerefentry><refentrytitle>systemd-udevd.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1036 does not probe a block device while changes are made to it, for example partitions created or file
1037 systems formatted. Note that many tools that interface with block devices natively support taking
1038 relevant locks, see for example
1039 <citerefentry project='man-pages'
><refentrytitle>sfdisk
</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
1040 <option>--lock
</option> switch.
</para>
1042 <para>The command expects at least one block device specified via
<option>--device=
</option> or
1043 <option>--backing=
</option>, and a command line to execute as arguments.
</para>
1047 <term><option>--device=
<replaceable>DEVICE
</replaceable></option></term>
1048 <term><option>-d
<replaceable>DEVICE
</replaceable></option></term>
1050 <listitem><para>Takes a path to a device node of the device to lock. This switch may be used
1051 multiple times (and in combination with
<option>--backing=
</option>) in order to lock multiple
1052 devices. If a partition block device node is specified the containing
"whole" block device is
1053 automatically determined and used for the lock, as per the specification. If multiple devices are
1054 specified, they are deduplicated, sorted by the major/minor of their device nodes and then locked
1057 <para>This switch must be used at least once, to specify at least one device to
1058 lock. (Alternatively, use
<option>--backing=
</option>, see below.)
</para>
1060 <xi:include href=
"version-info.xml" xpointer=
"v251"/></listitem>
1064 <term><option>--backing=
<replaceable>PATH
</replaceable></option></term>
1065 <term><option>-b
<replaceable>PATH
</replaceable></option></term>
1067 <listitem><para>If a path to a device node is specified, identical to
1068 <option>--device=
</option>. However, this switch alternatively accepts a path to a regular file or
1069 directory, in which case the block device of the file system the file/directory resides on is
1070 automatically determined and used as if it was specified with
1071 <option>--device=
</option>.
</para>
1073 <xi:include href=
"version-info.xml" xpointer=
"v251"/></listitem>
1077 <term><option>--timeout=
<replaceable>SECS
</replaceable></option></term>
1078 <term><option>-t
<replaceable>SECS
</replaceable></option></term>
1080 <listitem><para>Specifies how long to wait at most until all locks can be taken. Takes a value in
1081 seconds, or in the usual supported time units, see
1082 <citerefentry><refentrytitle>systemd.time
</refentrytitle><manvolnum>7</manvolnum></citerefentry>. If
1083 specified as zero the lock is attempted and if not successful the invocation will immediately
1084 fail. If passed as
<literal>infinity
</literal> (the default) the invocation will wait indefinitely
1085 until the lock can be acquired. If the lock cannot be taken in the specified time the specified
1086 command will not be executed and the invocation will fail.
</para>
1088 <xi:include href=
"version-info.xml" xpointer=
"v251"/></listitem>
1092 <term><option>--print
</option></term>
1093 <term><option>-p
</option></term>
1095 <listitem><para>Instead of locking the specified devices and executing a command, just print the
1096 device paths that would be locked, and execute no command. This command is useful to determine
1097 the
"whole" block device in case a partition block device is specified. The devices will be sorted
1098 by their device node major number as primary ordering key and the minor number as secondary
1099 ordering key (i.e. they are shown in the order they'd be locked). Note that the number of lines
1100 printed here can be less than the number of
<option>--device=
</option> and
1101 <option>--backing=
</option> switches specified in case these resolve to the same
"whole"
1104 <xi:include href=
"version-info.xml" xpointer=
"v251"/></listitem>
1107 <xi:include href=
"standard-options.xml" xpointer=
"help" />
1113 <title>Initialized Devices
</title>
1115 <para>Initialized devices are those for which at least one udev rule already completed execution
1116 – for any action but
<literal>remove
</literal> — that set a property or other device setting (and
1117 thus has an entry in the udev device database). Devices are no longer considered initialized if a
1118 <literal>remove
</literal> action is seen for them (which removes their entry in the udev device
1119 database). Note that devices that have no udev rules are never considered initialized, but might
1120 still be announced via the sd-device API (or similar).
</para>
1124 <title>Example
</title>
1127 <title>Format a File System
</title>
1129 <para>Take a lock on the backing block device while creating a file system, to ensure that
1130 <command>systemd-udevd
</command> doesn't probe or announce the new superblock before it is
1131 comprehensively written:
</para>
1133 <programlisting># udevadm lock --device=/dev/sda1 mkfs.ext4 /dev/sda1
</programlisting>
1137 <title>Format a RAID File System
</title>
1139 <para>Similar, but take locks on multiple devices at once:
</para>
1141 <programlisting># udevadm lock --device=/dev/sda1 --device=/dev/sdb1 mkfs.btrfs /dev/sda1 /dev/sdb1
</programlisting>
1145 <title>Copy in a File System
</title>
1147 <para>Take a lock on the backing block device while copying in a prepared file system image, to ensure
1148 that
<command>systemd-udevd
</command> doesn't probe or announce the new superblock before it is fully
1151 <programlisting># udevadm lock -d /dev/sda1 dd if=fs.raw of=/dev/sda1
</programlisting>
1156 <title>See Also
</title>
1157 <para><simplelist type=
"inline">
1158 <member><citerefentry>
1159 <refentrytitle>udev
</refentrytitle><manvolnum>7</manvolnum>
1160 </citerefentry></member>
1161 <member><citerefentry>
1162 <refentrytitle>systemd-udevd.service
</refentrytitle><manvolnum>8</manvolnum>
1163 </citerefentry></member>
1164 </simplelist></para>