| 1 | <?xml version='1.0' encoding="UTF-8"?> |
1 | <?xml version='1.0' encoding="UTF-8"?> |
| 2 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
2 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
| 3 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/udev-guide.xml,v 1.55 2011/12/26 15:22:40 swift Exp $ --> |
3 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/udev-guide.xml,v 1.56 2012/12/25 18:41:07 swift Exp $ --> |
| 4 | |
4 | |
| 5 | <guide> |
5 | <guide> |
| 6 | <title>Gentoo udev Guide</title> |
6 | <title>Gentoo udev Guide</title> |
| 7 | |
7 | |
| 8 | <author title="Author"> |
8 | <author title="Author"> |
| 9 | <mail link="swift@gentoo.org">Sven Vermeulen</mail> |
9 | <mail link="swift@gentoo.org">Sven Vermeulen</mail> |
| 10 | </author> |
10 | </author> |
| 11 | <author title="Contributor"> |
11 | <author title="Contributor"> |
| 12 | <mail link="greg_g@gentoo.org">Gregorio Guidi</mail> |
12 | <mail link="greg_g@gentoo.org">Gregorio Guidi</mail> |
| 13 | </author> |
13 | </author> |
| 14 | <author title="Editor"> |
14 | <author title="Editor"> |
| 15 | <mail link="nightmorph"/> |
15 | <mail link="nightmorph"/> |
| 16 | </author> |
16 | </author> |
| 17 | |
17 | |
| 18 | <abstract> |
18 | <abstract> |
| 19 | This document explains what udev is and how you can use udev to fit your needs. |
19 | This document explains what udev is and how you can use udev to fit your needs. |
| 20 | </abstract> |
20 | </abstract> |
| 21 | |
21 | |
| 22 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
22 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
| 23 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
23 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
| 24 | <license/> |
24 | <license/> |
| 25 | |
25 | |
| 26 | <version>10</version> |
26 | <version>12</version> |
| 27 | <date>2011-12-26</date> |
27 | <date>2012-12-25</date> |
| 28 | |
28 | |
| 29 | <chapter> |
29 | <chapter> |
| 30 | <title>What is udev?</title> |
30 | <title>What is udev?</title> |
| 31 | <section> |
31 | <section> |
| 32 | <title>The /dev Directory</title> |
32 | <title>The /dev Directory</title> |
| 33 | <body> |
33 | <body> |
| 34 | |
34 | |
| 35 | <p> |
35 | <p> |
| 36 | When Linux-users talk about the hardware on their system in the vicinity of |
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 |
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 |
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 |
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 |
40 | explaining that we are talking about the primary master SATA, first partition. Or |
| 41 | aren't we? |
41 | aren't we? |
| 42 | </p> |
42 | </p> |
| … | |
… | |
| 61 | <p> |
61 | <p> |
| 62 | Enter <e>udev</e>. The goals of the udev project are both interesting and |
62 | Enter <e>udev</e>. The goals of the udev project are both interesting and |
| 63 | needed: |
63 | needed: |
| 64 | </p> |
64 | </p> |
| 65 | |
65 | |
| 66 | <ul> |
66 | <ul> |
| 67 | <li>Runs in userspace</li> |
67 | <li>Runs in userspace</li> |
| 68 | <li>Dynamically creates/removes device files</li> |
68 | <li>Dynamically creates/removes device files</li> |
| 69 | <li>Provides consistent naming</li> |
69 | <li>Provides consistent naming</li> |
| 70 | <li>Provides a user-space API</li> |
70 | <li>Provides a user-space API</li> |
| 71 | </ul> |
71 | </ul> |
| 72 | |
72 | |
| 73 | <p> |
73 | <p> |
| 74 | Every time a change happens within the device structure, the kernel emits a |
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 |
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> and |
76 | declared in the <path>/etc/udev/rules.d</path>, <path>/run/udev/rules.d</path> |
| 77 | <path>/lib/udev/rules.d</path> directories. Based on the information contained |
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 |
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, |
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 |
80 | but can also trigger the loading of particular firmware files into the |
| 81 | kernel memory. |
81 | kernel memory. |
| 82 | </p> |
82 | </p> |
| 83 | |
83 | |
| 84 | </body> |
84 | </body> |
| 85 | </section> |
85 | </section> |
| 86 | </chapter> |
86 | </chapter> |
| 87 | |
87 | |
| 88 | <chapter> |
88 | <chapter> |
| 89 | <title>Using udev on Gentoo</title> |
89 | <title>Using udev on Gentoo</title> |
| 90 | <section> |
90 | <section> |
| 91 | <title>Requirements</title> |
91 | <title>Requirements</title> |
| 92 | <body> |
92 | <body> |
| 93 | |
93 | |
| 94 | <p> |
94 | <p> |
| 95 | udev is meant to be used in combination with a 2.6 kernel (like |
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 10.0 profile). If you're using such a |
96 | <c>gentoo-sources</c> with the default 10.0 profile). If you're using such a |
| 97 | kernel then you just should have no issues whatsoever with using udev as the |
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> |
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 |
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: |
100 | this is not the case, then it is easy to install: |
| 101 | </p> |
101 | </p> |
| 102 | |
102 | |
| 103 | <pre caption="Installing udev"> |
103 | <pre caption="Installing udev"> |
| 104 | # <i>emerge udev</i> |
104 | # <i>emerge udev</i> |
| 105 | </pre> |
105 | </pre> |
| 106 | |
106 | |
| 107 | <p> |
107 | <p> |
| 108 | Kernelwise, be sure to activate the following options: |
108 | Kernelwise, be sure to activate the following options: |
| 109 | </p> |
109 | </p> |
| 110 | |
110 | |
| … | |
… | |
| 230 | Another issue is the difference in naming of terminals between devfs and udev. |
230 | Another issue is the difference in naming of terminals between devfs and udev. |
| 231 | While devfs calls its terminals <c>tty</c>, udev calls them <c>vc</c> and |
231 | While devfs calls its terminals <c>tty</c>, udev calls them <c>vc</c> and |
| 232 | <c>tty</c>. This could lead to a problem in case you are restricting root |
232 | <c>tty</c>. This could lead to a problem in case you are restricting root |
| 233 | logins from consoles using <path>/etc/securetty</path>. You will need to make |
233 | logins from consoles using <path>/etc/securetty</path>. You will need to make |
| 234 | sure that both <c>tty1</c> and <c>vc/1</c> are listed in |
234 | sure that both <c>tty1</c> and <c>vc/1</c> are listed in |
| 235 | <path>/etc/securetty</path> to ensure that root can login using the console. |
235 | <path>/etc/securetty</path> to ensure that root can login using the console. |
| 236 | </p> |
236 | </p> |
| 237 | |
237 | |
| 238 | </body> |
238 | </body> |
| 239 | </section> |
239 | </section> |
| 240 | <section> |
240 | <section> |
| 241 | <title>Block device renaming</title> |
241 | <title>Block device renaming</title> |
| 242 | <body> |
242 | <body> |
| 243 | |
243 | |
| 244 | <p> |
244 | <p> |
| 245 | Recent versions of udev (104 and up) along with newer kernel versions (2.6.19 |
245 | For a couple of years, udev (104 and up) along with the Linux kernel (versions 2.6.19 |
| 246 | and up) may change your disc device names, due to a change in the kernel's |
246 | and up) may change your disc device names, due to a change in the kernel's |
| 247 | libata implementation. A CD-RW device at <path>/dev/hdc</path> may be changed to |
247 | libata implementation. A CD-RW device at <path>/dev/hdc</path> may be changed to |
| 248 | <path>/dev/sr0</path>. While this is not normally a problem, it may cause issues |
248 | <path>/dev/sr0</path>. While this is not normally a problem, it may cause issues |
| 249 | for some applications that are hardcoded to look for devices at other locations. |
249 | for some applications that are hardcoded to look for devices at other locations. |
| 250 | For example, <c>media-sound/rip</c> expects to find discs at |
250 | For example, <c>media-sound/rip</c> expects to find discs at |
| 251 | <path>/dev/cdrom</path>, which becomes a problem if you use a newer kernel and |
251 | <path>/dev/cdrom</path>, which becomes a problem if you use a newer kernel and |
| 252 | udev renames your device to <path>/dev/cdrom1</path>. |
252 | udev renames your device to <path>/dev/cdrom1</path>. |
| 253 | </p> |
253 | </p> |
| 254 | |
254 | |
| 255 | <p> |
255 | <p> |
| 256 | To work around these issues, you must edit |
256 | To work around these issues, you must edit |
| 257 | <path>/etc/udev/rules.d/70-persistent-cd.rules</path> and assign the correct |
257 | <path>/etc/udev/rules.d/70-persistent-cd.rules</path> and assign the correct |
| 258 | name to the device. |
258 | name to the device. |
| 259 | </p> |
259 | </p> |
| 260 | |
260 | |
| … | |
… | |
| 348 | </pre> |
348 | </pre> |
| 349 | |
349 | |
| 350 | </body> |
350 | </body> |
| 351 | </section> |
351 | </section> |
| 352 | <section> |
352 | <section> |
| 353 | <title>Other issues</title> |
353 | <title>Other issues</title> |
| 354 | <body> |
354 | <body> |
| 355 | |
355 | |
| 356 | <p> |
356 | <p> |
| 357 | Support for the framebuffer devices (<path>/dev/fb/*</path>) comes with the |
357 | Support for the framebuffer devices (<path>/dev/fb/*</path>) comes with the |
| 358 | kernel starting from version 2.6.6-rc2. |
358 | kernel starting from version 2.6.6-rc2. |
| 359 | </p> |
359 | </p> |
| 360 | |
360 | |
| 361 | <p> |
361 | <p> |
| 362 | For kernels older than 2.6.4 you have to explicitly include support for the |
362 | For kernels older than 2.6.4 you have to explicitly include support for the |
| 363 | <path>/dev/pts</path> filesystem. |
363 | <path>/dev/pts</path> filesystem, although we <e>seriously</e> recommend you to |
|
|
364 | switch to a more recent kernel. |
| 364 | </p> |
365 | </p> |
| 365 | |
366 | |
| 366 | <pre caption="Enabling the /dev/pts filesystem"> |
367 | <pre caption="Enabling the /dev/pts filesystem"> |
| 367 | File systems ---> |
368 | File systems ---> |
| 368 | Pseudo filesystems ---> |
369 | Pseudo filesystems ---> |
| 369 | [*] /dev/pts file system for Unix98 PTYs |
370 | [*] /dev/pts file system for Unix98 PTYs |
| 370 | </pre> |
371 | </pre> |
| 371 | |
372 | |
| 372 | </body> |
373 | </body> |
| 373 | </section> |
374 | </section> |
| 374 | </chapter> |
375 | </chapter> |
| 375 | |
376 | |
| 376 | <chapter> |
377 | <chapter> |
| 377 | <title>Resources & Acknowledgements</title> |
378 | <title>Resources & Acknowledgements</title> |
| 378 | <section> |
379 | <section> |