/[gentoo]/xml/htdocs/doc/en/udev-guide.xml
Gentoo

Contents of /xml/htdocs/doc/en/udev-guide.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.59 - (show annotations) (download) (as text)
Fri Mar 29 19:32:27 2013 UTC (4 years, 8 months ago) by swift
Branch: MAIN
Changes since 1.58: +34 -12 lines
File MIME type: application/xml
Fix bug #463778 - Updated udev guide with recent information thanks to Ssuominen

1 <?xml version='1.0' encoding="UTF-8"?>
2 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/udev-guide.xml,v 1.58 2013/03/20 20:44:09 swift Exp $ -->
4
5 <guide>
6 <title>Gentoo udev Guide</title>
7
8 <author title="Author">
9 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
10 </author>
11 <author title="Contributor">
12 <mail link="greg_g@gentoo.org">Gregorio Guidi</mail>
13 </author>
14 <author title="Editor">
15 <mail link="nightmorph"/>
16 </author>
17
18 <abstract>
19 This document explains what udev is and how you can use udev to fit your needs.
20 </abstract>
21
22 <!-- The content of this document is licensed under the CC-BY-SA license -->
23 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
24 <license/>
25
26 <version>15</version>
27 <date>2013-03-29</date>
28
29 <chapter>
30 <title>What is udev?</title>
31 <section>
32 <title>The /dev Directory</title>
33 <body>
34
35 <p>
36 When Linux-users talk about the hardware on their system in the vicinity of
37 people who believe Linux is some sort of virus or brand of coffee, the use of
38 "slash dev slash foo" will return a strange look for sure. But for the fortunate
39 user (and that includes you) using <path>/dev/sda1</path> is just a fast way of
40 explaining that we are talking about the primary master SATA, first partition. Or
41 aren't we?
42 </p>
43
44 <p>
45 We all know what a device file is. Some even know why device files have special
46 numbers when we take a closer look at them when we issue <c>ls -l</c> in
47 <path>/dev</path>. But what we always take for granted is that the primary
48 SATA disk is referred to as <path>/dev/sda</path>. You might not see it
49 this way, but this is a flaw by design.
50 </p>
51
52 <p>
53 Think about hotpluggable devices like USB, IEEE1394, hot-swappable PCI, ... What
54 is the first device? And for how long? What will the other devices be named when
55 the first one disappears? How will that affect ongoing transactions? Wouldn't it
56 be fun that a printing job is suddenly moved from your supernew laserprinter to
57 your almost-dead matrix printer because your mom decided to pull the plug of the
58 laserprinter which happened to be the first printer?
59 </p>
60
61 <p>
62 Enter <e>udev</e>. The goals of the udev project are both interesting and
63 needed:
64 </p>
65
66 <ul>
67 <li>Runs in userspace</li>
68 <li>Dynamically creates/removes device files</li>
69 <li>Provides consistent naming</li>
70 <li>Provides a user-space API</li>
71 </ul>
72
73 <p>
74 Every time a change happens within the device structure, the kernel emits a
75 <e>uevent</e> which gets picked up by udev. udev then follows the rules as
76 declared in the <path>/etc/udev/rules.d</path>, <path>/run/udev/rules.d</path>
77 and <path>/lib/udev/rules.d</path> directories. Based on the information contained
78 within the uevent, it finds the rule or rules it needs to trigger and performs
79 the required actions. These actions can be creating or deleting device files,
80 but can also trigger the loading of particular firmware files into the
81 kernel memory.
82 </p>
83
84 </body>
85 </section>
86 </chapter>
87
88 <chapter>
89 <title>Using udev on Gentoo</title>
90 <section>
91 <title>Requirements</title>
92 <body>
93
94 <p>
95 udev is meant to be used in combination with a 2.6 and 3.x kernel (like
96 <c>gentoo-sources</c> with the default 13.0 profile). If you're using such a
97 kernel then you just should have no issues whatsoever with using udev as the
98 necessary support is built-in in all stable <c>sys-apps/baselayout</c>
99 versions. Normally, udev should already be installed on your system, but if
100 this is not the case, then it is easy to install:
101 </p>
102
103 <pre caption="Installing udev">
104 # <i>emerge udev</i>
105 </pre>
106
107 <p>
108 Kernelwise, be sure to activate the following options:
109 </p>
110
111 <pre caption="Required kernel options">
112 General Setup ---&gt;
113 <comment>(Make sure the following item is *not* enabled)</comment>
114 [ ] Enable deprecated sysfs features to support old userspace tools
115
116 File Systems ---&gt;
117 [*] Inotify support for userspace
118 Pseudo filesystems ---&gt;
119 [*] Virtual memory file system support (former shm fs)
120
121 Device Drivers ---&gt;
122 <comment>(Make sure the following item is *not* enabled)</comment>
123 &lt; &gt; ATA/ATAPI/MFM/RLL support (DEPRECATED)
124 <comment>(This is *absolutely* necessary for /dev to populate)</comment>
125 Generic Driver Options ---&gt;
126 [*] Maintain a devtmpfs filesystem to mount at /dev (NEW)
127 </pre>
128
129 <p>
130 If you use <c>sys-kernel/genkernel</c>, you don't need to do anything special.
131 Genkernel sets up udev by default. You can also try <c>sys-kernel/dracut</c>
132 which is quite well integrated into Gentoo.
133 </p>
134
135 </body>
136 </section>
137 </chapter>
138
139 <chapter>
140 <title>Resources &amp; Acknowledgements</title>
141 <section>
142 <body>
143
144 <p>
145 Documentation for using <uri
146 link="http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames">the
147 predictable network interface names</uri> introduced in 197, replacing the now
148 deleted rule_generator's /etc/udev/rules.d/70-persistent-net.rules
149 </p>
150
151 <p>
152 <uri link="http://github.com/gentoo/eudev">Fork of the systemd git tree without
153 systemd itself</uri> at github, with aims like longterm stable API, more POSIX
154 than GNU, aimed much for minimal embedded but works on anything else too.
155 You decide if it's up to date by looking at the repository's history, since
156 this documentation might not be.
157 </p>
158
159 </body>
160 </section>
161 </chapter>
162
163 <chapter>
164 <title>Known problems</title>
165 <section>
166 <body>
167
168 <p>
169 Stale <c>70-persistent-net.rules</c> (or other network rules) in
170 <path>/etc/udev/rules.d</path> can prevent the predictable network naming from
171 being enabled. Both <c>70-persistent-net.rules</c> and
172 <c>70-persistent-cd.rules</c> are from the now deleted rule_generator
173 </p>
174
175 <p>
176 Init script called 'udev-postmount' should be removed from runlevels if it's
177 still there.
178 </p>
179
180 </body>
181 </section>
182 </chapter>
183 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20