console.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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),
  76. <!-- because of the copyright sign -->
  77. set this variable to <quote>lat1-16 -m 8859-1</quote>.
  78. In UTF-8 mode, the kernel uses the application character map for
  79. conversion of composed 8-bit key codes in the keymap to UTF-8, and thus
  80. the argument of the "-m" parameter should be set to the encoding of the
  81. composed key codes in the keymap.</para>
  82. </listitem>
  83. </varlistentry>
  84. <varlistentry>
  85. <term>UNICODE</term>
  86. <listitem>
  87. <para>Set this variable to <quote>1</quote>, <quote>yes</quote> or
  88. <quote>true</quote> in order to put the
  89. console into UTF-8 mode. This is useful in UTF-8 based locales and
  90. harmful otherwise.</para>
  91. </listitem>
  92. </varlistentry>
  93. <varlistentry>
  94. <term>LEGACY_CHARSET</term>
  95. <listitem>
  96. <para>For many keyboard layouts, there is no stock Unicode keymap in
  97. the Kbd package. The <command>console</command> bootscript will
  98. convert an available keymap to UTF-8 on the fly if this variable is
  99. set to the encoding of the available non-UTF-8 keymap.</para>
  100. </listitem>
  101. </varlistentry>
  102. </variablelist>
  103. <para>Some examples:</para>
  104. <itemizedlist>
  105. <listitem>
  106. <para>For a non-Unicode setup, only the KEYMAP and FONT variables are
  107. generally needed. E.g., for a Polish setup, one would use:</para>
  108. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  109. <literal># Begin /etc/sysconfig/console
  110. KEYMAP="pl2"
  111. FONT="lat2a-16 -m 8859-2"
  112. # End /etc/sysconfig/console</literal>
  113. EOF</userinput></screen>
  114. </listitem>
  115. <listitem>
  116. <para>As mentioned above, it is sometimes necessary to adjust a
  117. stock keymap slightly. The following example adds the Euro symbol to the
  118. German keymap:</para>
  119. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  120. <literal># Begin /etc/sysconfig/console
  121. KEYMAP="de-latin1"
  122. KEYMAP_CORRECTIONS="euro2"
  123. FONT="lat0-16 -m 8859-15"
  124. # End /etc/sysconfig/console</literal>
  125. EOF</userinput></screen>
  126. </listitem>
  127. <listitem>
  128. <para>The following is a Unicode-enabled example for Bulgarian, where a
  129. stock UTF-8 keymap exists:</para>
  130. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  131. <literal># Begin /etc/sysconfig/console
  132. UNICODE="1"
  133. KEYMAP="bg_bds-utf8"
  134. FONT="LatArCyrHeb-16"
  135. # End /etc/sysconfig/console</literal>
  136. EOF</userinput></screen>
  137. </listitem>
  138. <listitem>
  139. <para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous
  140. example, bright colors are no longer available on the Linux console unless
  141. a framebuffer is used. If one wants to have bright colors without
  142. framebuffer and can live without characters not belonging to his language,
  143. it is still possible to use a language-specific 256-glyph font, as
  144. illustrated 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="bg_bds-utf8"
  149. FONT="cyr-sun16"
  150. # End /etc/sysconfig/console</literal>
  151. EOF</userinput></screen>
  152. </listitem>
  153. <listitem>
  154. <para>The following example illustrates keymap autoconversion from
  155. ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para>
  156. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  157. <literal># Begin /etc/sysconfig/console
  158. UNICODE="1"
  159. KEYMAP="de-latin1"
  160. KEYMAP_CORRECTIONS="euro2"
  161. LEGACY_CHARSET="iso-8859-15"
  162. FONT="LatArCyrHeb-16 -m 8859-15"
  163. # End /etc/sysconfig/console</literal>
  164. EOF</userinput></screen>
  165. </listitem>
  166. <listitem>
  167. <para>Some keymaps have dead keys (i.e., keys that don't produce a
  168. character by themselves, but put an accent on the character produced
  169. by the next key) or define composition rules (such as: <quote>press
  170. Ctrl+. A E to get &AElig;</quote> in the default keymap).
  171. Linux-&linux-version; interprets dead keys and composition rules in the
  172. keymap correctly only when the source characters to be composed together
  173. are not multibyte. This deficiency doesn't affect keymaps for European
  174. languages, because there accents are added to unaccented ASCII
  175. characters, or two ASCII characters are composed together. However, in
  176. UTF-8 mode it is a problem, e.g., for the Greek language, where one
  177. sometimes needs to put an accent on the letter <quote>alpha</quote>.
  178. The solution is either to avoid the use of UTF-8, or to install the
  179. X window system that doesn't have this limitation in its input
  180. handling.</para>
  181. </listitem>
  182. <listitem>
  183. <para>For Chinese, Japanese, Korean and some other languages, the Linux
  184. console cannot be configured to display the needed characters. Users
  185. who need such languages should install the X Window System, fonts that
  186. cover the necessary character ranges, and the proper input method (e.g.,
  187. SCIM, it supports a wide variety of languages).</para>
  188. </listitem>
  189. </itemizedlist>
  190. <!-- Added because folks keep posting their console file with X questions
  191. to blfs-support list -->
  192. <note>
  193. <para>The <filename>/etc/sysconfig/console</filename> file only controls the Linux text console localization. It has nothing to do with setting the
  194. proper keyboard layout and terminal fonts in the X Window System, with ssh
  195. sessions or with a serial console. In such situations, limitations mentioned
  196. in the last two list items above do not apply.</para>
  197. </note>
  198. </sect1>