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