console.xml 5.0 KB

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