]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/udev.xml
man: fix link markup
[thirdparty/systemd.git] / man / udev.xml
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 SPDX-License-Identifier: LGPL-2.1+
7 Copyright © 2014 Jason St. John
8 -->
9
10 <refentry id="udev">
11 <refentryinfo>
12 <title>udev</title>
13 <productname>systemd</productname>
14 </refentryinfo>
15
16 <refmeta>
17 <refentrytitle>udev</refentrytitle>
18 <manvolnum>7</manvolnum>
19 </refmeta>
20
21 <refnamediv>
22 <refname>udev</refname>
23 <refpurpose>Dynamic device management</refpurpose>
24 </refnamediv>
25
26 <refsect1><title>Description</title>
27 <para>udev supplies the system software with device events, manages permissions
28 of device nodes and may create additional symlinks in the <filename>/dev</filename>
29 directory, or renames network interfaces. The kernel usually just assigns unpredictable
30 device names based on the order of discovery. Meaningful symlinks or network device
31 names provide a way to reliably identify devices based on their properties or
32 current configuration.</para>
33
34 <para>The udev daemon, <citerefentry><refentrytitle>systemd-udevd.service</refentrytitle>
35 <manvolnum>8</manvolnum></citerefentry>, receives device uevents directly from
36 the kernel whenever a device is added or removed from the system, or it changes its
37 state. When udev receives a device event, it matches its configured set of rules
38 against various device attributes to identify the device. Rules that match may
39 provide additional device information to be stored in the udev database or
40 to be used to create meaningful symlink names.</para>
41
42 <para>All device information udev processes is stored in the udev database and
43 sent out to possible event subscribers. Access to all stored data and the event
44 sources is provided by the library libudev.</para>
45 </refsect1>
46
47 <refsect1><title>Rules Files</title>
48 <para>The udev rules are read from the files located in the system rules directories
49 <filename>/usr/lib/udev/rules.d</filename> and <filename>/usr/local/lib/udev/rules.d</filename>, the
50 volatile runtime directory <filename>/run/udev/rules.d</filename> and the local administration
51 directory <filename>/etc/udev/rules.d</filename>. All rules files are collectively sorted and
52 processed in lexical order, regardless of the directories in which they live. However, files with
53 identical filenames replace each other. Files in <filename>/etc</filename> have the highest priority,
54 files in <filename>/run</filename> take precedence over files with the same name under
55 <filename>/usr</filename>. This can be used to override a system-supplied rules file with a local
56 file if needed; a symlink in <filename>/etc</filename> with the same name as a rules file in
57 <filename>/usr/lib</filename>, pointing to <filename>/dev/null</filename>, disables the rules file
58 entirely. Rule files must have the extension <filename>.rules</filename>; other extensions are
59 ignored.</para>
60
61 <para>Every line in the rules file contains at least one key-value pair.
62 Except for empty lines or lines beginning with <literal>#</literal>, which are ignored.
63 There are two kinds of keys: match and assignment.
64 If all match keys match against their values, the rule gets applied and the
65 assignment keys get the specified values assigned.</para>
66
67 <para>A matching rule may rename a network interface, add symlinks
68 pointing to the device node, or run a specified program as part of
69 the event handling.</para>
70
71 <para>A rule consists of a comma-separated list of one or more key-value pairs.
72 Each key has a distinct operation, depending on the used operator. Valid
73 operators are:</para>
74 <variablelist>
75 <varlistentry>
76 <term><literal>==</literal></term>
77 <listitem>
78 <para>Compare for equality.</para>
79 </listitem>
80 </varlistentry>
81
82 <varlistentry>
83 <term><literal>!=</literal></term>
84 <listitem>
85 <para>Compare for inequality.</para>
86 </listitem>
87 </varlistentry>
88
89 <varlistentry>
90 <term><literal>=</literal></term>
91 <listitem>
92 <para>Assign a value to a key. Keys that represent a list are reset
93 and only this single value is assigned.</para>
94 </listitem>
95 </varlistentry>
96
97 <varlistentry>
98 <term><literal>+=</literal></term>
99 <listitem>
100 <para>Add the value to a key that holds a list of entries.</para>
101 </listitem>
102 </varlistentry>
103
104 <varlistentry>
105 <term><literal>-=</literal></term>
106 <listitem>
107 <para>Remove the value from a key that holds a list of entries.</para>
108 </listitem>
109 </varlistentry>
110
111 <varlistentry>
112 <term><literal>:=</literal></term>
113 <listitem>
114 <para>Assign a value to a key finally; disallow any later changes.</para>
115 </listitem>
116 </varlistentry>
117 </variablelist>
118
119 <para>The following key names can be used to match against device properties.
120 Some of the keys also match against properties of the parent devices in sysfs,
121 not only the device that has generated the event. If multiple keys that match
122 a parent device are specified in a single rule, all these keys must match at
123 one and the same parent device.</para>
124 <variablelist class='udev-directives'>
125 <varlistentry>
126 <term><varname>ACTION</varname></term>
127 <listitem>
128 <para>Match the name of the event action.</para>
129 </listitem>
130 </varlistentry>
131
132 <varlistentry>
133 <term><varname>DEVPATH</varname></term>
134 <listitem>
135 <para>Match the devpath of the event device.</para>
136 </listitem>
137 </varlistentry>
138
139 <varlistentry>
140 <term><varname>KERNEL</varname></term>
141 <listitem>
142 <para>Match the name of the event device.</para>
143 </listitem>
144 </varlistentry>
145
146 <varlistentry>
147 <term><varname>NAME</varname></term>
148 <listitem>
149 <para>Match the name of a network interface. It can be used once the
150 NAME key has been set in one of the preceding rules.</para>
151 </listitem>
152 </varlistentry>
153
154 <varlistentry>
155 <term><varname>SYMLINK</varname></term>
156 <listitem>
157 <para>Match the name of a symlink targeting the node. It can
158 be used once a SYMLINK key has been set in one of the preceding
159 rules. There may be multiple symlinks; only one needs to match.
160 </para>
161 </listitem>
162 </varlistentry>
163
164 <varlistentry>
165 <term><varname>SUBSYSTEM</varname></term>
166 <listitem>
167 <para>Match the subsystem of the event device.</para>
168 </listitem>
169 </varlistentry>
170 <varlistentry>
171 <term><varname>DRIVER</varname></term>
172 <listitem>
173 <para>Match the driver name of the event device. Only set this key for devices
174 which are bound to a driver at the time the event is generated.</para>
175 </listitem>
176 </varlistentry>
177 <varlistentry>
178 <term><varname>ATTR{<replaceable>filename</replaceable>}</varname></term>
179 <listitem>
180 <para>Match sysfs attribute values of the event device. Trailing
181 whitespace in the attribute values is ignored unless the specified match
182 value itself contains trailing whitespace.
183 </para>
184 </listitem>
185 </varlistentry>
186 <varlistentry>
187 <term><varname>SYSCTL{<replaceable>kernel parameter</replaceable>}</varname></term>
188 <listitem>
189 <para>Match a kernel parameter value.
190 </para>
191 </listitem>
192 </varlistentry>
193
194 <varlistentry>
195 <term><varname>KERNELS</varname></term>
196 <listitem>
197 <para>Search the devpath upwards for a matching device name.</para>
198 </listitem>
199 </varlistentry>
200
201 <varlistentry>
202 <term><varname>SUBSYSTEMS</varname></term>
203 <listitem>
204 <para>Search the devpath upwards for a matching device subsystem name.</para>
205 </listitem>
206 </varlistentry>
207
208 <varlistentry>
209 <term><varname>DRIVERS</varname></term>
210 <listitem>
211 <para>Search the devpath upwards for a matching device driver name.</para>
212 </listitem>
213 </varlistentry>
214
215 <varlistentry>
216 <term><varname>ATTRS{<replaceable>filename</replaceable>}</varname></term>
217 <listitem>
218 <para>Search the devpath upwards for a device with matching sysfs attribute values.
219 If multiple <varname>ATTRS</varname> matches are specified, all of them
220 must match on the same device. Trailing whitespace in the attribute values is ignored
221 unless the specified match value itself contains trailing whitespace.</para>
222 </listitem>
223 </varlistentry>
224
225 <varlistentry>
226 <term><varname>TAGS</varname></term>
227 <listitem>
228 <para>Search the devpath upwards for a device with matching tag.</para>
229 </listitem>
230 </varlistentry>
231
232 <varlistentry>
233 <term><varname>ENV{<replaceable>key</replaceable>}</varname></term>
234 <listitem>
235 <para>Match against a device property value.</para>
236 </listitem>
237 </varlistentry>
238
239 <varlistentry>
240 <term><varname>CONST{<replaceable>key</replaceable>}</varname></term>
241 <listitem>
242 <para>Match against a system-wide constant. Supported keys are:</para>
243 <variablelist>
244 <varlistentry>
245 <term><literal>arch</literal></term>
246 <listitem>
247 <para>System's architecture. See <option>ConditionArchitecture=</option> in
248 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
249 for possible values.</para>
250 </listitem>
251 </varlistentry>
252 <varlistentry>
253 <term><literal>virt</literal></term>
254 <listitem>
255 <para>System's virtualization environment. See
256 <citerefentry><refentrytitle>systemd-detect-virt</refentrytitle><manvolnum>1</manvolnum></citerefentry>
257 for possible values.</para>
258 </listitem>
259 </varlistentry>
260 </variablelist>
261 <para>Unknown keys will never match.</para>
262 </listitem>
263 </varlistentry>
264
265 <varlistentry>
266 <term><varname>TAG</varname></term>
267 <listitem>
268 <para>Match against a device tag.</para>
269 </listitem>
270 </varlistentry>
271
272 <varlistentry>
273 <term><varname>TEST{<replaceable>octal mode mask</replaceable>}</varname></term>
274 <listitem>
275 <para>Test the existence of a file. An octal mode mask can be specified
276 if needed.</para>
277 </listitem>
278 </varlistentry>
279
280 <varlistentry>
281 <term><varname>PROGRAM</varname></term>
282 <listitem>
283 <para>Execute a program to determine whether there is a match; the key is true if the program
284 returns successfully. The device properties are made available to the executed program in the
285 environment. The program's standard output is available in the <varname>RESULT</varname>
286 key.</para>
287
288 <para>This can only be used for very short-running foreground tasks. For details, see
289 <varname>RUN</varname>.</para>
290
291 <para>Note that multiple <varname>PROGRAM</varname> keys may be specified in one rule, and
292 <literal>=</literal>, <literal>:=</literal>, and <literal>+=</literal> have the same effect as
293 <literal>==</literal>.</para>
294 </listitem>
295 </varlistentry>
296
297 <varlistentry>
298 <term><varname>RESULT</varname></term>
299 <listitem>
300 <para>Match the returned string of the last <varname>PROGRAM</varname> call.
301 This key can be used in the same or in any later rule after a
302 <varname>PROGRAM</varname> call.</para>
303 </listitem>
304 </varlistentry>
305 </variablelist>
306
307 <para>Most of the fields support shell glob pattern matching and
308 alternate patterns. The following special characters are supported:</para>
309 <variablelist>
310 <varlistentry>
311 <term><literal>*</literal></term>
312 <listitem>
313 <para>Matches zero or more characters.</para>
314 </listitem>
315 </varlistentry>
316 <varlistentry>
317 <term><literal>?</literal></term>
318 <listitem>
319 <para>Matches any single character.</para>
320 </listitem>
321 </varlistentry>
322 <varlistentry>
323 <term><literal>[]</literal></term>
324 <listitem>
325 <para>Matches any single character specified within the brackets. For
326 example, the pattern string <literal>tty[SR]</literal>
327 would match either <literal>ttyS</literal> or <literal>ttyR</literal>.
328 Ranges are also supported via the <literal>-</literal> character.
329 For example, to match on the range of all digits, the pattern
330 <literal>[0-9]</literal> could be used. If the first character
331 following the <literal>[</literal> is a <literal>!</literal>,
332 any characters not enclosed are matched.</para>
333 </listitem>
334 </varlistentry>
335 <varlistentry>
336 <term><literal>|</literal></term>
337 <listitem>
338 <para>Separates alternative patterns. For example, the pattern string
339 <literal>abc|x*</literal> would match either <literal>abc</literal>
340 or <literal>x*</literal>.</para>
341 </listitem>
342 </varlistentry>
343 </variablelist>
344
345 <para>The following keys can get values assigned:</para>
346 <variablelist class='udev-directives'>
347 <varlistentry>
348 <term><varname>NAME</varname></term>
349 <listitem>
350 <para>The name to use for a network interface. See
351 <citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>
352 for a higher-level mechanism for setting the interface name.
353 The name of a device node cannot be changed by udev, only additional
354 symlinks can be created.</para>
355 </listitem>
356 </varlistentry>
357
358 <varlistentry>
359 <term><varname>SYMLINK</varname></term>
360 <listitem>
361 <para>The name of a symlink targeting the node. Every matching rule adds
362 this value to the list of symlinks to be created.</para>
363 <para>The set of characters to name a symlink is limited. Allowed
364 characters are <literal>0-9A-Za-z#+-.:=@_/</literal>, valid UTF-8 character
365 sequences, and <literal>\x00</literal> hex encoding. All other
366 characters are replaced by a <literal>_</literal> character.</para>
367 <para>Multiple symlinks may be specified by separating the names by the
368 space character. In case multiple devices claim the same name, the link
369 always points to the device with the highest link_priority. If the current
370 device goes away, the links are re-evaluated and the device with the
371 next highest link_priority becomes the owner of the link. If no
372 link_priority is specified, the order of the devices (and which one of
373 them owns the link) is undefined.</para>
374 <para>Symlink names must never conflict with the kernel's default device
375 node names, as that would result in unpredictable behavior.
376 </para>
377 </listitem>
378 </varlistentry>
379
380 <varlistentry>
381 <term><varname>OWNER</varname>, <varname>GROUP</varname>, <varname>MODE</varname></term>
382 <listitem>
383 <para>The permissions for the device node. Every specified value overrides
384 the compiled-in default value.</para>
385 </listitem>
386 </varlistentry>
387
388 <varlistentry>
389 <term><varname>SECLABEL{<replaceable>module</replaceable>}</varname></term>
390 <listitem>
391 <para>Applies the specified Linux Security Module label to the device node.</para>
392 </listitem>
393 </varlistentry>
394
395 <varlistentry>
396 <term><varname>ATTR{<replaceable>key</replaceable>}</varname></term>
397 <listitem>
398 <para>The value that should be written to a sysfs attribute of the
399 event device.</para>
400 </listitem>
401 </varlistentry>
402
403 <varlistentry>
404 <term><varname>SYSCTL{<replaceable>kernel parameter</replaceable>}</varname></term>
405 <listitem>
406 <para>The value that should be written to kernel parameter.</para>
407 </listitem>
408 </varlistentry>
409
410 <varlistentry>
411 <term><varname>ENV{<replaceable>key</replaceable>}</varname></term>
412 <listitem>
413 <para>Set a device property value. Property names with a leading <literal>.</literal>
414 are neither stored in the database nor exported to events or
415 external tools (run by, for example, the <varname>PROGRAM</varname>
416 match key).</para>
417 </listitem>
418 </varlistentry>
419
420 <varlistentry>
421 <term><varname>TAG</varname></term>
422 <listitem>
423 <para>Attach a tag to a device. This is used to filter events for users
424 of libudev's monitor functionality, or to enumerate a group of tagged
425 devices. The implementation can only work efficiently if only a few
426 tags are attached to a device. It is only meant to be used in
427 contexts with specific device filter requirements, and not as a
428 general-purpose flag. Excessive use might result in inefficient event
429 handling.</para>
430 </listitem>
431 </varlistentry>
432
433 <varlistentry>
434 <term><varname>RUN{<replaceable>type</replaceable>}</varname></term>
435 <listitem>
436 <para>Specify a program to be executed after processing of all the rules for the event. With
437 <literal>+=</literal>, this invocation is added to the list, and with <literal>=</literal> or
438 <literal>:=</literal>, it replaces any previous contents of the list. Please note that both
439 <literal>program</literal> and <literal>builtin</literal> types described below use a single
440 list, so clearing the list with <literal>:=</literal> and <literal>=</literal> affects both
441 types.</para>
442
443 <para><replaceable>type</replaceable> may be:</para>
444 <variablelist>
445 <varlistentry>
446 <term><literal>program</literal></term>
447 <listitem>
448 <para>Execute an external program specified as the assigned
449 value. If no absolute path is given, the program is expected
450 to live in <filename>/usr/lib/udev</filename>; otherwise, the
451 absolute path must be specified.</para>
452 <para>This is the default if no <replaceable>type</replaceable>
453 is specified.</para>
454 </listitem>
455 </varlistentry>
456 <varlistentry>
457 <term><literal>builtin</literal></term>
458 <listitem>
459 <para>As <varname>program</varname>, but use one of the
460 built-in programs rather than an external one.</para>
461 </listitem>
462 </varlistentry>
463 </variablelist>
464
465 <para>The program name and following arguments are separated by spaces. Single quotes can be
466 used to specify arguments with spaces.</para>
467
468 <para>This can only be used for very short-running foreground tasks. Running an event process for
469 a long period of time may block all further events for this or a dependent device.</para>
470
471 <para>Note that running programs that access the network or mount/unmount filesystems is not
472 allowed inside of udev rules, due to the default sandbox that is enforced on
473 <filename>systemd-udevd.service</filename>.</para>
474
475 <para>Starting daemons or other long-running processes is not allowed; the forked processes,
476 detached or not, will be unconditionally killed after the event handling has finished. In order
477 to activate long-running processes from udev rules, provide a service unit and pull it in from a
478 udev device using the <varname>SYSTEMD_WANTS</varname> device property. See
479 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>
480 for details.</para>
481 </listitem>
482 </varlistentry>
483
484 <varlistentry>
485 <term><varname>LABEL</varname></term>
486 <listitem>
487 <para>A named label to which a <varname>GOTO</varname> may jump.</para>
488 </listitem>
489 </varlistentry>
490
491 <varlistentry>
492 <term><varname>GOTO</varname></term>
493 <listitem>
494 <para>Jumps to the next <varname>LABEL</varname> with a matching name.</para>
495 </listitem>
496 </varlistentry>
497
498 <varlistentry>
499 <term><varname>IMPORT{<replaceable>type</replaceable>}</varname></term>
500 <listitem>
501 <para>Import a set of variables as device properties, depending on
502 <replaceable>type</replaceable>:</para>
503
504 <variablelist>
505 <varlistentry>
506 <term><literal>program</literal></term>
507 <listitem>
508 <para>Execute an external program specified as the assigned
509 value and, if it returns successfully,
510 import its output, which must be in environment key
511 format. Path specification, command/argument separation,
512 and quoting work like in <varname>RUN</varname>.</para>
513 </listitem>
514 </varlistentry>
515 <varlistentry>
516 <term><literal>builtin</literal></term>
517 <listitem>
518 <para>Similar to <literal>program</literal>, but use one of the
519 built-in programs rather than an external one.</para>
520 </listitem>
521 </varlistentry>
522 <varlistentry>
523 <term><literal>file</literal></term>
524 <listitem>
525 <para>Import a text file specified as the assigned value, the content
526 of which must be in environment key format.</para>
527 </listitem>
528 </varlistentry>
529 <varlistentry>
530 <term><literal>db</literal></term>
531 <listitem>
532 <para>Import a single property specified as the assigned value from the
533 current device database. This works only if the database is already populated
534 by an earlier event.</para>
535 </listitem>
536 </varlistentry>
537 <varlistentry>
538 <term><literal>cmdline</literal></term>
539 <listitem>
540 <para>Import a single property from the kernel command line. For simple flags
541 the value of the property is set to <literal>1</literal>.</para>
542 </listitem>
543 </varlistentry>
544 <varlistentry>
545 <term><literal>parent</literal></term>
546 <listitem>
547 <para>Import the stored keys from the parent device by reading
548 the database entry of the parent device. The value assigned to
549 <option>IMPORT{parent}</option> is used as a filter of key names
550 to import (with the same shell glob pattern matching used for
551 comparisons).</para>
552 </listitem>
553 </varlistentry>
554 </variablelist>
555
556 <para>This can only be used for very short-running foreground tasks. For details see
557 <option>RUN</option>.</para>
558
559 <para>Note that multiple <varname>IMPORT{}</varname> keys may be specified in one rule, and
560 <literal>=</literal>, <literal>:=</literal>, and <literal>+=</literal> have the same effect as
561 <literal>==</literal>. The key is true if the import is successful, unless <literal>!=</literal>
562 is used as the operator which causes the key to be true if the import failed.</para>
563 </listitem>
564 </varlistentry>
565
566 <varlistentry>
567 <term><varname>OPTIONS</varname></term>
568 <listitem>
569 <para>Rule and device options:</para>
570 <variablelist class='udev-directives'>
571 <varlistentry>
572 <term><option>link_priority=<replaceable>value</replaceable></option></term>
573 <listitem>
574 <para>Specify the priority of the created symlinks. Devices with higher
575 priorities overwrite existing symlinks of other devices. The default is 0.</para>
576 </listitem>
577 </varlistentry>
578 <varlistentry>
579 <term><option>string_escape=<replaceable>none|replace</replaceable></option></term>
580 <listitem>
581 <para>Usually, control and other possibly unsafe characters are replaced
582 in strings used for device naming. The mode of replacement can be specified
583 with this option.</para>
584 </listitem>
585 </varlistentry>
586 <varlistentry>
587 <term><option>static_node=</option></term>
588 <listitem>
589 <para>Apply the permissions specified in this rule to the
590 static device node with the specified name. Also, for every
591 tag specified in this rule, create a symlink
592 in the directory
593 <filename>/run/udev/static_node-tags/<replaceable>tag</replaceable></filename>
594 pointing at the static device node with the specified name.
595 Static device node creation is performed by systemd-tmpfiles
596 before systemd-udevd is started. The static nodes might not
597 have a corresponding kernel device; they are used to trigger
598 automatic kernel module loading when they are accessed.</para>
599 </listitem>
600 </varlistentry>
601 <varlistentry>
602 <term><option>watch</option></term>
603 <listitem>
604 <para>Watch the device node with inotify; when the node is
605 closed after being opened for writing, a change uevent is
606 synthesized.</para>
607 </listitem>
608 </varlistentry>
609 <varlistentry>
610 <term><option>nowatch</option></term>
611 <listitem>
612 <para>Disable the watching of a device node with inotify.</para>
613 </listitem>
614 </varlistentry>
615 <varlistentry>
616 <term><option>db_persist</option></term>
617 <listitem>
618 <para>Set the flag (sticky bit) on the udev database entry
619 of the event device. Device properties are then kept in the
620 database even when
621 <command>udevadm info --cleanup-db</command> is called.
622 This option can be useful in certain cases
623 (e.g. Device Mapper devices) for persisting device state
624 on the transition from initramfs.</para>
625 </listitem>
626 </varlistentry>
627 </variablelist>
628 </listitem>
629 </varlistentry>
630 </variablelist>
631
632 <para>The <varname>NAME</varname>, <varname>SYMLINK</varname>,
633 <varname>PROGRAM</varname>, <varname>OWNER</varname>,
634 <varname>GROUP</varname>, <varname>MODE</varname>, <varname>SECLABEL</varname>,
635 and <varname>RUN</varname> fields support simple string substitutions.
636 The <varname>RUN</varname> substitutions are performed after all rules
637 have been processed, right before the program is executed, allowing for
638 the use of device properties set by earlier matching rules. For all other
639 fields, substitutions are performed while the individual rule is being
640 processed. The available substitutions are:</para>
641 <variablelist class='udev-directives'>
642 <varlistentry>
643 <term><option>$kernel</option>, <option>%k</option></term>
644 <listitem>
645 <para>The kernel name for this device.</para>
646 </listitem>
647 </varlistentry>
648
649 <varlistentry>
650 <term><option>$number</option>, <option>%n</option></term>
651 <listitem>
652 <para>The kernel number for this device. For example, <literal>sda3</literal> has kernel number
653 3.</para>
654 </listitem>
655 </varlistentry>
656
657 <varlistentry>
658 <term><option>$devpath</option>, <option>%p</option></term>
659 <listitem>
660 <para>The devpath of the device.</para>
661 </listitem>
662 </varlistentry>
663
664 <varlistentry>
665 <term><option>$id</option>, <option>%b</option></term>
666 <listitem>
667 <para>The name of the device matched while searching the devpath
668 upwards for <option>SUBSYSTEMS</option>, <option>KERNELS</option>,
669 <option>DRIVERS</option>, and <option>ATTRS</option>.
670 </para>
671 </listitem>
672 </varlistentry>
673
674 <varlistentry>
675 <term><option>$driver</option></term>
676 <listitem>
677 <para>The driver name of the device matched while searching the
678 devpath upwards for <option>SUBSYSTEMS</option>,
679 <option>KERNELS</option>, <option>DRIVERS</option>, and
680 <option>ATTRS</option>.
681 </para>
682 </listitem>
683 </varlistentry>
684
685 <varlistentry>
686 <term><option>$attr{<replaceable>file</replaceable>}</option>, <option>%s{<replaceable>file</replaceable>}</option></term>
687 <listitem>
688 <para>The value of a sysfs attribute found at the device where
689 all keys of the rule have matched. If the matching device does not
690 have such an attribute, and a previous <option>KERNELS</option>,
691 <option>SUBSYSTEMS</option>, <option>DRIVERS</option>, or
692 <option>ATTRS</option> test selected a parent device, then the
693 attribute from that parent device is used.
694 </para>
695 <para>If the attribute is a symlink, the last element of the
696 symlink target is returned as the value.
697 </para>
698 </listitem>
699 </varlistentry>
700
701 <varlistentry>
702 <term><option>$env{<replaceable>key</replaceable>}</option>, <option>%E{<replaceable>key</replaceable>}</option></term>
703 <listitem>
704 <para>A device property value.</para>
705 </listitem>
706 </varlistentry>
707
708 <varlistentry>
709 <term><option>$major</option>, <option>%M</option></term>
710 <listitem>
711 <para>The kernel major number for the device.</para>
712 </listitem>
713 </varlistentry>
714
715 <varlistentry>
716 <term><option>$minor</option>, <option>%m</option></term>
717 <listitem>
718 <para>The kernel minor number for the device.</para>
719 </listitem>
720 </varlistentry>
721
722 <varlistentry>
723 <term><option>$result</option>, <option>%c</option></term>
724 <listitem>
725 <para>The string returned by the external program requested with
726 <varname>PROGRAM</varname>.
727 A single part of the string, separated by a space character, may be selected
728 by specifying the part number as an attribute: <literal>%c{N}</literal>.
729 If the number is followed by the <literal>+</literal> character, this part plus all remaining parts
730 of the result string are substituted: <literal>%c{N+}</literal>.</para>
731 </listitem>
732 </varlistentry>
733
734 <varlistentry>
735 <term><option>$parent</option>, <option>%P</option></term>
736 <listitem>
737 <para>The node name of the parent device.</para>
738 </listitem>
739 </varlistentry>
740
741 <varlistentry>
742 <term><option>$name</option></term>
743 <listitem>
744 <para>The current name of the device. If not changed by a rule, it is the
745 name of the kernel device.</para>
746 </listitem>
747 </varlistentry>
748
749 <varlistentry>
750 <term><option>$links</option></term>
751 <listitem>
752 <para>A space-separated list of the current symlinks. The value is
753 only set during a remove event or if an earlier rule assigned a value.</para>
754 </listitem>
755 </varlistentry>
756
757 <varlistentry>
758 <term><option>$root</option>, <option>%r</option></term>
759 <listitem>
760 <para>The udev_root value.</para>
761 </listitem>
762 </varlistentry>
763
764 <varlistentry>
765 <term><option>$sys</option>, <option>%S</option></term>
766 <listitem>
767 <para>The sysfs mount point.</para>
768 </listitem>
769 </varlistentry>
770
771 <varlistentry>
772 <term><option>$devnode</option>, <option>%N</option></term>
773 <listitem>
774 <para>The name of the device node.</para>
775 </listitem>
776 </varlistentry>
777
778 <varlistentry>
779 <term><option>%%</option></term>
780 <listitem>
781 <para>The <literal>%</literal> character itself.</para>
782 </listitem>
783 </varlistentry>
784
785 <varlistentry>
786 <term><option>$$</option></term>
787 <listitem>
788 <para>The <literal>$</literal> character itself.</para>
789 </listitem>
790 </varlistentry>
791 </variablelist>
792 </refsect1>
793
794 <refsect1>
795 <title>See Also</title>
796 <para>
797 <citerefentry>
798 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
799 </citerefentry>,
800 <citerefentry>
801 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
802 </citerefentry>,
803 <citerefentry>
804 <refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum>
805 </citerefentry>
806 </para>
807 </refsect1>
808 </refentry>