~peter-pearse/ubuntu/oneiric/udev/prop001

« back to all changes in this revision

Viewing changes to udev/udev.7

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2010-09-12 20:12:37 UTC
  • mfrom: (0.7.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100912201237-ijvg5khtlgzdx4p4
Tags: 162-1
* New upstream release. Changes since our previous git snapshot:
  - cdrom_id: Fix DVD-RW media and blank DVD detection.
  - Do not create persistent name rules for kvm/qemu/vmware interfaces.
    (LP: #341006)
* Add debian/watch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'\" t
 
2
.\"     Title: udev
 
3
.\"    Author: [see the "Author" section]
 
4
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
 
5
.\"      Date: 09/03/2010
 
6
.\"    Manual: udev
 
7
.\"    Source: udev
 
8
.\"  Language: English
 
9
.\"
 
10
.TH "UDEV" "7" "09/03/2010" "udev" "udev"
 
11
.\" -----------------------------------------------------------------
 
12
.\" * set default formatting
 
13
.\" -----------------------------------------------------------------
 
14
.\" disable hyphenation
 
15
.nh
 
16
.\" disable justification (adjust text to left margin only)
 
17
.ad l
 
18
.\" -----------------------------------------------------------------
 
19
.\" * MAIN CONTENT STARTS HERE *
 
20
.\" -----------------------------------------------------------------
 
21
.SH "NAME"
 
22
udev \- Linux dynamic device management
 
23
.SH "DESCRIPTION"
 
24
.PP
 
25
udev supplies the system software with device events, manages permissions of device nodes and may create additional symlinks in the
 
26
/dev
 
27
directory, or renames network interfaces\&. The kernel usually just assigns unpredictable device names based on the order of discovery\&. Meaningful symlinks or network device names provide a way to reliably identify devices based on their properties or current configuration\&.
 
28
.PP
 
29
The udev daemon
 
30
\fBudevd\fR(8)
 
31
receives device uevents directly from the kernel whenever a device is added or removed from the system, or it changes its state\&. When udev receives a device event, it matches its configured set of rules against various device attributes to identify the device\&. Rules that match, may provide additional device information to be stored in the udev database, or information to be used to create meaningful symlink names\&.
 
32
.PP
 
33
All device information udev processes, is stored in the udev database and sent out to possible event subscribers\&. Access to all stored data and the event sources are provided by the library libudev\&.
 
34
.SH "CONFIGURATION"
 
35
.PP
 
36
udev configuration files are placed in
 
37
/etc/udev/
 
38
and
 
39
/lib/udev/\&. All empty lines, or lines beginning with \'#\' will be ignored\&.
 
40
.SS "Configuration file"
 
41
.PP
 
42
udev expects its main configuration file at
 
43
/etc/udev/udev\&.conf\&. It consists of a set of variables allowing the user to override default udev values\&. The following variables can be set:
 
44
.PP
 
45
\fBudev_root\fR
 
46
.RS 4
 
47
Specifies where to place the device nodes in the filesystem\&. The default value is
 
48
/dev\&.
 
49
.RE
 
50
.PP
 
51
\fBudev_log\fR
 
52
.RS 4
 
53
The logging priority\&. Valid values are the numerical syslog priorities or their textual representations:
 
54
\fBerr\fR,
 
55
\fBinfo\fR
 
56
and
 
57
\fBdebug\fR\&.
 
58
.RE
 
59
.SS "Rules files"
 
60
.PP
 
61
The udev rules are read from the files located in the default rules directory
 
62
/lib/udev/rules\&.d/, the custom rules directory
 
63
/etc/udev/rules\&.d/
 
64
and the temporary rules directory
 
65
/dev/\&.udev/rules\&.d/\&. All rule files are sorted and processed in lexical order, regardless in which of these directories they live\&. Files in
 
66
/etc/udev/rules\&.d/
 
67
have precedence over files with the same name in
 
68
/lib/udev/rules\&.d/\&. This can be used to ignore a default rules file if needed\&.
 
69
.PP
 
70
Rule files must end in
 
71
\&.rules, other extensions are ignored\&.
 
72
.PP
 
73
Every line in the rules file contains at least one key value pair\&. There are two kind of keys, match and assignment keys\&. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned\&.
 
74
.PP
 
75
A matching rule may rename a network interface, add symlinks pointing to the device node, or run a specified program as part of the event handling\&.
 
76
.PP
 
77
A rule 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:
 
78
.PP
 
79
\fB==\fR
 
80
.RS 4
 
81
Compare for equality\&.
 
82
.RE
 
83
.PP
 
84
\fB!=\fR
 
85
.RS 4
 
86
Compare for inequality\&.
 
87
.RE
 
88
.PP
 
89
\fB=\fR
 
90
.RS 4
 
91
Assign a value to a key\&. Keys that represent a list, are reset and only this single value is assigned\&.
 
92
.RE
 
93
.PP
 
94
\fB+=\fR
 
95
.RS 4
 
96
Add the value to a key that holds a list of entries\&.
 
97
.RE
 
98
.PP
 
99
\fB:=\fR
 
100
.RS 4
 
101
Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules\&.
 
102
.RE
 
103
.PP
 
104
The following key names can be used to match against device properties\&. Some of the keys also match against properties of the parent devices in sysfs, not only the device that has generated the event\&. If multiple keys that match a parent device are specified in a single rule, all these keys must match at one and the same parent device\&.
 
105
.PP
 
106
\fBACTION\fR
 
107
.RS 4
 
108
Match the name of the event action\&.
 
109
.RE
 
110
.PP
 
111
\fBDEVPATH\fR
 
112
.RS 4
 
113
Match the devpath of the event device\&.
 
114
.RE
 
115
.PP
 
116
\fBKERNEL\fR
 
117
.RS 4
 
118
Match the name of the event device\&.
 
119
.RE
 
120
.PP
 
121
\fBNAME\fR
 
122
.RS 4
 
123
Match the name of the node or network interface\&. It can be used once the NAME key has been set in one of the preceding rules\&.
 
124
.RE
 
125
.PP
 
126
\fBSYMLINK\fR
 
127
.RS 4
 
128
Match the name of a symlink targeting the node\&. It can be used once a SYMLINK key has been set in one of the preceding rules\&. There may be multiple symlinks; only one needs to match\&.
 
129
.RE
 
130
.PP
 
131
\fBSUBSYSTEM\fR
 
132
.RS 4
 
133
Match the subsystem of the event device\&.
 
134
.RE
 
135
.PP
 
136
\fBDRIVER\fR
 
137
.RS 4
 
138
Match the driver name of the event device\&. Only set for devices which are bound to a driver at the time the event is generated\&.
 
139
.RE
 
140
.PP
 
141
\fBATTR{\fR\fB\fIfilename\fR\fR\fB}\fR
 
142
.RS 4
 
143
Match sysfs attribute values of the event device\&. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself\&.
 
144
.RE
 
145
.PP
 
146
\fBKERNELS\fR
 
147
.RS 4
 
148
Search the devpath upwards for a matching device name\&.
 
149
.RE
 
150
.PP
 
151
\fBSUBSYSTEMS\fR
 
152
.RS 4
 
153
Search the devpath upwards for a matching device subsystem name\&.
 
154
.RE
 
155
.PP
 
156
\fBDRIVERS\fR
 
157
.RS 4
 
158
Search the devpath upwards for a matching device driver name\&.
 
159
.RE
 
160
.PP
 
161
\fBATTRS{\fR\fB\fIfilename\fR\fR\fB}\fR
 
162
.RS 4
 
163
Search the devpath upwards for a device with matching sysfs attribute values\&. If multiple
 
164
\fBATTRS\fR
 
165
matches are specified, all of them must match on the same device\&. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself\&.
 
166
.RE
 
167
.PP
 
168
\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR
 
169
.RS 4
 
170
Match against a device property value\&.
 
171
.RE
 
172
.PP
 
173
\fBTAG\fR
 
174
.RS 4
 
175
Match against a device tag\&.
 
176
.RE
 
177
.PP
 
178
\fBTEST{\fR\fB\fIoctal mode mask\fR\fR\fB}\fR
 
179
.RS 4
 
180
Test the existence of a file\&. An octal mode mask can be specified if needed\&.
 
181
.RE
 
182
.PP
 
183
\fBPROGRAM\fR
 
184
.RS 4
 
185
Execute a program\&. The key is true, if the program returns successfully\&. The device properties are made available to the executed program in the environment\&. The program\'s output printed to stdout, is available in the RESULT key\&.
 
186
.RE
 
187
.PP
 
188
\fBRESULT\fR
 
189
.RS 4
 
190
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\&.
 
191
.RE
 
192
.PP
 
193
Most of the fields support a shell style pattern matching\&. The following pattern characters are supported:
 
194
.PP
 
195
\fB*\fR
 
196
.RS 4
 
197
Matches zero, or any number of characters\&.
 
198
.RE
 
199
.PP
 
200
\fB?\fR
 
201
.RS 4
 
202
Matches any single character\&.
 
203
.RE
 
204
.PP
 
205
\fB[]\fR
 
206
.RS 4
 
207
Matches any single character specified within the brackets\&. For 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\&.
 
208
.RE
 
209
.PP
 
210
The following keys can get values assigned:
 
211
.PP
 
212
\fBNAME\fR
 
213
.RS 4
 
214
The name, a network interface should be renamed to\&. Or as a temporary workaraound, the name a device node should be named\&. Usually the kernel provides the defined node name, or even creates and removes the node before udev even receives any event\&. Changing the node name from the kernel\'s default creates inconsistencies and is not supported\&. If the kernel and NAME specify different names, an error will be logged\&. Udev is only expected to handle device node permissions and to create additional symlinks, not to change kernel\-provided device node names\&. Instead of renaming a device node, SYMLINK should be used\&. Symlink names must never conflict with device node names, it will result in unpredictable behavior\&.
 
215
.RE
 
216
.PP
 
217
\fBSYMLINK\fR
 
218
.RS 4
 
219
The name of a symlink targeting the node\&. Every matching rule will add this value to the list of symlinks to be created\&. Multiple symlinks may be specified by separating the names by the space character\&. In case multiple devices claim the same name, the link will always point to the device with the highest link_priority\&. If the current device goes away, the links will be re\-evaluated and the device with the next highest link_priority will own the link\&. If no link_priority is specified, the order of the devices, and which one of them will own the link, is undefined\&. Claiming the same name for a symlink, which is or might be used for a device node, may result in unexpected behavior and is not supported\&.
 
220
.RE
 
221
.PP
 
222
\fBOWNER, GROUP, MODE\fR
 
223
.RS 4
 
224
The permissions for the device node\&. Every specified value overwrites the compiled\-in default value\&.
 
225
.RE
 
226
.PP
 
227
\fBATTR{\fR\fB\fIkey\fR\fR\fB}\fR
 
228
.RS 4
 
229
The value that should be written to a sysfs attribute of the event device\&.
 
230
.RE
 
231
.PP
 
232
\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR
 
233
.RS 4
 
234
Set a device property value\&. Property names with a leading \'\&.\' are not stored in the database or exported to external tool or events\&.
 
235
.RE
 
236
.PP
 
237
\fBTAG\fR
 
238
.RS 4
 
239
Attach a tag to a device\&. This is used to filter events for users of libudev\'s monitor functionality, or to enumerate a group of tagged devices\&. The implementation can only work efficiently if only a few tags are attached to a device\&. It is only meant to be used in contexts with specific device filter requirements, and not as a general\-purpose flag\&. Excessive use might result in inefficient event handling\&.
 
240
.RE
 
241
.PP
 
242
\fBRUN\fR
 
243
.RS 4
 
244
Add a program to the list of programs to be executed for a specific device\&. This can only be used for very short running tasks\&. Running an event process for a long period of time may block all further events for this or a dependent device\&. Long running tasks need to be immediately detached from the event process itself\&. If the option
 
245
\fBRUN{\fR\fB\fIfail_event_on_error\fR\fR\fB}\fR
 
246
is specified, and the executed program returns non\-zero, the event will be marked as failed for a possible later handling\&.
 
247
.sp
 
248
If no absolute path is given, the program is expected to live in
 
249
/lib/udev, otherwise the absolute path must be specified\&. Program name and arguments are separated by spaces\&. Single quotes can be used to specify arguments with spaces\&.
 
250
.RE
 
251
.PP
 
252
\fBLABEL\fR
 
253
.RS 4
 
254
Named label where a GOTO can jump to\&.
 
255
.RE
 
256
.PP
 
257
\fBGOTO\fR
 
258
.RS 4
 
259
Jumps to the next LABEL with a matching name
 
260
.RE
 
261
.PP
 
262
\fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR
 
263
.RS 4
 
264
Import a set of variables as device properties, depending on
 
265
\fItype\fR:
 
266
.PP
 
267
\fBprogram\fR
 
268
.RS 4
 
269
Execute an external program specified as the assigned value and import its output, which must be in environment key format\&. Path specification, command/argument separation, and quoting work like in
 
270
\fBRUN\fR\&.
 
271
.RE
 
272
.PP
 
273
\fBfile\fR
 
274
.RS 4
 
275
Import a text file specified as the assigned value, which must be in environment key format\&.
 
276
.RE
 
277
.PP
 
278
\fBdb\fR
 
279
.RS 4
 
280
Import a single property specified as the assigned value from the current device database\&. This works only if the database is already populated by an earlier event\&.
 
281
.RE
 
282
.PP
 
283
\fBcmdline\fR
 
284
.RS 4
 
285
Import a single property from the kernel commandline\&. For simple flags the value of the property will be set to \'1\'\&.
 
286
.RE
 
287
.PP
 
288
\fBparent\fR
 
289
.RS 4
 
290
Import the stored keys from the parent device by reading the database entry of the parent device\&. The value assigned to
 
291
\fBIMPORT{parent}\fR
 
292
is used as a filter of key names to import (with the same shell\-style pattern matching used for comparisons)\&.
 
293
.RE
 
294
.sp
 
295
If no option is given, udev will choose between
 
296
\fBprogram\fR
 
297
and
 
298
\fBfile\fR
 
299
based on the executable bit of the file permissions\&.
 
300
.RE
 
301
.PP
 
302
\fBWAIT_FOR\fR
 
303
.RS 4
 
304
Wait for a file to become available or until a 10 seconds timeout expires\&.
 
305
.RE
 
306
.PP
 
307
\fBOPTIONS\fR
 
308
.RS 4
 
309
Rule and device options:
 
310
.PP
 
311
\fBlink_priority=\fR\fB\fIvalue\fR\fR
 
312
.RS 4
 
313
Specify the priority of the created symlinks\&. Devices with higher priorities overwrite existing symlinks of other devices\&. The default is 0\&.
 
314
.RE
 
315
.PP
 
316
\fBevent_timeout=\fR
 
317
.RS 4
 
318
Number of seconds an event will wait for operations to finish, before it will terminate itself\&.
 
319
.RE
 
320
.PP
 
321
\fBstring_escape=\fR\fB\fInone|replace\fR\fR
 
322
.RS 4
 
323
Usually control and other possibly unsafe characters are replaced in strings used for device naming\&. The mode of replacement can be specified with this option\&.
 
324
.RE
 
325
.PP
 
326
\fBstatic_node=\fR
 
327
.RS 4
 
328
Apply the permissions specified in this rule to a static device node with the specified name\&. Static device nodes might be provided by kernel modules, or copied from
 
329
/lib/udev/devices\&. These nodes might not have a corresponding kernel device at the time udevd is started, and allow to trigger automatic kernel module on\-demand loading\&.
 
330
.RE
 
331
.PP
 
332
\fBwatch\fR
 
333
.RS 4
 
334
Watch the device node with inotify, when closed after being opened for writing, a change uevent will be synthesised\&.
 
335
.RE
 
336
.PP
 
337
\fBnowatch\fR
 
338
.RS 4
 
339
Disable the watching of a device node with inotify\&.
 
340
.RE
 
341
.RE
 
342
.PP
 
343
The
 
344
\fBNAME\fR,
 
345
\fBSYMLINK\fR,
 
346
\fBPROGRAM\fR,
 
347
\fBOWNER\fR,
 
348
\fBGROUP\fR,
 
349
\fBMODE\fR
 
350
and
 
351
\fBRUN\fR
 
352
fields support simple printf\-like string substitutions\&. The
 
353
\fBRUN\fR
 
354
format chars gets applied after all rules have been processed, right before the program is executed\&. It allows the use of device properties set by earlier matching rules\&. For all other fields, substitutions are applied while the individual rule is being processed\&. The available substitutions are:
 
355
.PP
 
356
\fB$kernel\fR, \fB%k\fR
 
357
.RS 4
 
358
The kernel name for this device\&.
 
359
.RE
 
360
.PP
 
361
\fB$number\fR, \fB%n\fR
 
362
.RS 4
 
363
The kernel number for this device\&. For example, \'sda3\' has kernel number of \'3\'
 
364
.RE
 
365
.PP
 
366
\fB$devpath\fR, \fB%p\fR
 
367
.RS 4
 
368
The devpath of the device\&.
 
369
.RE
 
370
.PP
 
371
\fB$id\fR, \fB%b\fR
 
372
.RS 4
 
373
The name of the device matched while searching the devpath upwards for
 
374
\fBSUBSYSTEMS\fR,
 
375
\fBKERNELS\fR,
 
376
\fBDRIVERS\fR
 
377
and
 
378
\fBATTRS\fR\&.
 
379
.RE
 
380
.PP
 
381
\fB$driver\fR
 
382
.RS 4
 
383
The driver name of the device matched while searching the devpath upwards for
 
384
\fBSUBSYSTEMS\fR,
 
385
\fBKERNELS\fR,
 
386
\fBDRIVERS\fR
 
387
and
 
388
\fBATTRS\fR\&.
 
389
.RE
 
390
.PP
 
391
\fB$attr{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR
 
392
.RS 4
 
393
The value of a sysfs attribute found at the device, where all keys of the rule have matched\&. If the matching device does not have such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or ATTRS test selected a parent device, use the attribute from that parent device\&. If the attribute is a symlink, the last element of the symlink target is returned as the value\&.
 
394
.RE
 
395
.PP
 
396
\fB$env{\fR\fB\fIkey\fR\fR\fB}\fR, \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR
 
397
.RS 4
 
398
A device property value\&.
 
399
.RE
 
400
.PP
 
401
\fB$major\fR, \fB%M\fR
 
402
.RS 4
 
403
The kernel major number for the device\&.
 
404
.RE
 
405
.PP
 
406
\fB$minor\fR, \fB%m\fR
 
407
.RS 4
 
408
The kernel minor number for the device\&.
 
409
.RE
 
410
.PP
 
411
\fB$result\fR, \fB%c\fR
 
412
.RS 4
 
413
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:
 
414
\fB%c{N}\fR\&. If the number is followed by the \'+\' char this part plus all remaining parts of the result string are substituted:
 
415
\fB%c{N+}\fR
 
416
.RE
 
417
.PP
 
418
\fB$parent\fR, \fB%P\fR
 
419
.RS 4
 
420
The node name of the parent device\&.
 
421
.RE
 
422
.PP
 
423
\fB$name\fR
 
424
.RS 4
 
425
The current name of the device node\&. If not changed by a rule, it is the name of the kernel device\&.
 
426
.RE
 
427
.PP
 
428
\fB$links\fR
 
429
.RS 4
 
430
The current list of symlinks, separated by a space character\&. The value is only set if an earlier rule assigned a value, or during a remove events\&.
 
431
.RE
 
432
.PP
 
433
\fB$root\fR, \fB%r\fR
 
434
.RS 4
 
435
The udev_root value\&.
 
436
.RE
 
437
.PP
 
438
\fB$sys\fR, \fB%S\fR
 
439
.RS 4
 
440
The sysfs mount point\&.
 
441
.RE
 
442
.PP
 
443
\fB$tempnode\fR, \fB%N\fR
 
444
.RS 4
 
445
The name of a created temporary device node to provide access to the device from a external program before the real node is created\&.
 
446
.RE
 
447
.PP
 
448
\fB%%\fR
 
449
.RS 4
 
450
The \'%\' character itself\&.
 
451
.RE
 
452
.PP
 
453
\fB$$\fR
 
454
.RS 4
 
455
The \'$\' character itself\&.
 
456
.RE
 
457
.SH "AUTHOR"
 
458
.PP
 
459
Written by Greg Kroah\-Hartman
 
460
greg@kroah\&.com
 
461
and Kay Sievers
 
462
kay\&.sievers@vrfy\&.org\&. With much help from Dan Stekloff and many others\&.
 
463
.SH "SEE ALSO"
 
464
.PP
 
465
\fBudevd\fR(8),
 
466
\fBudevadm\fR(8)