1
0

console.xml 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-scripts-console">
  8. <?dbhtml filename="console.html"?>
  9. <title>Configuring the Linux Console</title>
  10. <indexterm zone="ch-scripts-console">
  11. <primary sortas="d-console">console</primary>
  12. <secondary>configuring</secondary>
  13. </indexterm>
  14. <para>This section discusses how to configure the <command>console</command>
  15. bootscript that sets up the keyboard map, console font and console kernel log
  16. level. If non-ASCII characters (e.g., the copyright sign, the British pound
  17. sign and Euro symbol) will not be used and the keyboard is a U.S. one, much
  18. of this section can be skipped. Without the configuration file, (or
  19. equivalent settings in <filename>rc.site</filename>), the
  20. <command>console</command> bootscript will do nothing.</para>
  21. <para>The <command>console</command> script reads the
  22. <filename>/etc/sysconfig/console</filename> file for configuration
  23. information. Decide which keymap and screen font will be used. Various
  24. language-specific HOWTOs can also help with this, see <ulink
  25. url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in
  26. doubt, look in the <filename class="directory">/lib/kbd</filename> directory
  27. for valid keymaps and screen fonts. Read <filename>loadkeys(1)</filename> and
  28. <filename>setfont(8)</filename> manual pages to determine the correct
  29. arguments for these programs.</para>
  30. <para>The <filename>/etc/sysconfig/console</filename> file should contain lines
  31. of the form: VARIABLE="value". The following variables are recognized:</para>
  32. <variablelist>
  33. <varlistentry>
  34. <term>LOGLEVEL</term>
  35. <listitem>
  36. <para>This variable specifies the log level for kernel messages sent
  37. to the console as set by <command>dmesg</command>. Valid levels are
  38. from "1" (no messages) to "8". The default level is "7".</para>
  39. </listitem>
  40. </varlistentry>
  41. <varlistentry>
  42. <term>KEYMAP</term>
  43. <listitem>
  44. <para>This variable specifies the arguments for the
  45. <command>loadkeys</command> program, typically, the name of keymap
  46. to load, e.g., <quote>es</quote>. If this variable is not set, the
  47. bootscript will not run the <command>loadkeys</command> program,
  48. and the default kernel keymap will be used.</para>
  49. </listitem>
  50. </varlistentry>
  51. <varlistentry>
  52. <term>KEYMAP_CORRECTIONS</term>
  53. <listitem>
  54. <para>This (rarely used) variable
  55. specifies the arguments for the second call to the
  56. <command>loadkeys</command> program. This is useful if the stock keymap
  57. is not completely satisfactory and a small adjustment has to be made. E.g.,
  58. to include the Euro sign into a keymap that normally doesn't have it,
  59. set this variable to <quote>euro2</quote>.</para>
  60. </listitem>
  61. </varlistentry>
  62. <varlistentry>
  63. <term>FONT</term>
  64. <listitem>
  65. <para>This variable specifies the arguments for the
  66. <command>setfont</command> program. Typically, this includes the font
  67. name, <quote>-m</quote>, and the name of the application character
  68. map to load. E.g., in order to load the <quote>lat1-16</quote> font
  69. together with the <quote>8859-1</quote> application character map
  70. (as it is appropriate in the USA),
  71. <!-- because of the copyright sign -->
  72. set this variable to <quote>lat1-16 -m 8859-1</quote>.
  73. In UTF-8 mode, the kernel uses the application character map for
  74. conversion of composed 8-bit key codes in the keymap to UTF-8, and thus
  75. the argument of the "-m" parameter should be set to the encoding of the
  76. composed key codes in the keymap.</para>
  77. </listitem>
  78. </varlistentry>
  79. <varlistentry>
  80. <term>UNICODE</term>
  81. <listitem>
  82. <para>Set this variable to <quote>1</quote>, <quote>yes</quote> or
  83. <quote>true</quote> in order to put the
  84. console into UTF-8 mode. This is useful in UTF-8 based locales and
  85. harmful otherwise.</para>
  86. </listitem>
  87. </varlistentry>
  88. <varlistentry>
  89. <term>LEGACY_CHARSET</term>
  90. <listitem>
  91. <para>For many keyboard layouts, there is no stock Unicode keymap in
  92. the Kbd package. The <command>console</command> bootscript will
  93. convert an available keymap to UTF-8 on the fly if this variable is
  94. set to the encoding of the available non-UTF-8 keymap.</para>
  95. </listitem>
  96. </varlistentry>
  97. </variablelist>
  98. <para>Some examples:</para>
  99. <itemizedlist>
  100. <listitem>
  101. <para>For a non-Unicode setup, only the KEYMAP and FONT variables are
  102. generally needed. E.g., for a Polish setup, one would use:</para>
  103. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  104. <literal># Begin /etc/sysconfig/console
  105. KEYMAP="pl2"
  106. FONT="lat2a-16 -m 8859-2"
  107. # End /etc/sysconfig/console</literal>
  108. EOF</userinput></screen>
  109. </listitem>
  110. <listitem>
  111. <para>As mentioned above, it is sometimes necessary to adjust a
  112. stock keymap slightly. The following example adds the Euro symbol to the
  113. German keymap:</para>
  114. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  115. <literal># Begin /etc/sysconfig/console
  116. KEYMAP="de-latin1"
  117. KEYMAP_CORRECTIONS="euro2"
  118. FONT="lat0-16 -m 8859-15"
  119. # End /etc/sysconfig/console</literal>
  120. EOF</userinput></screen>
  121. </listitem>
  122. <listitem>
  123. <para>The following is a Unicode-enabled example for Bulgarian, where a
  124. stock UTF-8 keymap exists:</para>
  125. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  126. <literal># Begin /etc/sysconfig/console
  127. UNICODE="1"
  128. KEYMAP="bg_bds-utf8"
  129. FONT="LatArCyrHeb-16"
  130. # End /etc/sysconfig/console</literal>
  131. EOF</userinput></screen>
  132. </listitem>
  133. <listitem>
  134. <para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous
  135. example, bright colors are no longer available on the Linux console unless
  136. a framebuffer is used. If one wants to have bright colors without
  137. framebuffer and can live without characters not belonging to his language,
  138. it is still possible to use a language-specific 256-glyph font, as
  139. illustrated below:</para>
  140. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  141. <literal># Begin /etc/sysconfig/console
  142. UNICODE="1"
  143. KEYMAP="bg_bds-utf8"
  144. FONT="cyr-sun16"
  145. # End /etc/sysconfig/console</literal>
  146. EOF</userinput></screen>
  147. </listitem>
  148. <listitem>
  149. <para>The following example illustrates keymap autoconversion from
  150. ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para>
  151. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  152. <literal># Begin /etc/sysconfig/console
  153. UNICODE="1"
  154. KEYMAP="de-latin1"
  155. KEYMAP_CORRECTIONS="euro2"
  156. LEGACY_CHARSET="iso-8859-15"
  157. FONT="LatArCyrHeb-16 -m 8859-15"
  158. # End /etc/sysconfig/console</literal>
  159. EOF</userinput></screen>
  160. </listitem>
  161. <listitem>
  162. <para>Some keymaps have dead keys (i.e., keys that don't produce a
  163. character by themselves, but put an accent on the character produced
  164. by the next key) or define composition rules (such as: <quote>press
  165. Ctrl+. A E to get &AElig;</quote> in the default keymap).
  166. Linux-&linux-version; interprets dead keys and composition rules in the
  167. keymap correctly only when the source characters to be composed together
  168. are not multibyte. This deficiency doesn't affect keymaps for European
  169. languages, because there accents are added to unaccented ASCII
  170. characters, or two ASCII characters are composed together. However, in
  171. UTF-8 mode it is a problem, e.g., for the Greek language, where one
  172. sometimes needs to put an accent on the letter <quote>alpha</quote>.
  173. The solution is either to avoid the use of UTF-8, or to install the
  174. X window system that doesn't have this limitation in its input
  175. handling.</para>
  176. </listitem>
  177. <listitem>
  178. <para>For Chinese, Japanese, Korean and some other languages, the Linux
  179. console cannot be configured to display the needed characters. Users
  180. who need such languages should install the X Window System, fonts that
  181. cover the necessary character ranges, and the proper input method (e.g.,
  182. SCIM, it supports a wide variety of languages).</para>
  183. </listitem>
  184. </itemizedlist>
  185. <!-- Added because folks keep posting their console file with X questions
  186. to blfs-support list -->
  187. <note>
  188. <para>The <filename>/etc/sysconfig/console</filename> file only controls the Linux text console localization. It has nothing to do with setting the
  189. proper keyboard layout and terminal fonts in the X Window System, with ssh
  190. sessions or with a serial console. In such situations, limitations mentioned
  191. in the last two list items above do not apply.</para>
  192. </note>
  193. </sect1>