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 are treated as a key
22 to determine a unique name for device file creation.
24 maintains a database for devices present on the system.
28 queries the internal 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 This is the default mode for all nodes that have no explicit match in the
62 permissions file. The default value for this is
66 .RI "A sample " udev.conf " might look like this:
69 # udev_root - where in the filesystem to place the device nodes
72 # udev_db - The name and location of the udev database.
73 udev_db="/udev/.udev.tdb"
75 # udev_rules - The name and location of the udev rules file
76 udev_rules="/etc/udev/udev.rules"
78 # udev_permissions - The name and location of the udev permission file
79 udev_permissions="/etc/udev/udev.permissions"
81 # default_mode - set the default mode for all nodes that have no
82 # explicit match in the permissions file
86 The rules for udev to use when naming devices may specified at
87 .I /etc/udev/udev.rules
91 .I /etc/udev/udev.conf
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
97 device. One ore more optional symlinks targeting the node may be specified.
99 If no matching configuration is found, the default kernel device name
104 .I method, key,[key,...] name [, symlink]
106 where valid methods with corresponding keys are:
109 calling external program, that returns a string to match. The
111 key is optional, but if specified, the sysfs device bus must be able to be
112 determined by a "device" symlink.
114 .RB "keys: " BUS ", " PROGRAM ", " ID
117 device label or serial number, like USB serial number, SCSI UUID or
118 file system label. Up to 5 different sysfs files can be checked, with
119 all of the values being required in order to match the rule. The
121 key is optional, but if specified, the sysfs device bus must be able to be
122 detemined by a "device" symlink.
124 .RB "keys: " BUS ", " SYSFS_
127 device number on the bus, like PCI bus id
129 .RB "keys: " BUS ", " ID
132 device position on bus, like physical port of USB device
134 .RB "keys: " BUS ", " PLACE
137 string replacement of the kernel device name
141 The methods are applied in the following order:
142 .BR CALLOUT ", " LABEL ", " NUMBER ", " TOPOLOGY ", " REPLACE "."
144 .RB "The " NAME " ," SYMLINK " and " PROGRAM
145 fields support simple printf-like string substitution:
148 The "kernel number" of the device.
149 for example, 'sda3' has a "kernel number" of '3'
152 The "kernel name" for the device.
155 The kernel major number for the device.
158 The kernel minor number for the device.
161 The bus id for the device.
164 The CALLOUT program returned string.
165 (This does not work within the PROGRAM field for the obvious reason.)
168 Use the devfs style disk name for this device.
169 For partitions, this will result in 'part%n'
170 If this is not a partition, it will result in 'disc'.
172 .RI "A sample " udev.rules " might look like this:"
175 # if /sbin/scsi_id returns "OEM 0815" device will be called disk1
176 CALLOUT, BUS="scsi", PROGRAM="/sbin/scsi_id", ID="OEM 0815", NAME="disk1"
178 # USB printer to be called lp_color
179 LABEL, BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_color"
181 # SCSI disk with a specific vendor and model number is to be called boot
182 LABEL, BUS="scsi", SYSFS_vendor="IBM", SYSFS_model="ST336", NAME="boot%n"
184 # sound card with PCI bus id 00:0b.0 to be called dsp
185 NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp"
187 # USB mouse at third port of the second hub to be called mouse1
188 TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1"
190 # ttyUSB1 should always be called pda with two additional symlinks
191 REPLACE, KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld"
193 # multiple USB webcams with symlinks to be called webcam0, webcam1, ...
194 LABEL, BUS="usb", SYSFS_model="XV3", NAME="video%n", SYMLINK="webcam%n"
197 Permissions and ownership for the created device files may specified at
198 .I /etc/udev/udev.permissions
202 .I /etc/udev/udev.conf
205 Every line lists a device name followed by owner, group and permission
206 mode. All values are separated by colons. The name field may contain a
207 pattern to apply the values to a whole class of devices.
211 was built using klibc or is used before the user database is accessible (e.g.
212 .BR initrd "(4)), only numeric owner and group values may be used."
214 .RI "A sample " udev.permissions " might look like this:"
217 #name:user:group:mode
218 input/*:root:root:644
220 video*:root:video:0660
224 A number of different fields in the above configuration files support a simple
225 form of shell style pattern matching. It supports the following pattern characters:
228 Matches zero, one, or more characters.
231 Matches any single character, but does not match zero characters.
234 Matches any single character specified within the brackets. For example, the
235 pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also
236 supported within this match with the '-' character. For example, to match on
237 the range of all digits, the pattern [0-9] would be used. If the first character
238 following the '[' is a '!' then any character not enclosed is matched.
241 /sbin/udev udev program
242 /etc/udev/* udev config files
243 /etc/hotplug.d/default/udev.hotplug hotplug symlink to udev program
250 .I http://linux-hotplug.sourceforge.net/
254 was developed by Greg Kroah-Hartman <greg@kroah.com> with much help from
255 Dan Stekloff <dsteklof@us.ibm.com>, Kay Sievers <kay.sievers@vrfy.org>, and