console.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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 and the console font. If non-ASCII
  16. characters (e.g., the copyright sign, the British pound sign and Euro symbol)
  17. will not be used and the keyboard is a U.S. one, skip this section. Without
  18. the configuration file, the <command>console</command> bootscript will do
  19. nothing.</para>
  20. <para>The <command>console</command> script reads the
  21. <filename>/etc/sysconfig/console</filename> file for configuration information.
  22. Decide which keymap and screen font will be used. Various language-specific
  23. HOWTOs can also help with this, see <ulink
  24. url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in
  25. doubt, look in the <filename class="directory">/lib/kbd</filename>
  26. directory for valid keymaps and screen fonts. Read
  27. <filename>loadkeys(1)</filename> and <filename>setfont(8)</filename> manual
  28. pages to determine the correct arguments for these programs.</para>
  29. <para>The <filename>/etc/sysconfig/console</filename> file should contain lines
  30. of the form: VARIABLE="value". The following variables are recognized:</para>
  31. <variablelist>
  32. <varlistentry>
  33. <term>KEYMAP</term>
  34. <listitem>
  35. <para>This variable specifies the arguments for the
  36. <command>loadkeys</command> program, typically, the name of keymap
  37. to load, e.g., <quote>es</quote>. If this variable is not set, the
  38. bootscript will not run the <command>loadkeys</command> program,
  39. and the default kernel keymap will be used.</para>
  40. </listitem>
  41. </varlistentry>
  42. <varlistentry>
  43. <term>KEYMAP_CORRECTIONS</term>
  44. <listitem>
  45. <para>This (rarely used) variable
  46. specifies the arguments for the second call to the
  47. <command>loadkeys</command> program. This is useful if the stock keymap
  48. is not completely satisfactory and a small adjustment has to be made. E.g.,
  49. to include the Euro sign into a keymap that normally doesn't have it,
  50. set this variable to <quote>euro2</quote>.</para>
  51. </listitem>
  52. </varlistentry>
  53. <varlistentry>
  54. <term>FONT</term>
  55. <listitem>
  56. <para>This variable specifies the arguments for the
  57. <command>setfont</command> program. Typically, this includes the font
  58. name, <quote>-m</quote>, and the name of the application character
  59. map to load. E.g., in order to load the <quote>lat1-16</quote> font
  60. together with the <quote>8859-1</quote> application character map
  61. (as it is appropriate in the USA), <!-- because of the copyright sign -->
  62. set this variable to <quote>lat1-16 -m 8859-1</quote>.
  63. If this variable is not set, the bootscript will not run the
  64. <command>setfont</command> program, and the default VGA font will be
  65. used together with the default application character map.</para>
  66. </listitem>
  67. </varlistentry>
  68. <varlistentry>
  69. <term>UNICODE</term>
  70. <listitem>
  71. <para>Set this variable to <quote>1</quote>, <quote>yes</quote> or
  72. <quote>true</quote> in order to put the
  73. console into UTF-8 mode. This is useful in UTF-8 based locales and
  74. harmful otherwise.</para>
  75. </listitem>
  76. </varlistentry>
  77. <varlistentry>
  78. <term>LEGACY_CHARSET</term>
  79. <listitem>
  80. <para>For many keyboard layouts, there is no stock Unicode keymap in
  81. the Kbd package. The <command>console</command> bootscript will
  82. convert an available keymap to UTF-8 on the fly if this variable is
  83. set to the encoding of the available non-UTF-8 keymap.</para>
  84. </listitem>
  85. </varlistentry>
  86. </variablelist>
  87. <para>Some examples:</para>
  88. <itemizedlist>
  89. <listitem>
  90. <para>For a non-Unicode setup, only the KEYMAP and FONT variables are
  91. generally needed. E.g., for a Polish setup, one would use:</para>
  92. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  93. <literal># Begin /etc/sysconfig/console
  94. KEYMAP="pl2"
  95. FONT="lat2a-16 -m 8859-2"
  96. # End /etc/sysconfig/console</literal>
  97. EOF</userinput></screen>
  98. </listitem>
  99. <listitem>
  100. <para>As mentioned above, it is sometimes necessary to adjust a
  101. stock keymap slightly. The following example adds the Euro symbol to the
  102. German keymap:</para>
  103. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  104. <literal># Begin /etc/sysconfig/console
  105. KEYMAP="de-latin1"
  106. KEYMAP_CORRECTIONS="euro2"
  107. FONT="lat0-16 -m 8859-15"
  108. # End /etc/sysconfig/console</literal>
  109. EOF</userinput></screen>
  110. </listitem>
  111. <listitem>
  112. <para>The following is a Unicode-enabled example for Bulgarian, where a
  113. stock UTF-8 keymap exists:</para>
  114. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  115. <literal># Begin /etc/sysconfig/console
  116. UNICODE="1"
  117. KEYMAP="bg_bds-utf8"
  118. FONT="LatArCyrHeb-16"
  119. # End /etc/sysconfig/console</literal>
  120. EOF</userinput></screen>
  121. </listitem>
  122. <listitem>
  123. <para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous
  124. example, bright colors are no longer available on the Linux console unless
  125. a framebuffer is used. If one wants to have bright colors without
  126. framebuffer and can live without characters not belonging to his language,
  127. it is still possible to use a language-specific 256-glyph font, as
  128. illustrated below:</para>
  129. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  130. <literal># Begin /etc/sysconfig/console
  131. UNICODE="1"
  132. KEYMAP="bg_bds-utf8"
  133. FONT="cyr-sun16"
  134. # End /etc/sysconfig/console</literal>
  135. EOF</userinput></screen>
  136. </listitem>
  137. <listitem>
  138. <para>There is no pre-made UTF-8 Russian keyamp, therefore it has to be
  139. produced by converting the existing KOI8-R keymap as illustrated
  140. below:</para>
  141. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  142. <literal># Begin /etc/sysconfig/console
  143. UNICODE="1"
  144. KEYMAP="ru_ms"
  145. LEGACY_CHARSET="koi8-r"
  146. FONT="LatArCyrHeb-16"
  147. # End /etc/sysconfig/console</literal>
  148. EOF</userinput></screen>
  149. </listitem>
  150. <listitem>
  151. <para>Some keymaps have dead keys (i.e., keys that don't produce a
  152. character by themselves, but put an accent on the character produced
  153. by the next key) or define composition rules (such as: <quote>press
  154. Ctrl+. A E to get &AElig;</quote> in the default keymap).
  155. Linux-&linux-version; in UTF-8 keyboard mode assumes that accented
  156. characters produced via dead keys or composing are in the Latin-1 range
  157. of Unicode, and it is impossible to change this assumption. Thus,
  158. accented characters needed for, e.g., the Czech language, can't be typed
  159. on Linux console in UTF-8 mode (but files containing these characters can
  160. be displayed correctly). The solution is either to avoid the use of
  161. UTF-8, or to install the X window system that doesn't have this
  162. limitation in its input handling.</para>
  163. </listitem>
  164. <listitem>
  165. <para>For Chinese, Japanese, Korean and some other languages, the Linux
  166. console cannot be configured to display the needed characters. Users
  167. who need such languages should install the X Window System, fonts that
  168. cover the necessary character ranges, and the proper input method (e.g.,
  169. SCIM, it supports a wide variety of languages).</para>
  170. </listitem>
  171. </itemizedlist>
  172. <!-- Added because folks keep posting their console file with X questions
  173. to blfs-support list -->
  174. <note>
  175. <para>The <filename>/etc/sysconfig/console</filename> file only controls the Linux text console localization. It has nothing to do with setting the
  176. proper keyboard layout and terminal fonts in the X Window System, with ssh
  177. sessions or with a serial console. In such situations, limitations mentioned
  178. in the last two list items above do not apply.</para>
  179. </note>
  180. </sect1>