console.xml 8.4 KB

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