]>
Commit | Line | Data |
---|---|---|
d3db5e5e | 1 | .TH UDEV 8 "October 2003" "" "Linux Administrator's Manual" |
04db8c9e | 2 | .SH NAME |
d3db5e5e | 3 | udev \- Linux configurable dynamic device naming support |
04db8c9e | 4 | .SH SYNOPSIS |
eb13ff87 | 5 | .BI udev " hotplug-subsystem" |
04db8c9e GKH |
6 | .SH "DESCRIPTION" |
7 | .B udev | |
d3db5e5e | 8 | creates or removes device node files usually located in the /dev directory. |
eb13ff87 KS |
9 | Its goal is to provide a dynamic device directory that contains only the files |
10 | for devices that are actually present. | |
11 | .P | |
d3db5e5e | 12 | As part of the |
13 | .B hotplug | |
14 | subsystem, | |
15 | .B udev | |
eb13ff87 | 16 | is executed if a kernel device is added or removed from the system. |
d3db5e5e | 17 | On device creation, |
18 | .B udev | |
eb13ff87 | 19 | reads the sysfs directory of the given device to collect device attributes |
d3db5e5e | 20 | like label, serial number or bus device number. |
d94df232 | 21 | These attributes are treated as a key |
d4112087 | 22 | to determine a unique name for device file creation. |
da86c7f0 KS |
23 | .B udev |
24 | maintains a database for devices present on the system. | |
eb13ff87 | 25 | .br |
d3db5e5e | 26 | On device removal, |
27 | .B udev | |
d4112087 | 28 | queries the internal database for the name of the device file to be deleted. |
eb13ff87 | 29 | .SH "CONFIGURATION" |
83fa40fc KS |
30 | All |
31 | .B udev | |
32 | configuration files consist of a set of lines of text. All empty | |
4865de44 GKH |
33 | lines, and lines beginning with a '#' will be ignored. |
34 | .P | |
35 | ||
da86c7f0 | 36 | .B udev |
4865de44 GKH |
37 | expects its main configuration file at |
38 | .I /etc/udev/udev.conf. | |
39 | The file consists of a set of variables and values that allow the user to | |
40 | override default udev values. The current set of variables that can be | |
41 | overridden in this file is: | |
42 | .TP | |
43 | .B udev_root | |
44 | This is the where in the filesystem to place the device nodes. The default | |
45 | value for this is | |
46 | .I /udev/ | |
47 | .TP | |
48 | .B udev_db | |
49 | The name and location of the udev database. The default value for this is | |
50 | .I /udev/.udev.tdb | |
51 | .TP | |
52 | .B udev_rules | |
53 | This is the location of the udev rules file. The default value for this is | |
54 | .I /etc/udev/udev.rules | |
55 | .TP | |
56 | .B udev_permissions | |
57 | This is the location of the udev permission file. The default value for this is | |
58 | .I /etc/udev/udev.permissions | |
59 | .TP | |
60 | .B default_mode | |
61 | This is the default mode for all nodes that have no explicit match in the | |
62 | permissions file. The default value for this is | |
63 | .I 0666 | |
d3db5e5e | 64 | .br |
4865de44 | 65 | .P |
c6c13c31 | 66 | .RI "A sample " udev.conf " might look like this: |
4865de44 GKH |
67 | .sp |
68 | .nf | |
69 | # udev_root - where in the filesystem to place the device nodes | |
70 | udev_root="/udev/" | |
71 | ||
72 | # udev_db - The name and location of the udev database. | |
73 | udev_db="/udev/.udev.tdb" | |
74 | ||
75 | # udev_rules - The name and location of the udev rules file | |
76 | udev_rules="/etc/udev/udev.rules" | |
77 | ||
78 | # udev_permissions - The name and location of the udev permission file | |
79 | udev_permissions="/etc/udev/udev.permissions" | |
80 | ||
81 | # default_mode - set the default mode for all nodes that have no | |
82 | # explicit match in the permissions file | |
83 | default_mode="0666" | |
84 | .fi | |
85 | .P | |
86 | The rules for udev to use when naming devices may specified at | |
87 | .I /etc/udev/udev.rules | |
c6c13c31 | 88 | or specified by the |
4865de44 | 89 | .I udev_rules |
d94df232 | 90 | value in the |
4865de44 GKH |
91 | .I /etc/udev/udev.conf |
92 | file. | |
93 | .P | |
94 | Every line in the rules file define the mapping between device attributes and | |
95 | the device file name. It starts with a keyword defining the method used to | |
96 | match, followed by one ore more keys to compare and the filename for the | |
26004fcc | 97 | device. One ore more optional symlinks targeting the node may be specified. |
c6c13c31 KS |
98 | .br |
99 | If no matching configuration is found, the default kernel device name | |
4865de44 | 100 | is used. |
3370fb21 | 101 | .P |
eb13ff87 | 102 | The line format is: |
eb13ff87 | 103 | .sp |
c6c13c31 | 104 | .I method, key,[key,...] name [, symlink] |
eb13ff87 | 105 | .sp |
eb13ff87 | 106 | where valid methods with corresponding keys are: |
d3db5e5e | 107 | .TP |
67922099 GKH |
108 | .B CALLOUT |
109 | calling external program, that returns a string to match | |
110 | .br | |
c6c13c31 | 111 | .RB "keys: " BUS ", " PROGRAM ", " ID |
67922099 | 112 | .TP |
d3db5e5e | 113 | .B LABEL |
114 | device label or serial number, like USB serial number, SCSI UUID or | |
115 | file system label | |
3370fb21 | 116 | .br |
d94df232 | 117 | .RB "keys: " BUS ", " SYSFS_ |
d3db5e5e | 118 | .TP |
119 | .B NUMBER | |
120 | device number on the bus, like PCI bus id | |
3370fb21 | 121 | .br |
c6c13c31 | 122 | .RB "keys: " BUS ", " ID |
d3db5e5e | 123 | .TP |
124 | .B TOPOLOGY | |
125 | device position on bus, like physical port of USB device | |
3370fb21 | 126 | .br |
c6c13c31 | 127 | .RB "keys: " BUS ", " PLACE |
d3db5e5e | 128 | .TP |
129 | .B REPLACE | |
130 | string replacement of the kernel device name | |
3370fb21 | 131 | .br |
d94df232 | 132 | .RB "key: " KERNEL |
67922099 GKH |
133 | .P |
134 | The methods are applied in the following order: | |
c6c13c31 | 135 | .BR CALLOUT ", " LABEL ", " NUMBER ", " TOPOLOGY ", " REPLACE "." |
eb13ff87 | 136 | .P |
c6c13c31 | 137 | .RB "The " NAME " ," SYMLINK " and " PROGRAM |
83fa40fc | 138 | fields support simple printf-like string substitution: |
4b710f03 KS |
139 | .TP |
140 | .B %n | |
c6c13c31 | 141 | The "kernel number" of the device. |
4b710f03 KS |
142 | for example, 'sda3' has a "kernel number" of '3' |
143 | .TP | |
144 | .B %M | |
c6c13c31 | 145 | The kernel major number for the device. |
4b710f03 KS |
146 | .TP |
147 | .B %m | |
c6c13c31 | 148 | The kernel minor number for the device. |
4b710f03 KS |
149 | .TP |
150 | .B %b | |
c6c13c31 | 151 | The bus id for the device. |
67922099 GKH |
152 | .TP |
153 | .B %c | |
c6c13c31 KS |
154 | The CALLOUT program returned string. |
155 | (This does not work within the PROGRAM field for the obvious reason.) | |
36043f84 GKH |
156 | .TP |
157 | .B %D | |
158 | Use the devfs style disk name for this device. | |
159 | For partitions, this will result in 'part%n' | |
525d07e7 | 160 | If this is not a partition, it will result in 'disc'. |
4b710f03 | 161 | .P |
c6c13c31 | 162 | .RI "A sample " udev.rules " might look like this:" |
eb13ff87 | 163 | .sp |
d3db5e5e | 164 | .nf |
67922099 GKH |
165 | # if /sbin/scsi_id returns "OEM 0815" device will be called disk1 |
166 | CALLOUT, BUS="scsi", PROGRAM="/sbin/scsi_id", ID="OEM 0815", NAME="disk1" | |
167 | ||
d3db5e5e | 168 | # USB printer to be called lp_color |
d94df232 | 169 | LABEL, BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_color" |
d3db5e5e | 170 | |
171 | # sound card with PCI bus id 00:0b.0 to be called dsp | |
3370fb21 | 172 | NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp" |
d3db5e5e | 173 | |
174 | # USB mouse at third port of the second hub to be called mouse1 | |
3370fb21 | 175 | TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" |
d3db5e5e | 176 | |
26004fcc KS |
177 | # ttyUSB1 should always be called pda with two additional symlinks |
178 | REPLACE, KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" | |
3370fb21 | 179 | |
26004fcc | 180 | # multiple USB webcams with symlinks to be called webcam0, webcam1, ... |
4868e8fb | 181 | LABEL, BUS="usb", SYSFS_model="XV3", NAME="video%n", SYMLINK="webcam%n" |
d3db5e5e | 182 | .fi |
eb13ff87 KS |
183 | .P |
184 | Permissions and ownership for the created device files may specified at | |
4865de44 | 185 | .I /etc/udev/udev.permissions |
c6c13c31 | 186 | or specified by the |
4865de44 | 187 | .I udev_permission |
c6c13c31 | 188 | value in the |
4865de44 GKH |
189 | .I /etc/udev/udev.conf |
190 | file. | |
eb13ff87 | 191 | .br |
5b8ba50a | 192 | Every line lists a device name followed by owner, group and permission |
07d7cfd1 | 193 | mode. All values are separated by colons. The name field may contain a |
83fa40fc | 194 | pattern to apply the values to a whole class of devices. |
67922099 | 195 | .br |
5b8ba50a KS |
196 | If |
197 | .B udev | |
198 | was built using klibc or is used before the user database is accessible (e.g. | |
c6c13c31 | 199 | .BR initrd "(4)), only numeric owner and group values may be used." |
eb13ff87 | 200 | .sp |
c6c13c31 | 201 | .RI "A sample " udev.permissions " might look like this:" |
eb13ff87 KS |
202 | .sp |
203 | .nf | |
204 | #name:user:group:mode | |
5b8ba50a | 205 | input/*:root:root:644 |
d0a4a110 | 206 | ttyUSB1:0:8:0660 |
5b8ba50a | 207 | video*:root:video:0660 |
eb13ff87 KS |
208 | dsp1:::0666 |
209 | .fi | |
07d7cfd1 GKH |
210 | .P |
211 | A number of different fields in the above configuration files support a simple | |
83fa40fc | 212 | form of shell style pattern matching. It supports the following pattern characters: |
07d7cfd1 GKH |
213 | .TP |
214 | .B * | |
215 | Matches zero, one, or more characters. | |
216 | .TP | |
217 | .B ? | |
218 | Matches any single character, but does not match zero characters. | |
219 | .TP | |
220 | .B [ ] | |
221 | Matches any single character specified within the brackets. For example, the | |
222 | pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also | |
223 | supported within this match with the '-' character. For example, to match on | |
83fa40fc KS |
224 | the range of all digits, the pattern [0-9] would be used. If the first character |
225 | following the '[' is a '!' then any character not enclosed is matched. | |
04db8c9e GKH |
226 | .SH "FILES" |
227 | .nf | |
04db8c9e | 228 | /sbin/udev udev program |
4865de44 | 229 | /etc/udev/* udev config files |
04db8c9e GKH |
230 | /etc/hotplug.d/default/udev.hotplug hotplug symlink to udev program |
231 | .fi | |
232 | .LP | |
233 | .SH "SEE ALSO" | |
eb13ff87 | 234 | .BR hotplug (8) |
04db8c9e GKH |
235 | .PP |
236 | The | |
237 | .I http://linux-hotplug.sourceforge.net/ | |
238 | web site. | |
239 | .SH AUTHORS | |
da86c7f0 KS |
240 | .B udev |
241 | was developed by Greg Kroah-Hartman <greg@kroah.com> with much help from | |
fc1f0d43 GKH |
242 | Dan Stekloff <dsteklof@us.ibm.com>, Kay Sievers <kay.sievers@vrfy.org>, and |
243 | many others. |