]> git.ipfire.org Git - thirdparty/systemd.git/blame - udev.8
Makefile: fail, if submake fails
[thirdparty/systemd.git] / udev.8
CommitLineData
7b86ada7
KS
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"
11udev \- dynamic device management
04db8c9e 12.SH "DESCRIPTION"
7b86ada7
KS
13.PP
14udev 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
16directory, or it renames network interfaces.
17.PP
18Usually udev runs as
19\fBudevd\fR(8)
20and receives uevents directly from the kernel if a device is added or removed form the system. The program
21\fBudev\fR
22itself may be used as an event handler in situations, where running the daemon is not appropriate, like in initramfs.
23.PP
24If 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.
eb13ff87 25.SH "CONFIGURATION"
7b86ada7
KS
26.PP
27All 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
31udev 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
35Specifies where to place the device nodes in the filesystem. The default value is
36\fI/dev\fR.
37.TP
7b86ada7
KS
38\fBudev_rules\fR
39The 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
44The logging priority. Valid values are the numerical syslog priorities or their textual representations:
45\fBerr\fR,
46\fBinfo\fR
47and
48\fBdebug\fR.
49.SS "Rules files"
50.PP
51The udev rules are read from the files located in the
52\fI/etc/udev/rules.d\fR
53directory 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
55A 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
0fa98832
KS
58Compare for equality.
59.TP
7b86ada7
KS
60\fB!=\fR
61Compare for non\-equality.
0fa98832 62.TP
7b86ada7
KS
63\fB=\fR
64Asign a value to a key. Keys that represent a list, are reset and only this single value is assigned.
0fa98832 65.TP
7b86ada7
KS
66\fB+=\fR
67Add the value to a key that holds a list of entries.
0fa98832 68.TP
7b86ada7
KS
69\fB:=\fR
70Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules.
71.PP
28ce66de 72The following key names can be used to match against device properties:
d3db5e5e 73.TP
7b86ada7
KS
74\fBACTION\fR
75Match the kernel action name.
4bd46ac7 76.TP
7b86ada7
KS
77\fBKERNEL\fR
78Match the kernel device name
4bd46ac7 79.TP
7b86ada7
KS
80\fBDEVPATH\fR
81Match the kernel devpath.
6818c51d 82.TP
7b86ada7
KS
83\fBSUBSYSTEM\fR
84Match the kernel subsystem name
821d0ec8 85.TP
7b86ada7
KS
86\fBBUS\fR
87Match the typ of bus the device is connected to.
88.TP
89\fBDRIVER\fR
2092fbcd 90Match the kernel driver name.
6818c51d 91.TP
7b86ada7
KS
92\fBID\fR
93Match the device number on the bus.
94.TP
95\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR
96Match 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
99Match 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
102Execute 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
105Match 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
107Most of the fields support a shell style pattern matching. The following pattern characters are supported:
108.TP
109\fB*\fR
110Matches zero, or any number of characters.
111.TP
112\fB?\fR
113Matches any single character.
114.TP
115\fB[]\fR
116Matches 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
28ce66de 118The following keys can get values assigned:
311e9ae6 119.TP
7b86ada7
KS
120\fBNAME\fR
121The 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
124The 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.
311e9ae6 125.TP
7b86ada7
KS
126\fBOWNER, GROUP, MODE\fR
127The permissions for the device node. Every specified value over writes the compiled\-in default value.
e41016d3 128.TP
7b86ada7
KS
129\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR
130Export the key to the environment. Depending on the specified operation, this key is also used as a match.
fd9efc00 131.TP
7b86ada7 132\fBRUN\fR
821d0ec8
KS
133Add a program to the list of programs to be executed for a specific device.
134.TP
7b86ada7
KS
135\fBLABEL\fR
136Named label where a GOTO can jump to.
137.TP
138\fBGOTO\fR
139Jumps to the next LABEL with a matching gname
140.TP
141\fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR
142Import the printed result or the content of a file in environment key format into the event environment.
143\fBprogram\fR
144will execute an external program and read its output.
145\fBfile\fR
146will 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
149Wait 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
153stops further rules application. No later rules will have any effect.
154\fBignore_device\fR
155will ignore this event completely.
156\fBignore_remove\fR
157will ignore any later remove event for this device. This may be useful as a workaround for broken device drivers.
158\fBall_partitions\fR
159will create device nodes for all available partitions of a block device. This may be useful for removable media.
160.PP
161The
162\fBNAME\fR,
163\fBSYMLINK\fR,
164\fBPROGRAM\fR,
165\fBOWNER\fR
166and
167\fBGROUP\fR
168fields support simple printf\-like string substitutions:
169.TP
170\fB%k\fR, \fB$kernel\fR
171The kernel name for this device.
172.TP
173\fB%b\fR, \fB$id\fR
174The kernel bus id for this device.
175.TP
176\fB%n\fR, \fB$number\fR
177The kernel number for this device. For example, 'sda3' has kernel number of '3'
178.TP
179\fB%p\fR, \fB$devpath\fR
180The 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
183The 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
186The value of an environment variable.
187.TP
188\fB%m\fR, \fB$major\fR
c6c13c31 189The kernel major number for the device.
4b710f03 190.TP
7b86ada7 191\fB%M\fR \fB$minor\fR
c6c13c31 192The kernel minor number for the device.
4b710f03 193.TP
7b86ada7
KS
194\fB%c\fR, \fB$result\fR
195The 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
69aa6dfb 198.TP
7b86ada7
KS
199\fB%e\fR, \fB$enum\fR
200If 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
c2df8b5f 202Note: 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.
7b86ada7
KS
203.TP
204\fB%P\fR, \fB$parent\fR
205The node name of the parent device.
36043f84 206.TP
7b86ada7 207\fB%r\fR, \fB$root\fR
821d0ec8
KS
208The udev_root value.
209.TP
7b86ada7
KS
210\fB%N\fR, \fB$tempnode\fR
211The 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
63ead27c 214The '%' character itself.
7b86ada7
KS
215.TP
216\fB$$\fR
217The '$' character itself.
218.PP
219The 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
3ac03269 220.SH "ENVIRONMENT"
3ac03269 221.TP
7b86ada7
KS
222\fBACTION\fR
223\fIadd\fR
224or
225\fIremove\fR
3ac03269
TK
226signifies the addition or the removal of a device.
227.TP
7b86ada7
KS
228\fBDEVPATH\fR
229The sysfs devpath without the mountpoint but a leading slash.
3ac03269 230.TP
7b86ada7
KS
231\fBSUBSYSTEM\fR
232The kernel subsystem the device belongs to.
3ac03269 233.TP
7b86ada7
KS
234\fBUDEV_LOG\fR
235Overrides the syslog priority specified in the config file.
236.SH "AUTHOR"
237.PP
238Written by Greg Kroah\-Hartman
239<greg@kroah.com>
240and Kay Sievers
241<kay.sievers@vrfy.org>. With much help from Dan Stekloff
242<dsteklof@us.ibm.com>
243and many others.
04db8c9e 244.SH "SEE ALSO"
04db8c9e 245.PP
7b86ada7
KS
246\fBudev\fR(8),
247\fBudevinfo\fR(8),
248\fBudevd\fR(8),
249\fBudevmonitor\fR(8)