console.xml 9.0 KB

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