console.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  3. <!ENTITY % general-entities SYSTEM "../general.ent">
  4. %general-entities;
  5. ]>
  6. <sect1 id="ch-scripts-console">
  7. <title>Configuring the Linux Console</title>
  8. <?dbhtml filename="console.html"?>
  9. <indexterm zone="ch-scripts-console">
  10. <primary sortas="d-console">console</primary>
  11. <secondary>configuring</secondary></indexterm>
  12. <para>This section discusses how to configure the <command>console</command>
  13. bootscript that sets up the keyboard map and the console font. If non-ASCII
  14. characters (British pound and Euro character are examples of non-ASCII
  15. characters) will not be used and the keyboard is a U.S. one, skip this section.
  16. Without the configuration file, the <command>console</command> bootscript will
  17. do nothing.</para>
  18. <para>The <command>console</command> script reads the
  19. <filename>/etc/sysconfig/console</filename> file for configuration information.
  20. Decide which keymap and screen font will be used. Various language-specific
  21. HOWTO's can also help with this (see <ulink
  22. url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. A pre-made
  23. <filename>/etc/sysconfig/console</filename> file with known settings for several
  24. countries was installed with the LFS-Bootscripts package, so the relevant
  25. section can be uncommented if the country is supported. If still in doubt, look
  26. in the <filename class="directory">/usr/share/kbd</filename> directory for valid
  27. keymaps and screen fonts. Read the <command>loadkeys</command> and
  28. <command>setfont</command> manual pages and determine the correct arguments for
  29. these programs. Once decided, create the configuration file with the following
  30. command:</para>
  31. <screen><userinput>cat &gt;/etc/sysconfig/console &lt;&lt;"EOF"
  32. <literal>KEYMAP="<replaceable>[arguments for loadkeys]</replaceable>"
  33. FONT="<replaceable>[arguments for setfont]</replaceable>"</literal>
  34. EOF</userinput></screen>
  35. <para>For example, for Spanish users who also want to use the Euro
  36. character (accessible by pressing AltGr+E), the following settings are
  37. correct:</para>
  38. <screen><userinput>cat &gt;/etc/sysconfig/console &lt;&lt;"EOF"
  39. <literal>KEYMAP="es euro2"
  40. FONT="lat9-16 -u iso01"</literal>
  41. EOF</userinput></screen>
  42. <note><para>The <envar>FONT</envar> line above is correct only for the ISO 8859-15
  43. character set. If using ISO 8859-1 and, therefore, a pound sign
  44. instead of Euro, the correct <envar>FONT</envar> line would be:</para>
  45. <screen><userinput>FONT="lat1-16"</userinput></screen></note>
  46. <para>If the <envar>KEYMAP</envar> or <envar>FONT</envar> variable is not set, the
  47. <command>console</command> initscript will not run the corresponding
  48. program.</para>
  49. <para>In some keymaps, the Backspace and Delete keys send characters different
  50. from ones in the default keymap built into the kernel. This confuses some
  51. applications. For example, Emacs displays its help (instead of erasing the
  52. character before the cursor) when Backspace is pressed. To check if the keymap
  53. in use is affected (this works only for i386 keymaps):</para>
  54. <screen><userinput>zgrep '\W14\W' <replaceable>[/path/to/your/keymap]</replaceable></userinput></screen>
  55. <para>If the keycode 14 is Backspace instead of Delete, create the
  56. following keymap snippet to fix this issue:</para>
  57. <screen><userinput>mkdir -p /etc/kbd &amp;&amp; cat &gt; /etc/kbd/bs-sends-del &lt;&lt;"EOF"
  58. <literal> keycode 14 = Delete Delete Delete Delete
  59. alt keycode 14 = Meta_Delete
  60. altgr alt keycode 14 = Meta_Delete
  61. keycode 111 = Remove
  62. altgr control keycode 111 = Boot
  63. control alt keycode 111 = Boot
  64. altgr control alt keycode 111 = Boot</literal>
  65. EOF</userinput></screen>
  66. <para>Tell the <command>console</command> script to load this
  67. snippet after the main keymap:</para>
  68. <screen><userinput>cat &gt;&gt;/etc/sysconfig/console &lt;&lt;"EOF"
  69. <literal>KEYMAP_CORRECTIONS="/etc/kbd/bs-sends-del"</literal>
  70. EOF</userinput></screen>
  71. <para>To compile the keymap directly into the kernel instead of
  72. setting it every time from the <command>console</command> bootscript,
  73. follow the instructions given in <xref linkend="ch-bootable-kernel" role="."/>
  74. Doing this ensures that the keyboard will always work as expected,
  75. even when booting into maintenance mode (by passing
  76. <parameter>init=/bin/sh</parameter> to the kernel), because the
  77. <command>console</command> bootscript will not be run in that
  78. situation. Additionally, the kernel will not set the screen font
  79. automatically. This should not pose many problems because ASCII characters
  80. will be handled correctly, and it is unlikely that a user would need
  81. to rely on non-ASCII characters while in maintenance mode.</para>
  82. <para>Since the kernel will set up the keymap, it is possible to omit
  83. the <envar>KEYMAP</envar> variable from the
  84. <filename>/etc/sysconfig/console</filename> configuration file. It can
  85. also be left in place, if desired, without consequence. Keeping it
  86. could be beneficial if running several different kernels where it is
  87. difficult to ensure that the keymap is compiled into every one of
  88. them.</para>
  89. </sect1>