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 |
|
---|
8 | <sect1 id="ch-scripts-console">
|
---|
9 | <?dbhtml filename="console.html"?>
|
---|
10 |
|
---|
11 | <title>Configuring the Linux Console</title>
|
---|
12 |
|
---|
13 | <indexterm zone="ch-scripts-console">
|
---|
14 | <primary sortas="d-console">console</primary>
|
---|
15 | <secondary>configuring</secondary>
|
---|
16 | </indexterm>
|
---|
17 |
|
---|
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 |
|
---|
26 | <para>The <command>console</command> and <command>consolelog</command>
|
---|
27 | script reads the <filename>/etc/sysconfig/console</filename> file for
|
---|
28 | configuration information.
|
---|
29 | Decide which keymap and screen font will be used. Various language-specific
|
---|
30 | HOWTOs can also help with this, see <ulink
|
---|
31 | url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in
|
---|
32 | doubt, look in the <filename class="directory">/lib/kbd</filename>
|
---|
33 | directory for valid keymaps and screen fonts. Read
|
---|
34 | <filename>loadkeys(1)</filename> and <filename>setfont(8)</filename> manual
|
---|
35 | pages to determine the correct arguments for these programs.</para>
|
---|
36 |
|
---|
37 | <para>The <filename>/etc/sysconfig/console</filename> file should contain lines
|
---|
38 | of the form: VARIABLE="value". The following variables are recognized:</para>
|
---|
39 |
|
---|
40 | <variablelist>
|
---|
41 |
|
---|
42 | <varlistentry>
|
---|
43 | <term>LOGLEVEL</term>
|
---|
44 | <listitem>
|
---|
45 | <para>This variable specifies the log level for kernel messages sent
|
---|
46 | to the console as set by <command>dmesg</command>. Valid levels are
|
---|
47 | from "1" (no messages) to "8". The default level is "7".</para>
|
---|
48 | </listitem>
|
---|
49 | </varlistentry>
|
---|
50 |
|
---|
51 | <varlistentry>
|
---|
52 | <term>KEYMAP</term>
|
---|
53 | <listitem>
|
---|
54 | <para>This variable specifies the arguments for the
|
---|
55 | <command>loadkeys</command> program, typically, the name of keymap
|
---|
56 | to load, e.g., <quote>es</quote>. If this variable is not set, the
|
---|
57 | bootscript will not run the <command>loadkeys</command> program,
|
---|
58 | and the default kernel keymap will be used.</para>
|
---|
59 | </listitem>
|
---|
60 | </varlistentry>
|
---|
61 |
|
---|
62 | <varlistentry>
|
---|
63 | <term>KEYMAP_CORRECTIONS</term>
|
---|
64 | <listitem>
|
---|
65 | <para>This (rarely used) variable
|
---|
66 | specifies the arguments for the second call to the
|
---|
67 | <command>loadkeys</command> program. This is useful if the stock keymap
|
---|
68 | is not completely satisfactory and a small adjustment has to be made. E.g.,
|
---|
69 | to include the Euro sign into a keymap that normally doesn't have it,
|
---|
70 | set this variable to <quote>euro2</quote>.</para>
|
---|
71 | </listitem>
|
---|
72 | </varlistentry>
|
---|
73 |
|
---|
74 | <varlistentry>
|
---|
75 | <term>FONT</term>
|
---|
76 | <listitem>
|
---|
77 | <para>This variable specifies the arguments for the
|
---|
78 | <command>setfont</command> program. Typically, this includes the font
|
---|
79 | name, <quote>-m</quote>, and the name of the application character
|
---|
80 | map to load. E.g., in order to load the <quote>lat1-16</quote> font
|
---|
81 | together with the <quote>8859-1</quote> application character map
|
---|
82 | (as it is appropriate in the USA), <!-- because of the copyright sign -->
|
---|
83 | set this variable to <quote>lat1-16 -m 8859-1</quote>.
|
---|
84 | If this variable is not set, the bootscript will not run the
|
---|
85 | <command>setfont</command> program, and the default VGA font will be
|
---|
86 | used together with the default application character map.</para>
|
---|
87 | </listitem>
|
---|
88 | </varlistentry>
|
---|
89 |
|
---|
90 | <varlistentry>
|
---|
91 | <term>UNICODE</term>
|
---|
92 | <listitem>
|
---|
93 | <para>Set this variable to <quote>1</quote>, <quote>yes</quote> or
|
---|
94 | <quote>true</quote> in order to put the
|
---|
95 | console into UTF-8 mode. This is useful in UTF-8 based locales and
|
---|
96 | harmful otherwise.</para>
|
---|
97 | </listitem>
|
---|
98 | </varlistentry>
|
---|
99 |
|
---|
100 | <varlistentry>
|
---|
101 | <term>LEGACY_CHARSET</term>
|
---|
102 | <listitem>
|
---|
103 | <para>For many keyboard layouts, there is no stock Unicode keymap in
|
---|
104 | the Kbd package. The <command>console</command> bootscript will
|
---|
105 | convert an available keymap to UTF-8 on the fly if this variable is
|
---|
106 | set to the encoding of the available non-UTF-8 keymap.</para>
|
---|
107 | </listitem>
|
---|
108 | </varlistentry>
|
---|
109 |
|
---|
110 | </variablelist>
|
---|
111 |
|
---|
112 | <para>Some examples:</para>
|
---|
113 |
|
---|
114 | <itemizedlist>
|
---|
115 |
|
---|
116 | <listitem>
|
---|
117 | <para>For a non-Unicode setup, only the KEYMAP and FONT variables are
|
---|
118 | generally needed. E.g., for a Polish setup, one would use:</para>
|
---|
119 |
|
---|
120 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
121 | <literal># Begin /etc/sysconfig/console
|
---|
122 |
|
---|
123 | KEYMAP="pl2"
|
---|
124 | FONT="lat2a-16 -m 8859-2"
|
---|
125 |
|
---|
126 | # End /etc/sysconfig/console</literal>
|
---|
127 | EOF</userinput></screen>
|
---|
128 | </listitem>
|
---|
129 |
|
---|
130 | <listitem>
|
---|
131 | <para>As mentioned above, it is sometimes necessary to adjust a
|
---|
132 | stock keymap slightly. The following example adds the Euro symbol to the
|
---|
133 | German keymap:</para>
|
---|
134 |
|
---|
135 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
136 | <literal># Begin /etc/sysconfig/console
|
---|
137 |
|
---|
138 | KEYMAP="de-latin1"
|
---|
139 | KEYMAP_CORRECTIONS="euro2"
|
---|
140 | FONT="lat0-16 -m 8859-15"
|
---|
141 |
|
---|
142 | # End /etc/sysconfig/console</literal>
|
---|
143 | EOF</userinput></screen>
|
---|
144 | </listitem>
|
---|
145 |
|
---|
146 | <listitem>
|
---|
147 | <para>The following is a Unicode-enabled example for Bulgarian, where a
|
---|
148 | stock UTF-8 keymap exists:</para>
|
---|
149 |
|
---|
150 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
151 | <literal># Begin /etc/sysconfig/console
|
---|
152 |
|
---|
153 | UNICODE="1"
|
---|
154 | KEYMAP="bg_bds-utf8"
|
---|
155 | FONT="LatArCyrHeb-16"
|
---|
156 |
|
---|
157 | # End /etc/sysconfig/console</literal>
|
---|
158 | EOF</userinput></screen>
|
---|
159 | </listitem>
|
---|
160 |
|
---|
161 | <listitem>
|
---|
162 | <para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous
|
---|
163 | example, bright colors are no longer available on the Linux console unless
|
---|
164 | a framebuffer is used. If one wants to have bright colors without
|
---|
165 | framebuffer and can live without characters not belonging to his language,
|
---|
166 | it is still possible to use a language-specific 256-glyph font, as
|
---|
167 | illustrated below:</para>
|
---|
168 |
|
---|
169 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
170 | <literal># Begin /etc/sysconfig/console
|
---|
171 |
|
---|
172 | UNICODE="1"
|
---|
173 | KEYMAP="bg_bds-utf8"
|
---|
174 | FONT="cyr-sun16"
|
---|
175 |
|
---|
176 | # End /etc/sysconfig/console</literal>
|
---|
177 | EOF</userinput></screen>
|
---|
178 | </listitem>
|
---|
179 |
|
---|
180 | <listitem>
|
---|
181 | <para>There is no pre-made UTF-8 Russian keyamp, therefore it has to be
|
---|
182 | produced by converting the existing KOI8-R keymap as illustrated
|
---|
183 | below:</para>
|
---|
184 |
|
---|
185 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
186 | <literal># Begin /etc/sysconfig/console
|
---|
187 |
|
---|
188 | UNICODE="1"
|
---|
189 | KEYMAP="ru_ms"
|
---|
190 | LEGACY_CHARSET="koi8-r"
|
---|
191 | FONT="LatArCyrHeb-16"
|
---|
192 |
|
---|
193 | # End /etc/sysconfig/console</literal>
|
---|
194 | EOF</userinput></screen>
|
---|
195 | </listitem>
|
---|
196 |
|
---|
197 | <listitem>
|
---|
198 | <para>Some keymaps have dead keys (i.e., keys that don't produce a
|
---|
199 | character by themselves, but put an accent on the character produced
|
---|
200 | by the next key) or define composition rules (such as: <quote>press
|
---|
201 | Ctrl+. A E to get Æ</quote> in the default keymap).
|
---|
202 | Linux-&linux-version; in UTF-8 keyboard mode assumes that accented
|
---|
203 | characters produced via dead keys or composing are in the Latin-1 range
|
---|
204 | of Unicode, and it is impossible to change this assumption. Thus,
|
---|
205 | accented characters needed for, e.g., the Czech language, can't be typed
|
---|
206 | on Linux console in UTF-8 mode (but files containing these characters can
|
---|
207 | be displayed correctly). The solution is either to avoid the use of
|
---|
208 | UTF-8, or to install the X window system that doesn't have this
|
---|
209 | limitation in its input handling.</para>
|
---|
210 | </listitem>
|
---|
211 |
|
---|
212 | <listitem>
|
---|
213 | <para>For Chinese, Japanese, Korean and some other languages, the Linux
|
---|
214 | console cannot be configured to display the needed characters. Users
|
---|
215 | who need such languages should install the X Window System, fonts that
|
---|
216 | cover the necessary character ranges, and the proper input method (e.g.,
|
---|
217 | SCIM, it supports a wide variety of languages).</para>
|
---|
218 | </listitem>
|
---|
219 |
|
---|
220 | </itemizedlist>
|
---|
221 |
|
---|
222 | <!-- Added because folks keep posting their console file with X questions
|
---|
223 | to blfs-support list -->
|
---|
224 | <note>
|
---|
225 | <para>The <filename>/etc/sysconfig/console</filename> file only controls the Linux text console localization. It has nothing to do with setting the
|
---|
226 | proper keyboard layout and terminal fonts in the X Window System, with ssh
|
---|
227 | sessions or with a serial console. In such situations, limitations mentioned
|
---|
228 | in the last two list items above do not apply.</para>
|
---|
229 | </note>
|
---|
230 |
|
---|
231 | </sect1>
|
---|