1 .TH UDEV 8 "October 2003" "" "Linux Administrator's Manual"
3 udev \- Linux configurable dynamic device naming support
5 .BI udev " hotplug-subsystem"
8 .RI "[-q " sysfs_path "] [-rVh]"
11 creates or removes device node files usually located in the /dev directory.
12 Its goal is to provide a dynamic device directory that contains only the files
13 for devices that are actually present.
19 is executed if a kernel device is added or removed from the system.
22 reads the sysfs directory of the given device to collect device attributes
23 like label, serial number or bus device number.
24 These attributes are treated as a key
25 to determine a unique name for device file creation.
27 maintains a database for devices present on the system.
31 queries the internal database for the name of the device file to be deleted.
36 with the subsystem as argument and various environment variables set.
38 It may also called with the following options:
41 Print the version information.
49 Query with the sysfs path as argument for the name of the created device node.
56 configuration files consist of a set of lines of text. All empty
57 lines, and lines beginning with a '#' will be ignored.
61 expects its main configuration file at
62 .I /etc/udev/udev.conf.
63 The file consists of a set of variables and values that allow the user to
64 override default udev values. The current set of variables that can be
65 overridden in this file is:
68 This is the where in the filesystem to place the device nodes. The default
73 The name and location of the udev database. The default value for this is
77 This is the location of the udev rules file. The default value for this is
78 .I /etc/udev/udev.rules
81 This is the location of the udev permission file. The default value for this is
82 .I /etc/udev/udev.permissions
85 This is the default mode for all nodes that have no explicit match in the
86 permissions file. The default value for this is
90 .RI "A sample " udev.conf " might look like this:
93 # udev_root - where in the filesystem to place the device nodes
96 # udev_db - The name and location of the udev database.
97 udev_db="/udev/.udev.tdb"
99 # udev_rules - The name and location of the udev rules file
100 udev_rules="/etc/udev/udev.rules"
102 # udev_permissions - The name and location of the udev permission file
103 udev_permissions="/etc/udev/udev.permissions"
105 # default_mode - set the default mode for all nodes that have no
106 # explicit match in the permissions file
110 The rules for udev to use when naming devices may specified at
111 .I /etc/udev/udev.rules
115 .I /etc/udev/udev.conf
118 Every line in the rules file define the mapping between device attributes and
119 the device file name. It starts with a keyword defining the method used to
120 match, followed by one ore more keys to compare and the filename for the
121 device. One ore more optional symlinks targeting the node may be specified.
123 If no matching configuration is found, the default kernel device name
128 .I method, key,[key,...] name [, symlink]
130 where valid methods with corresponding keys are:
133 calling external program, that returns a string to match. The
135 key is optional, but if specified, the sysfs device bus must be able to be
136 determined by a "device" symlink.
138 .RB "keys: " BUS ", " PROGRAM ", " ID
141 device label or serial number, like USB serial number, SCSI UUID or
142 file system label. Up to 5 different sysfs files can be checked, with
143 all of the values being required in order to match the rule. The
145 key is optional, but if specified, the sysfs device bus must be able to be
146 detemined by a "device" symlink.
148 .RB "keys: " BUS ", " SYSFS_
151 device number on the bus, like PCI bus id
153 .RB "keys: " BUS ", " ID
156 device position on bus, like physical port of USB device
158 .RB "keys: " BUS ", " PLACE
161 string replacement of the kernel device name
166 tell udev to not care about creation of this device, e.g. because the
167 device is already handled by another program
171 The methods are applied in the following order:
172 .BR IGNORE ", " CALLOUT ", " LABEL ", " NUMBER ", " TOPOLOGY ", " REPLACE "."
174 .RB "The " NAME " ," SYMLINK " and " PROGRAM
175 fields support simple printf-like string substitution:
178 The "kernel number" of the device.
179 for example, 'sda3' has a "kernel number" of '3'
182 The "kernel name" for the device.
185 The kernel major number for the device.
188 The kernel minor number for the device.
191 The bus id for the device.
194 The CALLOUT program returned string.
195 (This does not work within the PROGRAM field for the obvious reason.)
198 Use the devfs style disk name for this device.
199 For partitions, this will result in 'part%n'
200 If this is not a partition, it will result in 'disc'.
202 .RI "A sample " udev.rules " might look like this:"
205 # if /sbin/scsi_id returns "OEM 0815" device will be called disk1
206 CALLOUT, BUS="scsi", PROGRAM="/sbin/scsi_id", ID="OEM 0815", NAME="disk1"
208 # USB printer to be called lp_color
209 LABEL, BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_color"
211 # SCSI disk with a specific vendor and model number is to be called boot
212 LABEL, BUS="scsi", SYSFS_vendor="IBM", SYSFS_model="ST336", NAME="boot%n"
214 # sound card with PCI bus id 00:0b.0 to be called dsp
215 NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp"
217 # USB mouse at third port of the second hub to be called mouse1
218 TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1"
220 # ttyUSB1 should always be called pda with two additional symlinks
221 REPLACE, KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld"
223 # multiple USB webcams with symlinks to be called webcam0, webcam1, ...
224 LABEL, BUS="usb", SYSFS_model="XV3", NAME="video%n", SYMLINK="webcam%n"
227 Permissions and ownership for the created device files may specified at
228 .I /etc/udev/udev.permissions
232 .I /etc/udev/udev.conf
235 Every line lists a device name followed by owner, group and permission
236 mode. All values are separated by colons. The name field may contain a
237 pattern to apply the values to a whole class of devices.
241 was built using klibc or is used before the user database is accessible (e.g.
242 .BR initrd "(4)), only numeric owner and group values may be used."
244 .RI "A sample " udev.permissions " might look like this:"
247 #name:user:group:mode
248 input/*:root:root:644
250 video*:root:video:0660
254 A number of different fields in the above configuration files support a simple
255 form of shell style pattern matching. It supports the following pattern characters:
258 Matches zero, one, or more characters.
261 Matches any single character, but does not match zero characters.
264 Matches any single character specified within the brackets. For example, the
265 pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also
266 supported within this match with the '-' character. For example, to match on
267 the range of all digits, the pattern [0-9] would be used. If the first character
268 following the '[' is a '!' then any character not enclosed is matched.
271 /sbin/udev udev program
272 /etc/udev/* udev config files
273 /etc/hotplug.d/default/udev.hotplug hotplug symlink to udev program
280 .I http://linux-hotplug.sourceforge.net/
284 was developed by Greg Kroah-Hartman <greg@kroah.com> with much help from
285 Dan Stekloff <dsteklof@us.ibm.com>, Kay Sievers <kay.sievers@vrfy.org>, and