chiark / gitweb /
update RELEASE-NOTES + TODO
[elogind.git] / udev.8
1 .\" ** You probably do not want to edit this file directly **
2 .\" It was generated using the DocBook XSL Stylesheets (version 1.69.0).
3 .\" Instead of manually editing it, you probably should edit the DocBook XML
4 .\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
5 .TH "UDEV" "8" "August 2005" "udev" "udev"
6 .\" disable hyphenation
7 .nh
8 .\" disable justification (adjust text to left margin only)
9 .ad l
10 .SH "NAME"
11 udev \- dynamic device management
12 .SH "DESCRIPTION"
13 .PP
14 udev provides a dynamic device directory containing only the files for actually present devices. It creates or removes device node files in the 
15 \fI/dev\fR 
16 directory, or it renames network interfaces.
17 .PP
18 Usually udev runs as 
19 \fBudevd\fR(8) 
20 and receives uevents directly from the kernel if a device is added or removed form the system.
21 .PP
22 If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device. Rules that match, may provide additional device information or specify a device node name and multiple symlink names and instruct udev to run additional programs as part of the device event handling.
23 .SH "CONFIGURATION"
24 .PP
25 All udev configuration files are placed in 
26 \fI/etc/udev/*\fR. Every file consist of a set of lines of text. All empty lines or lines beginning with '#' will be ignored.
27 .SS "Configuration file"
28 .PP
29 udev expects its main configuration file at 
30 \fI/etc/udev/udev.conf\fR. It consists of a set of variables allowing the user to override default udev values. The following variables can be set:
31 .TP
32 \fBudev_root\fR
33 Specifies where to place the device nodes in the filesystem. The default value is 
34 \fI/dev\fR.
35 .TP
36 \fBudev_rules\fR
37 The name of the udev rules file or directory to look for files with the suffix 
38 \fI.rules\fR. Multiple rule files are read in lexical order. The default value is 
39 \fI/etc/udev/rules.d\fR.
40 .TP
41 \fBudev_log\fR
42 The logging priority. Valid values are the numerical syslog priorities or their textual representations: 
43 \fBerr\fR, 
44 \fBinfo\fR 
45 and 
46 \fBdebug\fR.
47 .SS "Rules files"
48 .PP
49 The udev rules are read from the files located in the 
50 \fI/etc/udev/rules.d\fR 
51 directory or at the location specified value in the configuraton file. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignement keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used.
52 .PP
53 A rule may consists of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are:
54 .TP
55 \fB==\fR
56 Compare for equality.
57 .TP
58 \fB!=\fR
59 Compare for non\-equality.
60 .TP
61 \fB=\fR
62 Asign a value to a key. Keys that represent a list, are reset and only this single value is assigned.
63 .TP
64 \fB+=\fR
65 Add the value to a key that holds a list of entries.
66 .TP
67 \fB:=\fR
68 Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules.
69 .PP
70 The following key names can be used to match against device properties:
71 .TP
72 \fBACTION\fR
73 Match the kernel action name.
74 .TP
75 \fBKERNEL\fR
76 Match the kernel device name
77 .TP
78 \fBDEVPATH\fR
79 Match the kernel devpath.
80 .TP
81 \fBSUBSYSTEM\fR
82 Match the kernel subsystem name
83 .TP
84 \fBBUS\fR
85 Match the typ of bus the device is connected to.
86 .TP
87 \fBDRIVER\fR
88 Match the kernel driver name.
89 .TP
90 \fBID\fR
91 Match the device number on the bus.
92 .TP
93 \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR
94 Match against the value of an environment key. Depending on the specified operation, this key is also used as a assignment.
95 .TP
96 \fBSYSFS{\fR\fB\fIfilename\fR\fR\fB}\fR
97 Match the sysfs attribute value. Up to five values can be specified. Trailing whitespace is ignored, if the specified match value does not contain trailing whitespace itself.
98 .TP
99 \fBPROGRAM\fR
100 Execute external program. The key is true, if the program returns without exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout is available for the RESULT key.
101 .TP
102 \fBRESULT\fR
103 Match the returned string of the last PROGRAM call. This key can be used in the same or in any later rule after a PROGRAM call.
104 .PP
105 Most of the fields support a shell style pattern matching. The following pattern characters are supported:
106 .TP
107 \fB*\fR
108 Matches zero, or any number of characters.
109 .TP
110 \fB?\fR
111 Matches any single character.
112 .TP
113 \fB[]\fR
114 Matches any single character specified within the brackets. example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. Ranges are also supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character following the '[' is a '!', any characters not enclosed are matched.
115 .PP
116 The following keys can get values assigned:
117 .TP
118 \fBNAME\fR
119 The name of the node to be created, or the name, the network interface should be renamed to. Only one rule can set the a name, all later rules with a NAME key will be ignored.
120 .TP
121 \fBSYMLINK\fR
122 The name of a symlink targeting the node. Every matching rule can add this value to the list of symlinks to be created along with the device node. Multiple symlinks may be specified by separating the names by the space character.
123 .TP
124 \fBOWNER, GROUP, MODE\fR
125 The permissions for the device node. Every specified value over writes the compiled\-in default value.
126 .TP
127 \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR
128 Export the key to the environment. Depending on the specified operation, this key is also used as a match.
129 .TP
130 \fBRUN\fR
131 Add a program to the list of programs to be executed for a specific device.
132 .TP
133 \fBLABEL\fR
134 Named label where a GOTO can jump to.
135 .TP
136 \fBGOTO\fR
137 Jumps to the next LABEL with a matching gname
138 .TP
139 \fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR
140 Import the printed result or the content of a file in environment key format into the event environment. 
141 \fBprogram\fR 
142 will execute an external program and read its output. 
143 \fBfile\fR 
144 will inport a text file. If no option is given, udev will determine it from the executable bit of of the file permissions.
145 .TP
146 \fBWAIT_FOR_SYSFS\fR
147 Wait for the specified sysfs file of the device to be created. May be used to fight agains timing issues wth the kernel.
148 .TP
149 \fBOPTIONS\fR
150 \fBlast_rule\fR 
151 stops further rules application. No later rules will have any effect. 
152 \fBignore_device\fR 
153 will ignore this event completely. 
154 \fBignore_remove\fR 
155 will ignore any later remove event for this device. This may be useful as a workaround for broken device drivers. 
156 \fBall_partitions\fR 
157 will create device nodes for all available partitions of a block device. This may be useful for removable media.
158 .PP
159 The 
160 \fBNAME\fR, 
161 \fBSYMLINK\fR, 
162 \fBPROGRAM\fR, 
163 \fBOWNER\fR 
164 and 
165 \fBGROUP\fR 
166 fields support simple printf\-like string substitutions:
167 .TP
168 \fB%k\fR, \fB$kernel\fR
169 The kernel name for this device.
170 .TP
171 \fB%b\fR, \fB$id\fR
172 The kernel bus id for this device.
173 .TP
174 \fB%n\fR, \fB$number\fR
175 The kernel number for this device. For example, 'sda3' has kernel number of '3'
176 .TP
177 \fB%p\fR, \fB$devpath\fR
178 The devpath of the device.
179 .TP
180 \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR, \fB$sysfs{\fR\fB\fIfile\fR\fR\fB}\fR
181 The content of a sysfs attribute.
182 .TP
183 \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR, \fB$env{\fR\fB\fIkey\fR\fR\fB}\fR
184 The value of an environment variable.
185 .TP
186 \fB%m\fR, \fB$major\fR
187 The kernel major number for the device.
188 .TP
189 \fB%M\fR \fB$minor\fR
190 The kernel minor number for the device.
191 .TP
192 \fB%c\fR, \fB$result\fR
193 The string returned by the external program requested with PROGRAM. A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: 
194 \fB%c{N}\fR. If the number is followed by the '+' char this part plus all remaining parts of the result string are substituted: 
195 \fB%c{N+}\fR
196 .TP
197 \fB%P\fR, \fB$parent\fR
198 The node name of the parent device.
199 .TP
200 \fB%r\fR, \fB$root\fR
201 The udev_root value.
202 .TP
203 \fB%N\fR, \fB$tempnode\fR
204 The name of a created temporary device node to provide access to the device from a external program before the real node is created.
205 .TP
206 \fB%%\fR
207 The '%' character itself.
208 .TP
209 \fB$$\fR
210 The '$' character itself.
211 .PP
212 The count of characters to be substituted may be limited by specifying the format length value. For example, '%3s{file}' will only insert the first three characters of the sysfs attribute
213 .SH "ENVIRONMENT"
214 .TP
215 \fBACTION\fR
216 \fIadd\fR 
217 or 
218 \fIremove\fR 
219 signifies the addition or the removal of a device.
220 .TP
221 \fBDEVPATH\fR
222 The sysfs devpath without the mountpoint but a leading slash.
223 .TP
224 \fBSUBSYSTEM\fR
225 The kernel subsystem the device belongs to.
226 .TP
227 \fBUDEV_LOG\fR
228 Overrides the syslog priority specified in the config file.
229 .SH "AUTHOR"
230 .PP
231 Written by Greg Kroah\-Hartman 
232 <greg@kroah.com> 
233 and Kay Sievers 
234 <kay.sievers@vrfy.org>. With much help from Dan Stekloff 
235 <dsteklof@us.ibm.com> 
236 and many others.
237 .SH "SEE ALSO"
238 .PP
239 \fBudev\fR(8), 
240 \fBudevinfo\fR(8), 
241 \fBudevd\fR(8), 
242 \fBudevmonitor\fR(8)