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">
8 <sect1 id="ch-scripts-console">
9 <?dbhtml filename="console.html"?>
11 <title>Configuring the Linux Console</title>
13 <indexterm zone="ch-scripts-console">
14 <primary sortas="d-console">console</primary>
15 <secondary>configuring</secondary>
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>
26 <sect2 id="ch-scripts-sysv-console">
27 <title>System V</title>
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>
40 <para>The <filename>/etc/sysconfig/console</filename> file should contain lines
41 of the form: VARIABLE="value". The following variables are recognized:</para>
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>
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>
66 <term>KEYMAP_CORRECTIONS</term>
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>
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>
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>
107 <term>LEGACY_CHARSET</term>
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>
118 <para>Some examples:</para>
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>
126 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
127 <literal># Begin /etc/sysconfig/console
130 FONT="lat2a-16 -m 8859-2"
132 # End /etc/sysconfig/console</literal>
133 EOF</userinput></screen>
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>
141 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
142 <literal># Begin /etc/sysconfig/console
145 KEYMAP_CORRECTIONS="euro2"
146 FONT="lat0-16 -m 8859-15"
148 # End /etc/sysconfig/console</literal>
149 EOF</userinput></screen>
153 <para>The following is a Unicode-enabled example for Bulgarian, where a
154 stock UTF-8 keymap exists:</para>
156 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
157 <literal># Begin /etc/sysconfig/console
161 FONT="LatArCyrHeb-16"
163 # End /etc/sysconfig/console</literal>
164 EOF</userinput></screen>
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>
175 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
176 <literal># Begin /etc/sysconfig/console
182 # End /etc/sysconfig/console</literal>
183 EOF</userinput></screen>
187 <para>The following example illustrates keymap autoconversion from
188 ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para>
190 <screen role="nodump"><userinput>cat > /etc/sysconfig/console << "EOF"
191 <literal># Begin /etc/sysconfig/console
195 KEYMAP_CORRECTIONS="euro2"
196 LEGACY_CHARSET="iso-8859-15"
197 FONT="LatArCyrHeb-16 -m 8859-15"
199 # End /etc/sysconfig/console</literal>
200 EOF</userinput></screen>
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
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>
230 <!-- Added because folks keep posting their console file with X questions
231 to blfs-support list -->
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>
242 <sect2 id="ch-scripts-systemd-console">
243 <title>Systemd</title>
245 <indexterm zone="ch-scripts-systemd-console">
246 <primary sortas="d-console">systemd console</primary>
247 <secondary>configuring</secondary>
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>
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>
264 <para>The <filename>/etc/vconsole.conf</filename> file should contain lines
265 of the form: VARIABLE="value". The following variables are recognized:</para>
272 <para>This variable specifies the key mapping table for the keyboard. If
273 unset, it defaults to <literal>us</literal>.</para>
278 <term>KEYMAP_TOGGLE</term>
280 <para>This variable can be used to configure a second toggle keymap and
281 is unset by default.</para>
288 <para>This variable specifies the font used by the virtual
293 <term>FONT_MAP</term>
295 <para>This variable specifies the console map to be used.</para>
300 <term>FONT_UNIMAP</term>
302 <para>This variable specifies the Unicode font map.</para>
308 <para>An example for a German keyboard and console is given below:</para>
310 <screen role="nodump"><userinput>cat > /etc/vconsole.conf << "EOF"
311 <literal>KEYMAP=de-latin1
312 FONT=Lat2-Terminus16</literal>
313 EOF</userinput></screen>
315 <para>You can change KEYMAP value at runtime by using the
316 <command>localectl</command> utility:</para>
318 <screen role="nodump"><userinput>localectl set-keymap MAP</userinput></screen>
320 <note><para>Please note that <command>localectl</command> command can
321 be used only on a system booted with Systemd.</para></note>