1 .TH UDEV 8 "October 2003" "" "Linux Administrator's Manual"
3 udev \- Linux configurable dynamic device naming support
5 .BI udev " hotplug-subsystem"
8 creates or removes device node files usually located in the /dev directory.
9 Its goal is to provide a dynamic device directory that contains only the files
10 for devices that are actually present.
16 is executed if a kernel device is added or removed from the system.
19 reads the sysfs directory of the given device to collect device attributes
20 like label, serial number or bus device number.
21 These attributes may used as keys to determine a
22 unique name for device file creation.
24 maintains a database for devices present on the system.
28 queries its database for the name of the device file to be deleted.
32 configuration files consist of a set of lines of text. All empty
33 lines, and lines beginning with a '#' will be ignored.
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:
44 This is the where in the filesystem to place the device nodes. The default
49 The name and location of the udev database. The default value for this is
53 This is the location of the udev rules file. The default value for this is
54 .I /etc/udev/udev.rules
57 This is the location of the udev permission file. The default value for this is
58 .I /etc/udev/udev.permissions
61 If you want udev to log some information to the syslog for every node created or
62 removed. The default value for this is
66 This is the default mode for all nodes that have no explicit match in the
67 permissions file. The default value for this is
71 This is the default owner for all nodes that have no explicit match in the
72 permissions file. The default value for this is
76 This is the default group for all nodes that have no explicit match in the
77 permissions file. The default value for this is
81 .RI "A sample " udev.conf " might look like this:
84 # udev_root - where in the filesystem to place the device nodes
87 # udev_db - The name and location of the udev database.
88 udev_db="/udev/.udev.tdb"
90 # udev_rules - The name and location of the udev rules file
91 udev_rules="/etc/udev/udev.rules"
93 # udev_permissions - The name and location of the udev permission file
94 udev_permissions="/etc/udev/udev.permissions"
96 # udev_log - set to "yes" if you want logging, else "no"
99 # default_mode - set the default mode for all nodes that have no
100 # explicit match in the permissions file
103 # default_owner - set the default owner for all nodes that have no
104 # explicit match in the permissions file
107 # default_group - set the default group for all nodes that have no
108 # explicit match in the permissions file
112 The rules for udev to use when naming devices may specified at
113 .I /etc/udev/udev.rules
117 .I /etc/udev/udev.conf
120 Every line in the rules file defines the mapping between device attributes
121 and the device file name. One ore more keys are specified to match a rule
122 with the current device. If all keys are matching, the rule will be applied
123 and the name is used for the device node. One or more optional symlinks
124 targeting the node may be specified.
126 If no matching rule is found, the default kernel device name is used.
130 .I key,[key,...] name [, symlink]
135 Match the bus type of the device.
136 (The sysfs device bus must be able to be determined by a "device" symlink.)
139 Match the kernel device name.
142 Match the device number on the bus, like PCI bus id.
145 Match the topological position on bus, like physical port of USB device
148 Match sysfs device attribute like label, vendor, USB serial number, SCSI UUID
149 or file system label. Up to 5 different sysfs files can be checked, with
150 all of the values being required in order to match the rule.
153 Call external program. This key is valid if the program returns successful.
154 The string returned by the program may additionally matched with the
159 Match the returned string of the last
161 call. This key may used in any following rule after a
165 .RB "The " NAME " ," SYMLINK " and " PROGRAM
166 fields support simple printf-like string substitution:
169 The "kernel number" of the device.
170 for example, 'sda3' has a "kernel number" of '3'
173 The "kernel name" for the device.
176 The kernel major number for the device.
179 The kernel minor number for the device.
182 The bus id for the device.
188 (This does not work within the
190 field for the obvious reason.)
195 .RI "A sample " udev.rules " might look like this:"
198 # if /sbin/scsi_id returns "OEM 0815" device will be called disk1
199 BUS="scsi", PROGRAM="/sbin/scsi_id", RESULT="OEM 0815", NAME="disk1"
201 # USB printer to be called lp_color
202 BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_color"
204 # SCSI disk with a specific vendor and model number is to be called boot
205 BUS="scsi", SYSFS_vendor="IBM", SYSFS_model="ST336", NAME="boot%n"
207 # sound card with PCI bus id 00:0b.0 to be called dsp
208 BUS="pci", ID="00:0b.0", NAME="dsp"
210 # USB mouse at third port of the second hub to be called mouse1
211 BUS="usb", PLACE="2.3", NAME="mouse1"
213 # ttyUSB1 should always be called pda with two additional symlinks
214 KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld"
216 # multiple USB webcams with symlinks to be called webcam0, webcam1, ...
217 BUS="usb", SYSFS_model="XV3", NAME="video%n", SYMLINK="webcam%n"
220 Permissions and ownership for the created device files may specified at
221 .I /etc/udev/udev.permissions
225 .I /etc/udev/udev.conf
228 Every line lists a device name followed by owner, group and permission
229 mode. All values are separated by colons. The name field may contain a
230 pattern to apply the values to a whole class of devices.
234 was built using klibc or is used before the user database is accessible (e.g.
235 .BR initrd "(4)), only numeric owner and group values may be used."
237 .RI "A sample " udev.permissions " might look like this:"
240 #name:user:group:mode
241 input/*:root:root:644
243 video*:root:video:0660
247 A number of different fields in the above configuration files support a simple
248 form of shell style pattern matching. It supports the following pattern characters:
251 Matches zero, one, or more characters.
254 Matches any single character, but does not match zero characters.
257 Matches any single character specified within the brackets. For example, the
258 pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also
259 supported within this match with the '-' character. For example, to match on
260 the range of all digits, the pattern [0-9] would be used. If the first character
261 following the '[' is a '!' then any character not enclosed is matched.
264 /sbin/udev udev program
265 /etc/udev/* udev config files
266 /etc/hotplug.d/default/udev.hotplug hotplug symlink to udev program
274 .I http://linux-hotplug.sourceforge.net/
278 was developed by Greg Kroah-Hartman <greg@kroah.com> with much help from
279 Dan Stekloff <dsteklof@us.ibm.com>, Kay Sievers <kay.sievers@vrfy.org>, and