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 | bootscript that sets up the keyboard map, console font and console kernel log
|
---|
20 | level. If non-ASCII characters (e.g., the copyright sign, the British pound
|
---|
21 | sign and Euro symbol) will not be used and the keyboard is a U.S. one, much
|
---|
22 | of this section can be skipped. Without the configuration file, (or
|
---|
23 | equivalent settings in <filename>rc.site</filename>), the
|
---|
24 | <command>console</command> bootscript will do nothing.</para>
|
---|
25 |
|
---|
26 | <sect2 id="ch-scripts-sysv-console">
|
---|
27 | <title>System V</title>
|
---|
28 |
|
---|
29 | <para>The <command>console</command> script reads the
|
---|
30 | <filename>/etc/sysconfig/console</filename> file for configuration
|
---|
31 | information. Decide which keymap and screen font will be used. Various
|
---|
32 | language-specific HOWTOs can also help with this, see <ulink
|
---|
33 | url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in
|
---|
34 | doubt, look in the <filename class="directory">/usr/share/keymaps</filename>
|
---|
35 | and <filename class="directory">/usr/share/consolefonts</filename> directories
|
---|
36 | for valid keymaps and screen fonts. Read <filename>loadkeys(1)</filename> and
|
---|
37 | <filename>setfont(8)</filename> manual pages to determine the correct
|
---|
38 | arguments for these programs.</para>
|
---|
39 |
|
---|
40 | <para>The <filename>/etc/sysconfig/console</filename> file should contain lines
|
---|
41 | of the form: VARIABLE="value". The following variables are recognized:</para>
|
---|
42 |
|
---|
43 | <variablelist>
|
---|
44 |
|
---|
45 | <varlistentry>
|
---|
46 | <term>LOGLEVEL</term>
|
---|
47 | <listitem>
|
---|
48 | <para>This variable specifies the log level for kernel messages sent
|
---|
49 | to the console as set by <command>dmesg</command>. Valid levels are
|
---|
50 | from "1" (no messages) to "8". The default level is "7".</para>
|
---|
51 | </listitem>
|
---|
52 | </varlistentry>
|
---|
53 |
|
---|
54 | <varlistentry>
|
---|
55 | <term>KEYMAP</term>
|
---|
56 | <listitem>
|
---|
57 | <para>This variable specifies the arguments for the
|
---|
58 | <command>loadkeys</command> program, typically, the name of keymap
|
---|
59 | to load, e.g., <quote>es</quote>. If this variable is not set, the
|
---|
60 | bootscript will not run the <command>loadkeys</command> program,
|
---|
61 | and the default kernel keymap will be used.</para>
|
---|
62 | </listitem>
|
---|
63 | </varlistentry>
|
---|
64 |
|
---|
65 | <varlistentry>
|
---|
66 | <term>KEYMAP_CORRECTIONS</term>
|
---|
67 | <listitem>
|
---|
68 | <para>This (rarely used) variable
|
---|
69 | specifies the arguments for the second call to the
|
---|
70 | <command>loadkeys</command> program. This is useful if the stock keymap
|
---|
71 | is not completely satisfactory and a small adjustment has to be made. E.g.,
|
---|
72 | to include the Euro sign into a keymap that normally doesn't have it,
|
---|
73 | set this variable to <quote>euro2</quote>.</para>
|
---|
74 | </listitem>
|
---|
75 | </varlistentry>
|
---|
76 |
|
---|
77 | <varlistentry>
|
---|
78 | <term>FONT</term>
|
---|
79 | <listitem>
|
---|
80 | <para>This variable specifies the arguments for the
|
---|
81 | <command>setfont</command> program. Typically, this includes the font
|
---|
82 | name, <quote>-m</quote>, and the name of the application character
|
---|
83 | map to load. E.g., in order to load the <quote>lat1-16</quote> font
|
---|
84 | together with the <quote>8859-1</quote> application character map
|
---|
85 | (as it is appropriate in the USA),
|
---|
86 | <!-- because of the copyright sign -->
|
---|
87 | set this variable to <quote>lat1-16 -m 8859-1</quote>.
|
---|
88 | In UTF-8 mode, the kernel uses the application character map for
|
---|
89 | conversion of composed 8-bit key codes in the keymap to UTF-8, and thus
|
---|
90 | the argument of the "-m" parameter should be set to the encoding of the
|
---|
91 | composed key codes in the keymap.</para>
|
---|
92 |
|
---|
93 | </listitem>
|
---|
94 | </varlistentry>
|
---|
95 |
|
---|
96 | <varlistentry>
|
---|
97 | <term>UNICODE</term>
|
---|
98 | <listitem>
|
---|
99 | <para>Set this variable to <quote>1</quote>, <quote>yes</quote> or
|
---|
100 | <quote>true</quote> in order to put the
|
---|
101 | console into UTF-8 mode. This is useful in UTF-8 based locales and
|
---|
102 | harmful otherwise.</para>
|
---|
103 | </listitem>
|
---|
104 | </varlistentry>
|
---|
105 |
|
---|
106 | <varlistentry>
|
---|
107 | <term>LEGACY_CHARSET</term>
|
---|
108 | <listitem>
|
---|
109 | <para>For many keyboard layouts, there is no stock Unicode keymap in
|
---|
110 | the Kbd package. The <command>console</command> bootscript will
|
---|
111 | convert an available keymap to UTF-8 on the fly if this variable is
|
---|
112 | set to the encoding of the available non-UTF-8 keymap.</para>
|
---|
113 | </listitem>
|
---|
114 | </varlistentry>
|
---|
115 |
|
---|
116 | </variablelist>
|
---|
117 |
|
---|
118 | <para>Some examples:</para>
|
---|
119 |
|
---|
120 | <itemizedlist>
|
---|
121 |
|
---|
122 | <listitem>
|
---|
123 | <para>For a non-Unicode setup, only the KEYMAP and FONT variables are
|
---|
124 | generally needed. E.g., for a Polish setup, one would use:</para>
|
---|
125 |
|
---|
126 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
127 | <literal># Begin /etc/sysconfig/console
|
---|
128 |
|
---|
129 | KEYMAP="pl2"
|
---|
130 | FONT="lat2a-16 -m 8859-2"
|
---|
131 |
|
---|
132 | # End /etc/sysconfig/console</literal>
|
---|
133 | EOF</userinput></screen>
|
---|
134 | </listitem>
|
---|
135 |
|
---|
136 | <listitem>
|
---|
137 | <para>As mentioned above, it is sometimes necessary to adjust a
|
---|
138 | stock keymap slightly. The following example adds the Euro symbol to the
|
---|
139 | German keymap:</para>
|
---|
140 |
|
---|
141 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
142 | <literal># Begin /etc/sysconfig/console
|
---|
143 |
|
---|
144 | KEYMAP="de-latin1"
|
---|
145 | KEYMAP_CORRECTIONS="euro2"
|
---|
146 | FONT="lat0-16 -m 8859-15"
|
---|
147 |
|
---|
148 | # End /etc/sysconfig/console</literal>
|
---|
149 | EOF</userinput></screen>
|
---|
150 | </listitem>
|
---|
151 |
|
---|
152 | <listitem>
|
---|
153 | <para>The following is a Unicode-enabled example for Bulgarian, where a
|
---|
154 | stock UTF-8 keymap exists:</para>
|
---|
155 |
|
---|
156 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
157 | <literal># Begin /etc/sysconfig/console
|
---|
158 |
|
---|
159 | UNICODE="1"
|
---|
160 | KEYMAP="bg_bds-utf8"
|
---|
161 | FONT="LatArCyrHeb-16"
|
---|
162 |
|
---|
163 | # End /etc/sysconfig/console</literal>
|
---|
164 | EOF</userinput></screen>
|
---|
165 | </listitem>
|
---|
166 |
|
---|
167 | <listitem>
|
---|
168 | <para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous
|
---|
169 | example, bright colors are no longer available on the Linux console unless
|
---|
170 | a framebuffer is used. If one wants to have bright colors without
|
---|
171 | framebuffer and can live without characters not belonging to his language,
|
---|
172 | it is still possible to use a language-specific 256-glyph font, as
|
---|
173 | illustrated below:</para>
|
---|
174 |
|
---|
175 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
176 | <literal># Begin /etc/sysconfig/console
|
---|
177 |
|
---|
178 | UNICODE="1"
|
---|
179 | KEYMAP="bg_bds-utf8"
|
---|
180 | FONT="cyr-sun16"
|
---|
181 |
|
---|
182 | # End /etc/sysconfig/console</literal>
|
---|
183 | EOF</userinput></screen>
|
---|
184 | </listitem>
|
---|
185 |
|
---|
186 | <listitem>
|
---|
187 | <para>The following example illustrates keymap autoconversion from
|
---|
188 | ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para>
|
---|
189 |
|
---|
190 | <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
|
---|
191 | <literal># Begin /etc/sysconfig/console
|
---|
192 |
|
---|
193 | UNICODE="1"
|
---|
194 | KEYMAP="de-latin1"
|
---|
195 | KEYMAP_CORRECTIONS="euro2"
|
---|
196 | LEGACY_CHARSET="iso-8859-15"
|
---|
197 | FONT="LatArCyrHeb-16 -m 8859-15"
|
---|
198 |
|
---|
199 | # End /etc/sysconfig/console</literal>
|
---|
200 | EOF</userinput></screen>
|
---|
201 | </listitem>
|
---|
202 |
|
---|
203 | <listitem>
|
---|
204 | <para>Some keymaps have dead keys (i.e., keys that don't produce a
|
---|
205 | character by themselves, but put an accent on the character produced
|
---|
206 | by the next key) or define composition rules (such as: <quote>press
|
---|
207 | Ctrl+. A E to get Æ</quote> in the default keymap).
|
---|
208 | Linux-&linux-version; interprets dead keys and composition rules in the
|
---|
209 | keymap correctly only when the source characters to be composed together
|
---|
210 | are not multibyte. This deficiency doesn't affect keymaps for European
|
---|
211 | languages, because there accents are added to unaccented ASCII
|
---|
212 | characters, or two ASCII characters are composed together. However, in
|
---|
213 | UTF-8 mode it is a problem, e.g., for the Greek language, where one
|
---|
214 | sometimes needs to put an accent on the letter <quote>alpha</quote>.
|
---|
215 | The solution is either to avoid the use of UTF-8, or to install the
|
---|
216 | X window system that doesn't have this limitation in its input
|
---|
217 | handling.</para>
|
---|
218 | </listitem>
|
---|
219 |
|
---|
220 | <listitem>
|
---|
221 | <para>For Chinese, Japanese, Korean and some other languages, the Linux
|
---|
222 | console cannot be configured to display the needed characters. Users
|
---|
223 | who need such languages should install the X Window System, fonts that
|
---|
224 | cover the necessary character ranges, and the proper input method (e.g.,
|
---|
225 | SCIM, it supports a wide variety of languages).</para>
|
---|
226 | </listitem>
|
---|
227 |
|
---|
228 | </itemizedlist>
|
---|
229 |
|
---|
230 | <!-- Added because folks keep posting their console file with X questions
|
---|
231 | to blfs-support list -->
|
---|
232 | <note>
|
---|
233 | <para>The <filename>/etc/sysconfig/console</filename> file only controls
|
---|
234 | the Linux text console localization. It has nothing to do with setting
|
---|
235 | the proper keyboard layout and terminal fonts in the X Window System, with
|
---|
236 | ssh sessions or with a serial console. In such situations, limitations
|
---|
237 | mentioned in the last two list items above do not apply.</para>
|
---|
238 | </note>
|
---|
239 |
|
---|
240 | </sect2>
|
---|
241 |
|
---|
242 | <sect2 id="ch-scripts-systemd-console">
|
---|
243 | <title>Systemd</title>
|
---|
244 |
|
---|
245 | <indexterm zone="ch-scripts-systemd-console">
|
---|
246 | <primary sortas="d-console">systemd console</primary>
|
---|
247 | <secondary>configuring</secondary>
|
---|
248 | </indexterm>
|
---|
249 |
|
---|
250 | <para>This section discusses how to configure the
|
---|
251 | <command>systemd-vconsole-setup</command> system service, which configures
|
---|
252 | the virtual console font and console keymap.</para>
|
---|
253 |
|
---|
254 | <para>The <command>systemd-vconsole-setup</command> service reads the
|
---|
255 | <filename>/etc/vconsole.conf</filename> file for configuration
|
---|
256 | information. Decide which keymap and screen font will be used. Various
|
---|
257 | language-specific HOWTOs can also help with this, see <ulink
|
---|
258 | url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>.
|
---|
259 | Examine <command>localectl list-keymaps</command> output for a list of
|
---|
260 | valid console keymaps. Look in
|
---|
261 | <filename class="directory">/usr/share/consolefonts</filename>
|
---|
262 | directory for valid screen fonts.</para>
|
---|
263 |
|
---|
264 | <para>The <filename>/etc/vconsole.conf</filename> file should contain lines
|
---|
265 | of the form: VARIABLE="value". The following variables are recognized:</para>
|
---|
266 |
|
---|
267 | <variablelist>
|
---|
268 |
|
---|
269 | <varlistentry>
|
---|
270 | <term>KEYMAP</term>
|
---|
271 | <listitem>
|
---|
272 | <para>This variable specifies the key mapping table for the keyboard. If
|
---|
273 | unset, it defaults to <literal>us</literal>.</para>
|
---|
274 | </listitem>
|
---|
275 | </varlistentry>
|
---|
276 |
|
---|
277 | <varlistentry>
|
---|
278 | <term>KEYMAP_TOGGLE</term>
|
---|
279 | <listitem>
|
---|
280 | <para>This variable can be used to configure a second toggle keymap and
|
---|
281 | is unset by default.</para>
|
---|
282 | </listitem>
|
---|
283 | </varlistentry>
|
---|
284 |
|
---|
285 | <varlistentry>
|
---|
286 | <term>FONT</term>
|
---|
287 | <listitem>
|
---|
288 | <para>This variable specifies the font used by the virtual
|
---|
289 | console.</para>
|
---|
290 | </listitem>
|
---|
291 | </varlistentry>
|
---|
292 | <varlistentry>
|
---|
293 | <term>FONT_MAP</term>
|
---|
294 | <listitem>
|
---|
295 | <para>This variable specifies the console map to be used.</para>
|
---|
296 | </listitem>
|
---|
297 | </varlistentry>
|
---|
298 |
|
---|
299 | <varlistentry>
|
---|
300 | <term>FONT_UNIMAP</term>
|
---|
301 | <listitem>
|
---|
302 | <para>This variable specifies the Unicode font map.</para>
|
---|
303 | </listitem>
|
---|
304 | </varlistentry>
|
---|
305 |
|
---|
306 | </variablelist>
|
---|
307 |
|
---|
308 | <para>An example for a German keyboard and console is given below:</para>
|
---|
309 |
|
---|
310 | <screen role="nodump"><userinput>cat > /etc/vconsole.conf << "EOF"
|
---|
311 | <literal>KEYMAP=de-latin1
|
---|
312 | FONT=Lat2-Terminus16</literal>
|
---|
313 | EOF</userinput></screen>
|
---|
314 |
|
---|
315 | <para>You can change KEYMAP value at runtime by using the
|
---|
316 | <command>localectl</command> utility:</para>
|
---|
317 |
|
---|
318 | <screen role="nodump"><userinput>localectl set-keymap MAP</userinput></screen>
|
---|
319 |
|
---|
320 | <note><para>Please note that <command>localectl</command> command can
|
---|
321 | be used only on a system booted with Systemd.</para></note>
|
---|
322 |
|
---|
323 | </sect2>
|
---|
324 |
|
---|
325 | </sect1>
|
---|