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