console.xml 8.7 KB

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