2 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
5 <title>Fedora Project, sponsored by Red Hat</title>
6 <base href="http://fedora.redhat.com/">
7 <meta http-equiv="Content-Type" content="text/html">
8 <link rel="stylesheet" type="text/css" media="print" href="/css/print.css">
9 <style type="text/css" media="screen">
10 @import url("/css/layout.css");
11 @import url("/css/content.css");
12 @import url("/css/docbook.css");
14 <meta name="MSSmartTagsPreventParsing" content="TRUE">
15 <link rel="shortcut icon" href="/images/favicon.ico">
16 <link rel="icon" href="/images/favicon.ico">
21 <div id="fedora-header">
22 <div id="fedora-header-logo">
23 <a href="/"><img src="/images/header-fedora_logo.png" alt="Fedora Project"></a>
26 <div id="fedora-header-items">
27 <span class="fedora-header-icon">
28 <a href="/download/"><img src="/images/header-download.png" alt=" ">Download</a>
29 <a href="/projects/"><img src="/images/header-projects.png" alt=" ">Projects</a>
30 <a href="/about/faq/"><img src="/images/header-faq.png" alt=" ">FAQ</a></span>
34 <div id="fedora-nav"></div>
37 <!-- leftside BEGIN -->
38 <div id="fedora-side-left">
39 <div id="fedora-side-nav-label">Site Navigation:</div> <ul id="fedora-side-nav">
40 <li><a href="/">Home</a></li>
41 <li><a href="/download/">Download</a></li>
42 <li><a href="/docs/">Docs</a></li>
43 <li><a href="/projects/">Projects</a></li>
44 <li><a href="/participate/">Participate</a></li>
45 <li><a href="/about/">About</a></li>
51 <!-- content BEGIN -->
52 <div id="fedora-middle-two">
53 <div class="fedora-corner-tr"> </div>
54 <div class="fedora-corner-tl"> </div>
55 <div id="fedora-content">
56 <!-- content BEGIN -->
57 <h1>Udev on Fedora</h1>
58 <h2>by Harald Hoyer</h2>
60 This document tries to reveal the secrets of udev and how it works on Fedora.
63 udev was developed by Greg Kroah-Hartman <greg@kroah.com> with much
64 help from Dan Stekloff <dsteklof@us.ibm.com>, Kay Sievers <kay.sievers@vrfy.org>,
68 The <a href="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html">udev homepage</a> and the
69 Linux-hotplug-devel mailing list <a href="https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel">https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel</a> are the main development sources.
73 <h2>What Does Udev Do?</h2>
75 udev provides a dynamic device directory containing only the files for
76 actually present devices. It creates or removes device node files usually
77 located in the <tt class="filename">/dev/</tt> directory, or it renames network interfaces.
79 As part of the hotplug subsystem, udev is executed if a kernel device
80 is added or removed from the system. On device creation, udev reads
81 the sysfs directory of the given device to collect device attributes
82 like label, serial number or bus device number. These attributes may
83 be used as keys to determine a unique name for the device. udev maintains
84 a database for devices present on the system.
85 On device removal, udev queries its database for the name of the device
88 udev gets called by hotplug, if a module is loaded, and a device is added
89 or removed. udev looks in <tt class="filename">/sys/</tt>, if the driver provides a "dev" file, which
90 contains the major and minor number for a device node to communicate with
91 the driver. After looking in the udev rules (in the <tt class="filename">/etc/udev/rules.d/</tt> directory), which
92 specify the device node filename and symlinks, a device node is created
93 in <tt class="filename">/dev/</tt> with the permissions, which are specified in <tt class="filename">/etc/udev/permissions.d/</tt>.
95 After device node creation, removal, or network device renaming, udev
96 executes the programs in the directory tree under <tt class="filename">/etc/dev.d/</tt>. The
97 name of a program must end with the <tt class="filename">.dev</tt> suffix, to be recognized.
98 In addition to the hotplug environment variables, DEVNAME is exported
99 to make the name of the created node or the name the network device is
100 renamed to, available to the executed program. The programs in every
101 directory are sorted in lexical order, while the directories are
102 searched in the following order:
104 <li><tt class="filename">/etc/dev.d/$(DEVNAME)/*.dev</tt></li>
105 <li><tt class="filename">/etc/dev.d/$(SUBSYSTEM)/*.dev</tt></li>
106 <li><tt class="filename">/etc/dev.d/default/*.dev</tt></li>
109 <h2>How is Udev Integrated on Fedora?</h2>
110 <h3><tt class="command">initrd</tt> / <tt class="command">initfs</tt></h3>
112 <tt class="command">mkinitrd</tt> copies <tt class="filename">/sbin/udev.static</tt>
113 to the <tt class="command">initrd</tt> <tt class="filename">/sbin/udev</tt> and symlinks it to
114 <tt class="filename">/sbin/udevstart</tt>.
116 After the kernel boots, it executes the nash script of the <tt class="command">initrd</tt>. This
117 mounts a tmpfs filesystem on <tt class="filename">/dev/</tt>. Instead of hotplug <tt class="command">/sbin/udev</tt> is
118 called in the <tt class="command">initrd</tt> phase. udevstart creates all device nodes for the
119 devices, which are compiled in the kernel and for the modules, which
120 are loaded by nash. </p>
124 The whole udev and hotplug infrastructure is
125 not available in <tt class="command">initrd</tt>. Thus no hotplug scripts, udev rules, and
126 permissions and no <tt class="filename">/etc/dev.d/</tt> scripts are executed for any hotplug
127 event, which is sent from the kernel.
129 <h3><tt class="filename">rc.sysinit</tt></h3>
130 <p> First, if SELinux is loaded and enabled,
131 the context of <tt class="filename">/dev/</tt> is set. <tt class="filename">rc.sysinit</tt> calls <tt class="filename">/sbin/start_udev</tt>.
132 <tt class="filename">start_udev</tt> mounts a tmpfs filesystem on <tt class="filename">/dev/</tt>, if there is none already
133 mounted. Then it creates some device nodes, which need module
134 autoloading, or where there is no kernel module. After that
135 <tt class="command">/sbin/udevstart</tt> is called again, which simulates the hotplug events in
136 the <tt class="command">initrd</tt> phase, to apply the whole udev rules and permissions. After
137 that <tt class="filename">rc.sysinit</tt> parses the ouput of <tt class="filename">/sbin/kmodule</tt> and loads every
138 module. This should provide device nodes for all hardware found on your
140 <h3>Console User Permissions</h3>
142 <tt class="filename">/etc/dev.d/default/pam_console.dev</tt> is called whenever a device node is
143 created and calls <tt class="filename">/sbin/pam_console_setowner</tt> with the filename (and an
144 optional symlink) of the device node. This sets the permissions for
145 console users like specified in <tt class="filename">/etc/security/console.perms</tt>. </p>
146 <h2>Customizing Udev on Fedora</h2>
148 Read the manpage of udev and udevinfo.
149 Please try not to modify the files of RPM packages.
153 New rules should be placed in a file, which ends in <tt class="filename">.rules</tt> in
154 <tt class="filename">/etc/udev/rules.d/</tt>. Please do not use <tt class="filename">50-udev.rules</tt>. The supported and
155 preferred way is to create rules without the "NAME" tag and only
156 create "SYMLINK"s. </p><p>
157 A nice document describing how to write rules can be found on <a href="http://www.reactivated.net/udevrules.php">http://www.reactivated.net/udevrules.php</a>.
161 New permissions should be placed in a file, which ends in
162 <tt class="filename">.permissions</tt> in <tt class="filename">/etc/udev/permissions.d/</tt>. Please do not use
163 <tt class="filename">50-udev.permissions</tt>.
165 <h3>But I Really Want My Device Node!</h3>
167 Put them in <tt class="filename">/etc/udev/devices/</tt>, and they will get copied to <tt class="filename">/dev/</tt>. <a href="https://bugzilla.redhat.com/bugzilla">File a bugzilla entry</a>, if you think that should be done per default.
170 <h2>Updating to udev Without <tt class="filename">/dev/</tt></h2>
172 The steps to upgrade without Anaconda or a rescue CD are (NOT recommended):
176 <li>start from a kernel-2.6
177 </li><li>Make sure <tt class="filename">/sys/</tt> is mounted
178 </li><li>Install the latest <tt class="filename">initscripts</tt> package
179 </li><li>Install the latest <tt class="filename">udev</tt> package
180 </li><li>Execute <tt class="command">/sbin/start_udev</tt>
181 </li><li>Install the latest <tt class="filename">mkinitrd</tt> package
182 </li><li>Install the latest <tt class="filename">kernel</tt> package
183 </li><li>Or execute <tt class="command">mkinitrd</tt> for your existing kernel(s)
186 <h2>Udev without <tt class="command">initrd</tt></h2>
188 <p>Install Fedore Core as usual and reboot. Execute the following commands
194 mount --move /dev /tmp/dev
195 sbin/MAKEDEV null console zero
196 mount --move /tmp/dev /dev
198 Install your kernel without an <tt class="command">initrd</tt>. Reboot.
200 You will get some SELinux errors, and syslogd will not work as expected.
202 <h2>Current Problems on Fedora</h2>
204 <a href="http://bugzilla.redhat.com/bugzilla/buglist.cgi?short_desc_type=allwordssubstr&component=udev&bug_status=ASSIGNED&bug_status=MODIFIED&bug_status=NEEDINFO&bug_status=NEW&bug_status=REOPENED&bug_status=VERIFIED&bug_severity=high&bug_severity=low&bug_severity=normal&bug_severity=security&bug_severity=translation&long_desc_type=allwordssubstr&bug_file_loc_type=allwordssubstr&status_whiteboard_type=allwordssubstr&fixed_in_type=allwordssubstr&devel_whiteboard_type=allwordssubstr&keywords_type=allwords&cust_facing=YES&emailassigned_to1=1&emailtype1=exact&emailreporter2=1&emailtype2=exact&bugidtype=include&chfieldto=Now&cmdtype=doit&remaction=run&namedcmd=blank&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop">All open bugs for <code class="filename">udev</code></a>
207 <p>Quick solution: If you do not need rhgb, just load the nvidia module in <tt class="filename">/etc/rc.local</tt>
209 If you have udev >= 032-5, load the nvidia module:
213 cp -a /dev/nvidia* /etc/udev/devices
214 chown root.root /etc/udev/devices/nvidia*
217 <p>The Bugzilla for this problem is <strike><a href="https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=133900">133900</a></strike>.</p>
220 If you have udev >= 032-5, execute the command:
224 ln -s ttyUSB1 /etc/udev/devices/pilot
229 If you have udev >= 032-5:
233 /sbin/MAKEDEV -d /etc/udev/devices isdn
241 <div class="fedora-corner-br"> </div>
242 <div class="fedora-corner-bl"> </div>
246 <!-- footer BEGIN -->
247 <div id="fedora-footer">
248 Copyright © 2003-2004 Red Hat, Inc. All rights reserved.
249 <br>The Fedora Project is not a supported product of Red Hat, Inc.
250 <br><a href="/legal/">Legal</a> | <a href="/about/trademarks/">Trademark Guidelines</a>
252 This page last modified at: 2004/10/16 02:25:17