Changeset 82fc053 for BOOK/bootscripts/common
- Timestamp:
- May 14, 2014, 1:21:04 AM (10 years ago)
- Branches:
- clfs-3.0.0-sysvinit, sysvinit
- Children:
- 056e32f4
- Parents:
- db71344
- Location:
- BOOK/bootscripts/common
- Files:
-
- 5 added
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
BOOK/bootscripts/common/eudev.xml
rdb71344 r82fc053 6 6 ]> 7 7 8 <sect1 id="ch-scripts- udev">9 <?dbhtml filename=" udev.html"?>8 <sect1 id="ch-scripts-eudev"> 9 <?dbhtml filename="eudev.html"?> 10 10 11 11 <title>Device and Module Handling on a CLFS System</title> 12 12 13 <indexterm zone="ch-scripts- udev">14 <primary sortas="a- systemd">Systemd</primary>15 <secondary>u dev usage</secondary>13 <indexterm zone="ch-scripts-eudev"> 14 <primary sortas="a-Eudev">Eudev</primary> 15 <secondary>usage</secondary> 16 16 </indexterm> 17 17 18 <para>In <xref linkend="chapter-building-system"/>, we installed systemd,19 which contains systemd-udevd, previously known as Udev. Before we go into20 the details regarding how this works, a brief history of previous methods of21 handling devices is inorder.</para>18 <para>In <xref linkend="chapter-building-system"/>, we installed the Eudev 19 package. Before we go into the details regarding how this works, 20 a brief history of previous methods of handling devices is in 21 order.</para> 22 22 23 23 <para>Linux systems in general traditionally use a static device creation … … 30 30 the world.</para> 31 31 32 <para>Using the Udev method, only those devices which are detected by the32 <para>Using the Eudev method, only those devices which are detected by the 33 33 kernel get device nodes created for them. Because these device nodes will be 34 34 created each time the system boots, they will be stored on a <systemitem … … 71 71 72 72 <sect2> 73 <title> Udev Implementation</title>73 <title>Eudev Implementation</title> 74 74 75 75 <sect3> … … 93 93 94 94 <sect3> 95 <title>Eudev Bootscript</title> 96 97 <para>The <command>S10udev</command> initscript takes care of creating 98 device nodes when Linux is booted. The script unsets the uevent handler 99 from the default of <command>/sbin/hotplug</command>. This is done 100 because the kernel no longer needs to call out to an external binary. 101 Instead <command>udevd</command> will listen on a netlink socket for 102 uevents that the kernel raises. Next, the bootscript copies any static 103 device nodes that exist in <filename 104 class="directory">/lib/udev/devices</filename> to <filename 105 class="directory">/dev</filename>. This is necessary because some devices, 106 directories, and symlinks are needed before the dynamic device handling 107 processes are available during the early stages of booting a system. 108 Creating static device nodes in <filename 109 class="directory">/lib/udev/devices</filename> also provides an easy 110 workaround for devices that are not supported by the dynamic device 111 handling infrastructure. The bootscript then starts the Eudev daemon, 112 <command>udevd</command>, which will act on any uevents it receives. 113 Finally, the bootscript forces the kernel to replay uevents for any 114 devices that have already been registered and then waits for 115 <command>udevd</command> to handle them.</para> 116 117 </sect3> 118 119 <sect3> 95 120 <title>Device Node Creation</title> 96 121 97 <para>To obtain the right major and minor number for a device, Udev relies122 <para>To obtain the right major and minor number for a device, Eudev relies 98 123 on the information provided by <systemitem 99 124 class="filesystem">sysfs</systemitem> in <filename … … 104 129 <emphasis>0</emphasis>. The names and permissions of the nodes created 105 130 under the <filename class="directory">/dev</filename> directory are 106 determined by rules specified in the files within the 107 <filename class="directory">/lib/udev/rules.d</filename> and <filename 108 class="directory">/etc/udev/rules.d/</filename> directories. These files 109 have names that start with numbers, and are evaluated in numerical order. 110 If <command>udevd</command> can't find a rule for the device it is 111 creating, it will default permissions to <emphasis>660</emphasis> and 112 ownership to <emphasis>root:root</emphasis>. </para> 131 determined by rules specified in the files within the <filename 132 class="directory">/etc/udev/rules.d/</filename> directory. These are 133 numbered in a similar fashion to the CLFS-Bootscripts package. If 134 <command>udevd</command> can't find a rule for the device it is creating, 135 it will default permissions to <emphasis>660</emphasis> and ownership to 136 <emphasis>root:root</emphasis>. Documentation on the syntax of the Eudev 137 rules configuration files is available in 138 <filename>/usr/share/doc/udev/writing_udev_rules/index.html</filename></para> 113 139 114 140 </sect3> … … 129 155 might contain the string 130 156 <quote>pci:v00001319d00000801sv00001319sd00001319bc04sc01i00</quote>. 131 The default rules provided by Udev will cause <command>udevd</command>157 The default rules provided by Eudev will cause <command>udevd</command> 132 158 to call out to <command>/sbin/modprobe</command> with the contents of the 133 159 <envar>MODALIAS</envar> uevent environment variable (that should be the … … 168 194 <title>A kernel module is not loaded automatically</title> 169 195 170 <para> Udev will only load a module if it has a bus-specific alias and the196 <para>Eudev will only load a module if it has a bus-specific alias and the 171 197 bus driver properly exports the necessary aliases to <systemitem 172 198 class="filesystem">sysfs</systemitem>. In other cases, one should 173 arrange module loading by other means. With Linux-&linux-version;, Udev is199 arrange module loading by other means. With Linux-&linux-version;, Eudev is 174 200 known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI, 175 201 SERIO and FireWire devices.</para> 176 202 177 203 <para>To determine if the device driver you require has the necessary 178 support for Udev, run <command>modinfo</command> with the module name as204 support for Eudev, run <command>modinfo</command> with the module name as 179 205 the argument. Now try locating the device directory under 180 206 <filename class="directory">/sys/bus</filename> and check whether there is … … 184 210 class="filesystem">sysfs</systemitem>, the driver supports the device and 185 211 can talk to it directly, but doesn't have the alias, it is a bug in the 186 driver. Load the driver without the help from Udev and expect the issue212 driver. Load the driver without the help from Eudev and expect the issue 187 213 to be fixed later.</para> 188 214 … … 193 219 busses. Expect this issue to be fixed in later kernel versions.</para> 194 220 195 <para> Udev is not intended to load <quote>wrapper</quote> drivers such as221 <para>Eudev is not intended to load <quote>wrapper</quote> drivers such as 196 222 <emphasis>snd-pcm-oss</emphasis> and non-hardware drivers such as 197 223 <emphasis>loop</emphasis> at all.</para> … … 200 226 201 227 <sect3> 202 <title>A kernel module is not loaded automatically, and Udev is not228 <title>A kernel module is not loaded automatically, and Eudev is not 203 229 intended to load it</title> 204 230 … … 207 233 enhances the functionality of <emphasis>snd-pcm</emphasis> by making the 208 234 sound cards available to OSS applications), configure 209 <command>modprobe</command> to load the wrapper after Udev loads the210 wrapped module. To do this, add an <quote>install</quote> line to a file211 in <filename>/etc/modprobe.d</filename>. For example:</para>235 <command>modprobe</command> to load the wrapper after Eudev loads the 236 wrapped module. To do this, add an <quote>install</quote> line in 237 <filename>/etc/modprobe.conf</filename>. For example:</para> 212 238 213 239 <screen role="nodump"><literal>install snd-pcm /sbin/modprobe -i snd-pcm ; \ 214 240 /sbin/modprobe snd-pcm-oss ; true</literal></screen> 215 241 216 </sect3> 217 218 <sect3> 219 <title>Udev loads some unwanted module</title> 242 <para>If the module in question is not a wrapper and is useful by itself, 243 configure the <command>S05modules</command> bootscript to load this 244 module on system boot. To do this, add the module name to the 245 <filename>/etc/sysconfig/modules</filename> file on a separate line. 246 This works for wrapper modules too, but is suboptimal in that case.</para> 247 248 </sect3> 249 250 <sect3> 251 <title>Eudev loads some unwanted module</title> 220 252 221 253 <para>Either don't build the module, or blacklist it in 222 <filename>/etc/modprobe. d</filename> file as done with the254 <filename>/etc/modprobe.conf</filename> file as done with the 223 255 <emphasis>forte</emphasis> module in the example below:</para> 224 256 … … 231 263 232 264 <sect3> 233 <title> Udev creates a device incorrectly, or makes a wrong symlink</title>265 <title>Eudev creates a device incorrectly, or makes a wrong symlink</title> 234 266 235 267 <para>This usually happens if a rule unexpectedly matches a device. For … … 242 274 243 275 <sect3> 244 <title> Udev rule works unreliably</title>276 <title>Eudev rule works unreliably</title> 245 277 246 278 <para>This may be another manifestation of the previous problem. If not, … … 256 288 257 289 <sect3> 258 <title> Udev does not create a device</title>290 <title>Eudev does not create a device</title> 259 291 260 292 <para>Further text assumes that the driver is built statically into the 261 293 kernel or already loaded as a module, and that you have already checked 262 that Udev doesn't create a misnamed device.</para>263 264 <para> Udev has no information needed to create a device node if a kernel294 that Eudev doesn't create a misnamed device.</para> 295 296 <para>Eudev has no information needed to create a device node if a kernel 265 297 driver does not export its data to <systemitem 266 298 class="filesystem">sysfs</systemitem>. … … 279 311 <title>Device naming order changes randomly after rebooting</title> 280 312 281 <para>This is due to the fact that Udev, by design, handles uevents and313 <para>This is due to the fact that Eudev, by design, handles uevents and 282 314 loads modules in parallel, and thus in an unpredictable order. This will 283 315 never be <quote>fixed</quote>. You should not rely upon the kernel device 284 316 names being stable. Instead, create your own rules that make symlinks with 285 317 stable names based on some stable attributes of the device, such as a 286 serial number or the output of various *_id utilities installed by Udev.318 serial number or the output of various *_id utilities installed by Eudev. 287 319 See <xref linkend="ch-scripts-symlinks"/> and 288 320 <xref linkend="chapter-network"/> for examples.</para> -
BOOK/bootscripts/common/locale.xml
rdb71344 r82fc053 11 11 12 12 <indexterm zone="ch-scripts-locale"> 13 <primary sortas="e-/etc/ locale.conf">/etc/locale.conf</primary>13 <primary sortas="e-/etc/profile">/etc/profile</primary> 14 14 </indexterm> 15 15 16 <para>The <filename>/etc/locale.conf</filename> below sets some environment17 variables necessary for native language support. Setting them properly18 results in:</para>16 <para>The base <filename>/etc/profile</filename> below sets some 17 environment variables necessary for native language support. Setting 18 them properly results in:</para> 19 19 20 20 <itemizedlist> … … 23 23 </listitem> 24 24 <listitem> 25 <para>Correct classification of characters into letters, digits and other 26 classes. This is necessary for <command>bash</command> to properly accept 27 non-ASCII characters in command lines in non-English locales</para> 25 <para>Correct classification of characters into letters, digits and 26 other classes. This is necessary for <command>bash</command> to 27 properly accept non-ASCII characters in command lines in non-English 28 locales</para> 28 29 </listitem> 29 30 <listitem> … … 38 39 </itemizedlist> 39 40 41 <para>This script also sets the <envar>INPUTRC</envar> environment variable 42 that makes Bash and Readline use the <filename>/etc/inputrc</filename> file 43 created earlier.</para> 44 40 45 <para>Replace <replaceable>[ll]</replaceable> below with the 41 46 two-letter code for the desired language (e.g., <quote>en</quote>) and 42 47 <replaceable>[CC]</replaceable> with the two-letter code for the 43 appropriate country (e.g., <quote>GB</quote> or <quote>US</quote>).48 appropriate country (e.g., <quote>GB</quote>). 44 49 <replaceable>[charmap]</replaceable> should be replaced with the 45 canonical charmap for your chosen locale. Optional modifiers such as 46 <quote>@euro</quote> may also be present.</para> 50 canonical charmap for your chosen locale.</para> 47 51 48 52 <para>The list of all locales supported by Glibc can be obtained by running … … 67 71 68 72 <para>This results in a final locale setting of <quote>en_US.UTF-8</quote>. 69 It is important that the locale found using the heuristic above is tested 70 prior to it being added to <filename>/etc/locale.conf</filename>:</para>73 It is important that the locale found using the heuristic above is tested prior 74 to it being added to the Bash startup files:</para> 71 75 72 <screen role="nodump"><userinput>LC_ALL=[locale name] locale territory 76 <screen role="nodump"><userinput>LC_ALL=[locale name] locale territory 73 77 LC_ALL=[locale name] locale language 74 78 LC_ALL=[locale name] locale charmap … … 104 108 105 109 <para>Other packages can also function incorrectly (but may not necessarily 106 display any error messages) if the locale name does not meet their 107 expectations. In those cases, investigating how other Linux distributions108 support your localemight provide some useful information.</para>110 display any error messages) if the locale name does not meet their expectations. 111 In those cases, investigating how other Linux distributions support your locale 112 might provide some useful information.</para> 109 113 110 114 <para>Once the proper locale settings have been determined, create the 111 <filename>/etc/ locale.conf</filename> file:</para>115 <filename>/etc/profile</filename> file:</para> 112 116 113 <screen><userinput>cat > /etc/ locale.conf<< "EOF"114 <literal># Begin /etc/ locale.conf117 <screen><userinput>cat > /etc/profile << "EOF" 118 <literal># Begin /etc/profile 115 119 116 LANG=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>.<replaceable>[charmap]</replaceable><replaceable>[@modifiers]</replaceable> 120 export LANG=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>.<replaceable>[charmap]</replaceable> 121 export INPUTRC=/etc/inputrc 117 122 118 # End /etc/ locale.conf</literal>123 # End /etc/profile</literal> 119 124 EOF</userinput></screen> 120 125 121 <para>Note that you can modify <filename>/etc/locale.conf</filename> with122 systemd's <command>localectl</command> utility. To use123 <command>localectl</command> for the example above, run:</para>124 125 <screen role="nodump"><userinput>localectl set-locale LANG="<replaceable>[ll]_[CC][charmap][@modifiers]</replaceable>"</userinput></screen>126 127 <para>You can also specify other language specific environment variables such128 as <envar>LANG</envar>, <envar>LC_CTYPE</envar>, <envar>LC_NUMERIC</envar> or129 any other environment variable from <command>locale</command> output. Just130 separate them with a space. An example where <envar>LANG</envar> is set as131 en_US.UTF-8 but <envar>LC_CTYPE</envar> is set as just en_US is:</para>132 133 <screen role="nodump"><userinput>localectl set-locale LANG="en_US.UTF-8" LC_CTYPE="en_US"</userinput></screen>134 135 <note><para>Please note that <command>localectl</command> command can136 be used only on a system booted with systemd.</para></note>137 126 <para>Setting the keyboard layout, screen font, and locale-related 138 127 environment variables are the only internationalization steps needed to -
BOOK/bootscripts/common/profile.xml
rdb71344 r82fc053 38 38 <para>The files <filename>/etc/profile</filename> and 39 39 <filename>~/.bash_profile</filename> are read when the shell is 40 invoked as an interactive login shell. Create a base 41 <filename>/etc/profile</filename> that will setup locale information and load 42 any bash auto completion files that may be on the system. This script also 43 sets the <envar>INPUTRC</envar> environment variable that makes Bash and 44 Readline use <filename>/etc/inputrc</filename>.</para> 45 46 <screen><userinput>cat > /etc/profile << "EOF" 47 <literal># Begin /etc/profile 48 49 source /etc/locale.conf 50 for f in /etc/bash_completion.d/*.sh; do source $f; done; unset f 51 export INPUTRC=/etc/inputrc 52 53 # End /etc/profile</literal> 54 EOF</userinput></screen> 40 invoked as an interactive login shell. In the next section, a base 41 <filename>/etc/profile</filename> will be created to set up locale 42 information.</para> 55 43 56 44 </sect1> -
BOOK/bootscripts/common/symlinks.xml
rdb71344 r82fc053 45 45 <note> 46 46 <para>Although the examples in this book work properly, be aware 47 that Udev does not recognize the backslash for line continuation.48 If modifying Udev rules with an editor, be sure to leave each rule47 that Eudev does not recognize the backslash for line continuation. 48 If modifying Eudev rules with an editor, be sure to leave each rule 49 49 on one physical line.</para> 50 50 </note> … … 89 89 <title>Dealing with duplicate devices</title> 90 90 91 <para>As explained in <xref linkend="ch-scripts- udev"/>, the order in91 <para>As explained in <xref linkend="ch-scripts-eudev"/>, the order in 92 92 which devices with the same function appear in 93 93 <filename class="directory">/dev</filename> is essentially random. … … 134 134 device.</para> 135 135 136 <para>More information on writing Eudev rules can be found in 137 <filename>/usr/share/doc/udev/writing_udev_rules/index.html</filename>.</para> 138 136 139 </sect2> 137 140
Note:
See TracChangeset
for help on using the changeset viewer.