~gandelman-a/ubuntu/oneiric/udev/lp818177

« back to all changes in this revision

Viewing changes to udev/udev.7

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-20 11:26:10 UTC
  • mfrom: (0.7.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20110520112610-4mw870d2yzsnfjfg
Tags: 170-0ubuntu1
* New upstream release.
* debian/udev-udeb.install, debian/udev.initramfs-hook: Drop floppy and edd
  rules, there are obsolete and not built by default any more.
* debian/udev.{postinst,postrm,prerm}: Remove a lot of obsolete transition
  handling.
* debian/udev.postinst: Drop create_devices(). devtmpfs does all that by
  itself these days. Update remove_devices() to clean up.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
'\" t
2
2
.\"     Title: udev
3
3
.\"    Author: [see the "Author" section]
4
 
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
5
 
.\"      Date: 04/22/2011
 
4
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
 
5
.\"      Date: 05/19/2011
6
6
.\"    Manual: udev
7
7
.\"    Source: udev
8
8
.\"  Language: English
9
9
.\"
10
 
.TH "UDEV" "7" "04/22/2011" "udev" "udev"
 
10
.TH "UDEV" "7" "05/19/2011" "udev" "udev"
 
11
.\" -----------------------------------------------------------------
 
12
.\" * Define some portability stuff
 
13
.\" -----------------------------------------------------------------
 
14
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
15
.\" http://bugs.debian.org/507673
 
16
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
 
17
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
18
.ie \n(.g .ds Aq \(aq
 
19
.el       .ds Aq '
11
20
.\" -----------------------------------------------------------------
12
21
.\" * set default formatting
13
22
.\" -----------------------------------------------------------------
26
35
/dev
27
36
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
37
.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\&.
 
38
The udev daemon,
 
39
\fBudevd\fR(8), 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 to be used to create meaningful symlink names\&.
32
40
.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\&.
 
41
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 is provided by the library libudev\&.
34
42
.SH "CONFIGURATION"
35
43
.PP
36
44
udev configuration files are placed in
37
45
/etc/udev/
38
46
and
39
 
/lib/udev/\&. All empty lines, or lines beginning with \'#\' will be ignored\&.
 
47
/lib/udev/\&. All empty lines or lines beginning with \*(Aq#\*(Aq are ignored\&.
40
48
.SS "Configuration file"
41
49
.PP
42
50
udev expects its main configuration file at
62
70
/lib/udev/rules\&.d/, the custom rules directory
63
71
/etc/udev/rules\&.d/
64
72
and the temporary rules directory
65
 
/run/udev/rules\&.d/\&. All rule files are sorted and processed in lexical order, regardless in which of these directories they live\&. Files in
 
73
/run/udev/rules\&.d/\&. All rule files are collectively sorted and processed in lexical order, regardless of the directories in which they live\&. However, files in
66
74
/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\&.
 
75
take precedence over files with the same name in
 
76
/lib/udev/rules\&.d/; this can be used to ignore a default rules file if needed\&.
 
77
.PP
 
78
Rule files must have the extension
 
79
\&.rules; other extensions are ignored\&.
 
80
.PP
 
81
Every line in the rules file contains at least one key\-value pair\&. There are two kind of keys: match and assignment\&. If all match keys are matching against its value, the rule gets applied and the assignment keys get the specified value assigned\&.
74
82
.PP
75
83
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
84
.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:
 
85
A rule consists of a comma\-separated list of one or more key\-value pairs\&. Each key has a distinct operation, depending on the used operator\&. Valid operators are:
78
86
.PP
79
87
\fB==\fR
80
88
.RS 4
88
96
.PP
89
97
\fB=\fR
90
98
.RS 4
91
 
Assign a value to a key\&. Keys that represent a list, are reset and only this single value is assigned\&.
 
99
Assign a value to a key\&. Keys that represent a list are reset and only this single value is assigned\&.
92
100
.RE
93
101
.PP
94
102
\fB+=\fR
98
106
.PP
99
107
\fB:=\fR
100
108
.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\&.
 
109
Assign a value to a key finally; disallow any later changes\&.
102
110
.RE
103
111
.PP
104
112
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\&.
135
143
.PP
136
144
\fBDRIVER\fR
137
145
.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\&.
 
146
Match the driver name of the event device\&. Only set this key for devices which are bound to a driver at the time the event is generated\&.
139
147
.RE
140
148
.PP
141
149
\fBATTR{\fR\fB\fIfilename\fR\fR\fB}\fR
142
150
.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\&.
 
151
Match sysfs attribute values of the event device\&. Trailing whitespace in the attribute values is ignored unless the specified match value itself contains trailing whitespace\&.
144
152
.RE
145
153
.PP
146
154
\fBKERNELS\fR
162
170
.RS 4
163
171
Search the devpath upwards for a device with matching sysfs attribute values\&. If multiple
164
172
\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\&.
 
173
matches are specified, all of them must match on the same device\&. Trailing whitespace in the attribute values is ignored unless the specified match value itself contains trailing whitespace\&.
166
174
.RE
167
175
.PP
168
176
\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR
182
190
.PP
183
191
\fBPROGRAM\fR
184
192
.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\&.
 
193
Execute a program to determine whether there is a match; the key is true if the program returns successfully\&. The device properties are made available to the executed program in the environment\&. The program\*(Aqs stdout is available in the RESULT key\&.
186
194
.RE
187
195
.PP
188
196
\fBRESULT\fR
190
198
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
199
.RE
192
200
.PP
193
 
Most of the fields support a shell style pattern matching\&. The following pattern characters are supported:
 
201
Most of the fields support shell\-style pattern matching\&. The following pattern characters are supported:
194
202
.PP
195
203
\fB*\fR
196
204
.RS 4
197
 
Matches zero, or any number of characters\&.
 
205
Matches zero or more characters\&.
198
206
.RE
199
207
.PP
200
208
\fB?\fR
204
212
.PP
205
213
\fB[]\fR
206
214
.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\&.
 
215
Matches any single character specified within the brackets\&. For example, the pattern string \*(Aqtty[SR]\*(Aq would match either \*(AqttyS\*(Aq or \*(AqttyR\*(Aq\&. Ranges are also supported via the \*(Aq\-\*(Aq character\&. For example, to match on the range of all digits, the pattern [0\-9] could be used\&. If the first character following the \*(Aq[\*(Aq is a \*(Aq!\*(Aq, any characters not enclosed are matched\&.
208
216
.RE
209
217
.PP
210
218
The following keys can get values assigned:
211
219
.PP
212
220
\fBNAME\fR
213
221
.RS 4
214
 
The name, a network interface should be renamed to\&. Or as a temporary workaround, 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\&.
 
222
What a network interface should be named\&.
 
223
.sp
 
224
Also, as a temporary workaround, this is what a device node should be named; usually the kernel provides the defined node name or creates and removes the node before udev even receives any event\&. Changing the node name from the kernel\*(Aqs default creates inconsistencies and is not supported\&. If the kernel and NAME specify different names, an error is 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\&. However, symlink names must never conflict with device node names, as that would result in unpredictable behavior\&.
215
225
.RE
216
226
.PP
217
227
\fBSYMLINK\fR
218
228
.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\&.
 
229
The name of a symlink targeting the node\&. Every matching rule adds 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 always points to the device with the highest link_priority\&. If the current device goes away, the links are re\-evaluated and the device with the next highest link_priority becomes the owner of the link\&. If no link_priority is specified, the order of the devices (and which one of them owns the link) is undefined\&. Also, symlink names must never conflict with the kernel\*(Aqs default device node names, as that would result in unpredictable behavior\&.
220
230
.RE
221
231
.PP
222
232
\fBOWNER, GROUP, MODE\fR
231
241
.PP
232
242
\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR
233
243
.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\&.
 
244
Set a device property value\&. Property names with a leading \*(Aq\&.\*(Aq are neither stored in the database nor exported to events or external tools (run by, say, the PROGRAM match key)\&.
235
245
.RE
236
246
.PP
237
247
\fBTAG\fR
238
248
.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\&.
 
249
Attach a tag to a device\&. This is used to filter events for users of libudev\*(Aqs 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
250
.RE
241
251
.PP
242
252
\fBRUN\fR
243
253
.RS 4
244
254
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\&.
245
255
.sp
246
 
If no absolute path is given, the program is expected to live in
247
 
/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\&.
 
256
If no absolute path is given, the program is expected to live in the directory provided at compile\-time to configure via \-\-libexecdir (this is usually
 
257
/lib/udev), otherwise the absolute path must be specified\&. The program name and following arguments are separated by spaces\&. Single quotes can be used to specify arguments with spaces\&.
248
258
.RE
249
259
.PP
250
260
\fBLABEL\fR
251
261
.RS 4
252
 
Named label where a GOTO can jump to\&.
 
262
A named label to which a GOTO may jump\&.
253
263
.RE
254
264
.PP
255
265
\fBGOTO\fR
256
266
.RS 4
257
 
Jumps to the next LABEL with a matching name
 
267
Jumps to the next LABEL with a matching name\&.
258
268
.RE
259
269
.PP
260
270
\fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR
270
280
.PP
271
281
\fBfile\fR
272
282
.RS 4
273
 
Import a text file specified as the assigned value, which must be in environment key format\&.
 
283
Import a text file specified as the assigned value, the content of which must be in environment key format\&.
274
284
.RE
275
285
.PP
276
286
\fBdb\fR
280
290
.PP
281
291
\fBcmdline\fR
282
292
.RS 4
283
 
Import a single property from the kernel commandline\&. For simple flags the value of the property will be set to \'1\'\&.
 
293
Import a single property from the kernel command line\&. For simple flags the value of the property is set to \*(Aq1\*(Aq\&.
284
294
.RE
285
295
.PP
286
296
\fBparent\fR
290
300
is used as a filter of key names to import (with the same shell\-style pattern matching used for comparisons)\&.
291
301
.RE
292
302
.sp
293
 
If no option is given, udev will choose between
 
303
If no option is given, udev chooses between
294
304
\fBprogram\fR
295
305
and
296
306
\fBfile\fR
299
309
.PP
300
310
\fBWAIT_FOR\fR
301
311
.RS 4
302
 
Wait for a file to become available or until a 10 seconds timeout expires\&. The path is relative to the sysfs device, i\&. e\&. if no path is specified this waits for an attribute to appear\&.
 
312
Wait for a file to become available or until a timeout of 10 seconds expires\&. The path is relative to the sysfs device; if no path is specified, this waits for an attribute to appear\&.
303
313
.RE
304
314
.PP
305
315
\fBOPTIONS\fR
313
323
.PP
314
324
\fBevent_timeout=\fR
315
325
.RS 4
316
 
Number of seconds an event will wait for operations to finish, before it will terminate itself\&.
 
326
Number of seconds an event waits for operations to finish before giving up and terminating itself\&.
317
327
.RE
318
328
.PP
319
329
\fBstring_escape=\fR\fB\fInone|replace\fR\fR
323
333
.PP
324
334
\fBstatic_node=\fR
325
335
.RS 4
326
 
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
327
 
/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\&.
 
336
Apply the permissions specified in this rule to the static device node with the specified name\&. Static device nodes might be provided by kernel modules or copied from
 
337
/lib/udev/devices\&. These nodes might not have a corresponding kernel device at the time udevd is started; they can trigger automatic kernel module loading\&.
328
338
.RE
329
339
.PP
330
340
\fBwatch\fR
331
341
.RS 4
332
 
Watch the device node with inotify, when closed after being opened for writing, a change uevent will be synthesised\&.
 
342
Watch the device node with inotify; when the node is closed after being opened for writing, a change uevent is synthesized\&.
333
343
.RE
334
344
.PP
335
345
\fBnowatch\fR
347
357
\fBMODE\fR
348
358
and
349
359
\fBRUN\fR
350
 
fields support simple printf\-like string substitutions\&. The
 
360
fields support simple string substitutions\&. The
351
361
\fBRUN\fR
352
 
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:
 
362
substitutions are performed after all rules have been processed, right before the program is executed, allowing for the use of device properties set by earlier matching rules\&. For all other fields, substitutions are performed while the individual rule is being processed\&. The available substitutions are:
353
363
.PP
354
364
\fB$kernel\fR, \fB%k\fR
355
365
.RS 4
358
368
.PP
359
369
\fB$number\fR, \fB%n\fR
360
370
.RS 4
361
 
The kernel number for this device\&. For example, \'sda3\' has kernel number of \'3\'
 
371
The kernel number for this device\&. For example, \*(Aqsda3\*(Aq has kernel number of \*(Aq3\*(Aq
362
372
.RE
363
373
.PP
364
374
\fB$devpath\fR, \fB%p\fR
388
398
.PP
389
399
\fB$attr{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR
390
400
.RS 4
391
 
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\&.
 
401
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, then the attribute from that parent device is used\&.
 
402
.sp
 
403
If the attribute is a symlink, the last element of the symlink target is returned as the value\&.
392
404
.RE
393
405
.PP
394
406
\fB$env{\fR\fB\fIkey\fR\fR\fB}\fR, \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR
408
420
.PP
409
421
\fB$result\fR, \fB%c\fR
410
422
.RS 4
411
 
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:
412
 
\fB%c{N}\fR\&. If the number is followed by the \'+\' char this part plus all remaining parts of the result string are substituted:
 
423
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:
 
424
\fB%c{N}\fR\&. If the number is followed by the \*(Aq+\*(Aq character, this part plus all remaining parts of the result string are substituted:
413
425
\fB%c{N+}\fR
414
426
.RE
415
427
.PP
425
437
.PP
426
438
\fB$links\fR
427
439
.RS 4
428
 
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\&.
 
440
A space\-separated list of the current symlinks\&. The value is only set during a remove event or if an earlier rule assigned a value\&.
429
441
.RE
430
442
.PP
431
443
\fB$root\fR, \fB%r\fR
440
452
.PP
441
453
\fB$tempnode\fR, \fB%N\fR
442
454
.RS 4
443
 
The name of a created temporary device node to provide access to the device from a external program before the real node is created\&.
 
455
The name of a temporary device node created to provide access to the device from a external program before the real node is created\&.
444
456
.RE
445
457
.PP
446
458
\fB%%\fR
447
459
.RS 4
448
 
The \'%\' character itself\&.
 
460
The \*(Aq%\*(Aq character itself\&.
449
461
.RE
450
462
.PP
451
463
\fB$$\fR
452
464
.RS 4
453
 
The \'$\' character itself\&.
 
465
The \*(Aq$\*(Aq character itself\&.
454
466
.RE
455
467
.SH "AUTHOR"
456
468
.PP