chiark / gitweb /
remove default settings in udev.conf
[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. The program 
21 \fBudev\fR 
22 itself may be used as an event handler in situations, where running the daemon is not appropriate, like in initramfs.
23 .PP
24 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.
25 .SH "CONFIGURATION"
26 .PP
27 All udev configuration files are placed in 
28 \fI/etc/udev/*\fR. Every file consist of a set of lines of text. All empty lines or lines beginning with '#' will be ignored.
29 .SS "Configuration file"
30 .PP
31 udev expects its main configuration file at 
32 \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:
33 .TP
34 \fBudev_root\fR
35 Specifies where to place the device nodes in the filesystem. The default value is 
36 \fI/dev\fR.
37 .TP
38 \fBudev_rules\fR
39 The name of the udev rules file or directory to look for files with the suffix 
40 \fI.rules\fR. Multiple rule files are read in lexical order. The default value is 
41 \fI/etc/udev/rules.d\fR.
42 .TP
43 \fBudev_log\fR
44 The logging priority. Valid values are the numerical syslog priorities or their textual representations: 
45 \fBerr\fR, 
46 \fBinfo\fR 
47 and 
48 \fBdebug\fR.
49 .SS "Rules files"
50 .PP
51 The udev rules are read from the files located in the 
52 \fI/etc/udev/rules.d\fR 
53 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.
54 .PP
55 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:
56 .TP
57 \fB==\fR
58 Compare for equality.
59 .TP
60 \fB!=\fR
61 Compare for non\-equality.
62 .TP
63 \fB=\fR
64 Asign a value to a key. Keys that represent a list, are reset and only this single value is assigned.
65 .TP
66 \fB+=\fR
67 Add the value to a key that holds a list of entries.
68 .TP
69 \fB:=\fR
70 Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules.
71 .PP
72 The following key names can be used to match against device properties:
73 .TP
74 \fBACTION\fR
75 Match the kernel action name.
76 .TP
77 \fBKERNEL\fR
78 Match the kernel device name
79 .TP
80 \fBDEVPATH\fR
81 Match the kernel devpath.
82 .TP
83 \fBSUBSYSTEM\fR
84 Match the kernel subsystem name
85 .TP
86 \fBBUS\fR
87 Match the typ of bus the device is connected to.
88 .TP
89 \fBDRIVER\fR
90 Match the kernel driver name.
91 .TP
92 \fBID\fR
93 Match the device number on the bus.
94 .TP
95 \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR
96 Match against the value of an environment key. Depending on the specified operation, this key is also used as a assignment.
97 .TP
98 \fBSYSFS{\fR\fB\fIfilename\fR\fR\fB}\fR
99 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.
100 .TP
101 \fBPROGRAM\fR
102 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.
103 .TP
104 \fBRESULT\fR
105 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.
106 .PP
107 Most of the fields support a shell style pattern matching. The following pattern characters are supported:
108 .TP
109 \fB*\fR
110 Matches zero, or any number of characters.
111 .TP
112 \fB?\fR
113 Matches any single character.
114 .TP
115 \fB[]\fR
116 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.
117 .PP
118 The following keys can get values assigned:
119 .TP
120 \fBNAME\fR
121 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.
122 .TP
123 \fBSYMLINK\fR
124 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.
125 .TP
126 \fBOWNER, GROUP, MODE\fR
127 The permissions for the device node. Every specified value over writes the compiled\-in default value.
128 .TP
129 \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR
130 Export the key to the environment. Depending on the specified operation, this key is also used as a match.
131 .TP
132 \fBRUN\fR
133 Add a program to the list of programs to be executed for a specific device.
134 .TP
135 \fBLABEL\fR
136 Named label where a GOTO can jump to.
137 .TP
138 \fBGOTO\fR
139 Jumps to the next LABEL with a matching gname
140 .TP
141 \fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR
142 Import the printed result or the content of a file in environment key format into the event environment. 
143 \fBprogram\fR 
144 will execute an external program and read its output. 
145 \fBfile\fR 
146 will inport a text file. If no option is given, udev will determine it from the executable bit of of the file permissions.
147 .TP
148 \fBWAIT_FOR_SYSFS\fR
149 Wait for the specified sysfs file of the device to be created. May be used to fight agains timing issues wth the kernel.
150 .TP
151 \fBOPTIONS\fR
152 \fBlast_rule\fR 
153 stops further rules application. No later rules will have any effect. 
154 \fBignore_device\fR 
155 will ignore this event completely. 
156 \fBignore_remove\fR 
157 will ignore any later remove event for this device. This may be useful as a workaround for broken device drivers. 
158 \fBall_partitions\fR 
159 will create device nodes for all available partitions of a block device. This may be useful for removable media.
160 .PP
161 The 
162 \fBNAME\fR, 
163 \fBSYMLINK\fR, 
164 \fBPROGRAM\fR, 
165 \fBOWNER\fR 
166 and 
167 \fBGROUP\fR 
168 fields support simple printf\-like string substitutions:
169 .TP
170 \fB%k\fR, \fB$kernel\fR
171 The kernel name for this device.
172 .TP
173 \fB%b\fR, \fB$id\fR
174 The kernel bus id for this device.
175 .TP
176 \fB%n\fR, \fB$number\fR
177 The kernel number for this device. For example, 'sda3' has kernel number of '3'
178 .TP
179 \fB%p\fR, \fB$devpath\fR
180 The devpath of the device.
181 .TP
182 \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR, \fB$sysfs{\fR\fB\fIfile\fR\fR\fB}\fR
183 The content of a sysfs attribute.
184 .TP
185 \fB%e{\fR\fB\fIkey\fR\fR\fB}\fR, \fB$env{\fR\fB\fIkey\fR\fR\fB}\fR
186 The value of an environment variable.
187 .TP
188 \fB%m\fR, \fB$major\fR
189 The kernel major number for the device.
190 .TP
191 \fB%M\fR \fB$minor\fR
192 The kernel minor number for the device.
193 .TP
194 \fB%c\fR, \fB$result\fR
195 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: 
196 \fB%c{N}\fR. If the number is followed by the '+' char this part plus all remaining parts of the result string are substituted: 
197 \fB%c{N+}\fR
198 .TP
199 \fB%e\fR, \fB$enum\fR
200 If a device node already exists with the name, the smallest next free number is used. This can be used to create compatibility symlinks and enumerate devices of the same type originating from different kernel subsystems.
201
202 Note: The use of the enumeration facility is unreliable for events that request a number at the same time. The use of enumerations in todays setups where devices can come and go at any time is not recommended.
203 .TP
204 \fB%P\fR, \fB$parent\fR
205 The node name of the parent device.
206 .TP
207 \fB%r\fR, \fB$root\fR
208 The udev_root value.
209 .TP
210 \fB%N\fR, \fB$tempnode\fR
211 The name of a created temporary device node to provide access to the device from a external program before the real node is created.
212 .TP
213 \fB%%\fR
214 The '%' character itself.
215 .TP
216 \fB$$\fR
217 The '$' character itself.
218 .PP
219 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
220 .SH "ENVIRONMENT"
221 .TP
222 \fBACTION\fR
223 \fIadd\fR 
224 or 
225 \fIremove\fR 
226 signifies the addition or the removal of a device.
227 .TP
228 \fBDEVPATH\fR
229 The sysfs devpath without the mountpoint but a leading slash.
230 .TP
231 \fBSUBSYSTEM\fR
232 The kernel subsystem the device belongs to.
233 .TP
234 \fBUDEV_LOG\fR
235 Overrides the syslog priority specified in the config file.
236 .SH "AUTHOR"
237 .PP
238 Written by Greg Kroah\-Hartman 
239 <greg@kroah.com> 
240 and Kay Sievers 
241 <kay.sievers@vrfy.org>. With much help from Dan Stekloff 
242 <dsteklof@us.ibm.com> 
243 and many others.
244 .SH "SEE ALSO"
245 .PP
246 \fBudev\fR(8), 
247 \fBudevinfo\fR(8), 
248 \fBudevd\fR(8), 
249 \fBudevmonitor\fR(8)