console.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. <sect2 id="ch-scripts-sysv-console">
  22. <title>Systemd V</title>
  23. <para>The <command>console</command> script reads the
  24. <filename>/etc/sysconfig/console</filename> file for configuration
  25. information. Decide which keymap and screen font will be used. Various
  26. language-specific HOWTOs can also help with this, see <ulink
  27. url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in
  28. doubt, look in the <filename class="directory">/usr/share/keymaps</filename>
  29. and <filename class="directory">/usr/share/consolefonts</filename> directories
  30. for valid keymaps and screen fonts. Read <filename>loadkeys(1)</filename> and
  31. <filename>setfont(8)</filename> manual pages to determine the correct
  32. 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>LOGLEVEL</term>
  38. <listitem>
  39. <para>This variable specifies the log level for kernel messages sent
  40. to the console as set by <command>dmesg</command>. Valid levels are
  41. from "1" (no messages) to "8". The default level is "7".</para>
  42. </listitem>
  43. </varlistentry>
  44. <varlistentry>
  45. <term>KEYMAP</term>
  46. <listitem>
  47. <para>This variable specifies the arguments for the
  48. <command>loadkeys</command> program, typically, the name of keymap
  49. to load, e.g., <quote>es</quote>. If this variable is not set, the
  50. bootscript will not run the <command>loadkeys</command> program,
  51. and the default kernel keymap will be used.</para>
  52. </listitem>
  53. </varlistentry>
  54. <varlistentry>
  55. <term>KEYMAP_CORRECTIONS</term>
  56. <listitem>
  57. <para>This (rarely used) variable
  58. specifies the arguments for the second call to the
  59. <command>loadkeys</command> program. This is useful if the stock keymap
  60. is not completely satisfactory and a small adjustment has to be made. E.g.,
  61. to include the Euro sign into a keymap that normally doesn't have it,
  62. set this variable to <quote>euro2</quote>.</para>
  63. </listitem>
  64. </varlistentry>
  65. <varlistentry>
  66. <term>FONT</term>
  67. <listitem>
  68. <para>This variable specifies the arguments for the
  69. <command>setfont</command> program. Typically, this includes the font
  70. name, <quote>-m</quote>, and the name of the application character
  71. map to load. E.g., in order to load the <quote>lat1-16</quote> font
  72. together with the <quote>8859-1</quote> application character map
  73. (as it is appropriate in the USA),
  74. <!-- because of the copyright sign -->
  75. set this variable to <quote>lat1-16 -m 8859-1</quote>.
  76. In UTF-8 mode, the kernel uses the application character map for
  77. conversion of composed 8-bit key codes in the keymap to UTF-8, and thus
  78. the argument of the "-m" parameter should be set to the encoding of the
  79. composed key codes in the keymap.</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>The following example illustrates keymap autoconversion from
  153. ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para>
  154. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  155. <literal># Begin /etc/sysconfig/console
  156. UNICODE="1"
  157. KEYMAP="de-latin1"
  158. KEYMAP_CORRECTIONS="euro2"
  159. LEGACY_CHARSET="iso-8859-15"
  160. FONT="LatArCyrHeb-16 -m 8859-15"
  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; interprets dead keys and composition rules in the
  170. keymap correctly only when the source characters to be composed together
  171. are not multibyte. This deficiency doesn't affect keymaps for European
  172. languages, because there accents are added to unaccented ASCII
  173. characters, or two ASCII characters are composed together. However, in
  174. UTF-8 mode it is a problem, e.g., for the Greek language, where one
  175. sometimes needs to put an accent on the letter <quote>alpha</quote>.
  176. The solution is either to avoid the use of UTF-8, or to install the
  177. X window system that doesn't have this limitation in its input
  178. handling.</para>
  179. </listitem>
  180. <listitem>
  181. <para>For Chinese, Japanese, Korean and some other languages, the Linux
  182. console cannot be configured to display the needed characters. Users
  183. who need such languages should install the X Window System, fonts that
  184. cover the necessary character ranges, and the proper input method (e.g.,
  185. SCIM, it supports a wide variety of languages).</para>
  186. </listitem>
  187. </itemizedlist>
  188. <!-- Added because folks keep posting their console file with X questions
  189. to blfs-support list -->
  190. <note>
  191. <para>The <filename>/etc/sysconfig/console</filename> file only controls
  192. the Linux text console localization. It has nothing to do with setting
  193. the proper keyboard layout and terminal fonts in the X Window System, with
  194. ssh sessions or with a serial console. In such situations, limitations
  195. mentioned in the last two list items above do not apply.</para>
  196. </note>
  197. </sect2>
  198. <sect2 id="ch-scripts-systemd-console">
  199. <title>Systemd</title>
  200. <indexterm zone="ch-scripts-systemd-console">
  201. <primary sortas="d-console">systemd console</primary>
  202. <secondary>configuring</secondary>
  203. </indexterm>
  204. <para>This section discusses how to configure the
  205. <command>systemd-vconsole-setup</command> system service, which configures
  206. the virtual console font and console keymap.</para>
  207. <para>The <command>systemd-vconsole-setup</command> service reads the
  208. <filename>/etc/vconsole.conf</filename> file for configuration
  209. information. Decide which keymap and screen font will be used. Various
  210. language-specific HOWTOs can also help with this, see <ulink
  211. url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>.
  212. Examine <command>localectl list-keymaps</command> output for a list of
  213. valid console keymaps. Look in
  214. <filename class="directory">/usr/share/consolefonts</filename>
  215. directory for valid screen fonts.</para>
  216. <para>The <filename>/etc/vconsole.conf</filename> file should contain lines
  217. of the form: VARIABLE="value". The following variables are recognized:</para>
  218. <variablelist>
  219. <varlistentry>
  220. <term>KEYMAP</term>
  221. <listitem>
  222. <para>This variable specifies the key mapping table for the keyboard. If
  223. unset, it defaults to <literal>us</literal>.</para>
  224. </listitem>
  225. </varlistentry>
  226. <varlistentry>
  227. <term>KEYMAP_TOGGLE</term>
  228. <listitem>
  229. <para>This variable can be used to configure a second toggle keymap and
  230. is unset by default.</para>
  231. </listitem>
  232. </varlistentry>
  233. <varlistentry>
  234. <term>FONT</term>
  235. <listitem>
  236. <para>This variable specifies the font used by the virtual
  237. console.</para>
  238. </listitem>
  239. </varlistentry>
  240. <varlistentry>
  241. <term>FONT_MAP</term>
  242. <listitem>
  243. <para>This variable specifies the console map to be used.</para>
  244. </listitem>
  245. </varlistentry>
  246. <varlistentry>
  247. <term>FONT_UNIMAP</term>
  248. <listitem>
  249. <para>This variable specifies the unicode font map.</para>
  250. </listitem>
  251. </varlistentry>
  252. </variablelist>
  253. <para>An example for a German keyboard and console is given below:</para>
  254. <screen role="nodump"><userinput>cat &gt; /etc/vconsole.conf &lt;&lt; "EOF"
  255. <literal>KEYMAP=de-latin1
  256. FONT=Lat2-Terminus16</literal>
  257. EOF</userinput></screen>
  258. <para>You can change KEYMAP value at runtime by using the
  259. <command>localectl</command> utility:</para>
  260. <screen role="nodump"><userinput>localectl set-keymap MAP</userinput></screen>
  261. <note><para>Please note that <command>localectl</command> command can
  262. be used only on a system booted with Systemd.</para></note>
  263. </sect2>
  264. </sect1>