393. Locale and console
This page is for anyone who needs a different keyboard layout, a regional date format, or a working text console. It covers the language settings every login gets, the keyboard layout of the text consoles and of the desktop, and the font and colours of the consoles.
KDOS speaks English only, so a locale (the set of rules for character handling, dates, numbers and currency that a program follows) decides character handling and a few formats rather than the language of the programs. The page shows where each setting lives, how to change the keyboard layout, and what to check when a console comes up with the wrong font or layout. How the consoles are started, and why the font is loaded where it is, is in the KDOS book’s The console section.
Installation
| What | Port |
|---|---|
The C library and its built-in C.UTF-8 locale |
musl |
The locale command and musl’s locale files |
musl-locales |
loadkeys, setfont, showconsolefont, setvtrgb and the console keymaps |
kbd |
The console font, ter-kdos32n |
terminus-font |
kdos-getty, which loads the font, the colours and the keymap on each console |
kdos-tools |
kdos-power accent, which recolours the console |
kdos-powerd |
org.freedesktop.locale1: the system locale and the keyboard layout of the login screen and new sessions |
kdos-settingsd |
All of them are on the image. kdos-getty is started by /etc/inittab on tty2, and on tty1 when the display manager cannot run, not by a service script, so there is nothing to enable. Typing Chinese, Japanese and Korean is the input method’s job; see Input methods.
Configuration
/etc/locale.conf, from fs/etc/locale.conf, is the system locale. kdos-dm hands it to SDDM, which gives it to the login screen and to every session it starts; kdos-settingsd rewrites it when the locale is set through locale1, from System Settings → Region & Language or plasma-setup:
# The system locale. kdos-dm hands it to SDDM, and SDDM gives it to the login
# screen and to every session it starts; without a LANG line here SDDM sets
# LANG to C, the byte locale, for all of them. kdos-settingsd rewrites this
# file through org.freedesktop.locale1, as bare NAME and value lines only,
# so this comment goes with the first change. en_US.UTF-8 is the default:
# C.UTF-8 is Qt's C locale, which writes a date as "8 11 2026", has no
# currency sign and names no language for KDE's translations to load.
LANG=en_US.UTF-8
/etc/profile, from fs/etc/profile, sets the locale of every login shell that has none, and keeps the one a session already has:
# A LANG already set is kept: a Plasma session sources this file after SDDM
# gave it the LANG of /etc/locale.conf, and overwriting it here would put
# every session back on the default whatever locale1 chose.
export LANG="${LANG:-en_US.UTF-8}"
/etc/profile.d/00locale.sh is installed by musl-locales. Its build names the option that installs the file, LOCALE_PROFILE, in ports/core/toolchain/musl-locales/build.sh:
cmake -S . -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D LOCALE_PROFILE=ON \
-Wno-dev
ports/core/toolchain/musl-locales/build.sh, lines 12–17
It sets MUSL_LOCPATH to /usr/share/i18n/locales/musl, the directory musl reads locale files from and locale -a lists.
/etc/keymap holds the console keymap’s name on one line. The installer writes it from its Keyboard page; the image does not ship it, so the live medium uses the kernel’s built-in US map. kdos-getty loads it on every console, in src/system/kdos-tools/getty.c:
/* /etc/keymap is written by the installer. loadkeys is
* console-wide rather than per-VT, so doing it again on the
* second getty is a no-op; it lives here rather than in rcS
* only because this is the one place guaranteed to run after
* fbcon has finished resetting the VTs. */
char km[128] = {0};
if (kb_have_prog("loadkeys") &&
kb_read_line_file("/etc/keymap", km, sizeof(km)) > 0 && km[0]) {
const char *lk[] = { "loadkeys", km, NULL };
fprintf(stderr, "kdos-getty: loadkeys %s exit %d\n", km,
run(lk, NULL, 0));
}
src/system/kdos-tools/getty.c, lines 319–330
/etc/kdos/xkb.conf is the graphical layout of the login screen and of every new session, which kdos-settingsd serves as locale1’s X11Layout and the rest. Its XKBLAYOUT is empty as shipped, which follows the console: the layout nearest the map in /etc/keymap. The file and how to change it are on Session and environment. A person’s own layout, on System Settings → Keyboard, is saved in ~/.config/kxkbrc and wins in that person’s sessions. Turning the page’s layout list on starts it from the layout the session runs, so a layout added joins it.
The console font is compiled into kdos-getty and has no setting:
#define FONT "ter-kdos32n"
#define FONT_GEOM "16x32"
src/system/kdos-tools/getty.c, lines 72–73
/etc/vtrgb, shipped from fs/etc/vtrgb, holds the sixteen console colours as three lines of red, green and blue values. kdos-getty loads it with setvtrgb, and setting the accent rewrites it; see accent.
10,255,244,185,47,199,37,222,128,255,247,208,115,217,108,243
10,90,240,179,143,125,208,217,125,144,244,204,179,167,223,241
9,90,226,161,255,255,192,203,117,144,235,192,255,255,212,236
/etc/inittab, from fs/etc/inittab, puts kdos-getty in front of the login on tty2:
# Second console, a login prompt for any account. THE RECOVERY CONSOLE: it
# is a plain agetty with no --autologin, and nothing above may be allowed to
# make it one too, because it is what is left when the desktop on tty1 does
# not come up — a greeter SDDM keeps restarting included, which no respawn
# here ever sees. kdos-getty loads the console font and palette after fbcon's
# deferred take-over; doing that in rcS is futile, because the take-over resets
# every VT's font. agetty hands the name to /bin/login, util-linux's PAM login
# (/etc/pam.d/login, through system-login), so a console login is a session
# elogind knows and starts the user's services like any other.
#
# EVERY AGETTY HERE NAMES /etc/issue. agetty built against musl, which has no
# scandirat(), reads no issue file of its own accord, and without
# --issue-file the banner /etc/issue holds is never printed.
2:2345:respawn:/usr/local/sbin/kdos-getty tty2 /sbin/agetty --noclear --issue-file /etc/issue tty2 38400 linux
Usage
Seeing the locale
Show the locale every category is in:
localeList the locales with files on this machine:
locale -a
Using another locale for one account
Every program’s menus and messages stay in English whatever is set (Known gaps). musl-locales’ files translate the C library’s own messages and its date and time strings.
Add the setting to the account’s
~/.bash_profile, or for the desktop alone set it on System Settings → Region & Language, which writes~/.config/plasma-localerc:export LC_TIME=de_DE.UTF-8For a program that formats through the C library, such as
date, the name must be one thatlocale -alists:C,C.UTF-8and seventeen musl-locales files,cs_CZ.UTF-8tosv_SE.UTF-8. With this onedateprintsMi Okt 21 19:14:39 UTC 2026; with any other it prints English names, and musl writes numbers and currency the C way for every name. Region & Language offers every region Qt’s locale data knows, and KDE programs format by any of them.Log out and in again. The session wrapper runs a login shell, so the desktop inherits it.
Changing the keyboard layout of the consoles and the desktop
Find the map’s name. Each file under
/usr/share/keymapsis a map, named without its.map.gzsuffix:find /usr/share/keymaps -name '*.map.gz' | sed 's|.*/||; s|\.map\.gz$||' | sort | lessTry it on the console you are on; it applies to every console at once and lasts until the next map is loaded:
sudo loadkeys de-latin1Keep it, for the consoles and the desktop together, through locale1:
dbus-send --system --print-reply --dest=org.freedesktop.locale1 \ /org/freedesktop/locale1 org.freedesktop.locale1.SetVConsoleKeyboard \ string:de-latin1 string: boolean:true boolean:truekdos-settingsd checks the name, writes
/etc/keymap, loads it, and with the secondtruesets the nearest graphical layout in/etc/kdos/xkb.confas well, which the login screen takes at once, and in/etc/xdg/kxkbrc, which the session and lock screen of an account with no~/.config/kxkbrctake at the next login. Every console loads the map from the next time its login prompt starts; writing/etc/keymapby hand does the same for the consoles alone.Log out of the desktop and in again, or set the layout on System Settings → Keyboard, which applies at once.
On the live medium, /etc/keymap lasts until power-off unless the medium has a persistence store (kdos persist).
Giving the desktop a layout of its own
System Settings → Keyboard → Layouts: turn on Configure layouts, add the layout and variant, and Apply. It applies at once, to your sessions only. The machine’s own layout, the login screen’s, is set through locale1’s SetX11Keyboard, as /etc/kdos/xkb.conf’s comment shows; kdos-settingsd writes it to xkb.conf and to /etc/xdg/kxkbrc, which every session and lock screen of an account with no ~/.config/kxkbrc reads. The consoles keep /etc/keymap unless the call’s convert argument is true: kdos-settingsd then also writes and loads the console keymap nearest the layout, when there is one.
Reading the console font
showconsolefont -i
prints the size of the font loaded on the console you are on, as width, height and glyph count: 16x32x512 for ter-kdos32n, which kdos-getty loads and checks for the 16x32 at the start. From another console or as root, name the console with -C: showconsolefont -i -C /dev/tty2. On tty1 while the greeter or the desktop holds it the answer is showconsolefont: ERROR kdfontop.c:38 is_kd_text_mode: Console is not in text mode, because KWin has switched that console to graphics.
setfont loads another font for the current console. The fonts in /usr/share/consolefonts are the Terminus faces from terminus-font; the kbd port removes kbd’s own. The console keeps the font until its login prompt starts again, when kdos-getty loads ter-kdos32n once more:
setfont ter-124n
Tips
C.UTF-8is built into musl and needs no file underMUSL_LOCPATH.Ctrl+Alt+F2from the desktop reachestty2, the recovery console, andCtrl+Alt+F1there comes back; see The console.- The console font has no emoji and no Nerd Font icons, so a program that prints them on
tty2shows blank cells there; the same program in Konsole shows them.
Troubleshooting
A console comes up with the small kernel font. Read the log kdos-getty writes for that console, then the size actually loaded:
cat /run/kdos-getty.tty2.log
showconsolefont -i
The log is appended to each time the console’s getty starts. It holds kdos-getty’s own lines, such as kdos-getty: tty2 winsize -> <columns>x<rows> when it corrected the window size, and whatever the getty it then runs writes to its error output. setfont and loadkeys run with their output thrown away, so a font that did not load shows only as the size showconsolefont -i reports. Without setfont, from the kbd package, kdos-getty loads no font, no colours and no keymap at all; a missing /usr/share/consolefonts/ter-kdos32n.psf.gz, from terminus-font, leaves the kernel’s font.
The console keyboard has the wrong layout. Check the file and load it by hand to see the error kdos-getty did not show:
cat /etc/keymap
sudo loadkeys "$(cat /etc/keymap)"
A name that loadkeys cannot find is not under /usr/share/keymaps, and loadkeys says so: loadkeys: Unable to open file: <name>: No such file or directory.
The consoles have the right layout and the desktop is US. The desktop follows /etc/kdos/xkb.conf, and when its layout is empty, the nearest layout to /etc/keymap; a map with no near XKB layout leaves US. Ask locale1 what it serves, and set the layout through it:
dbus-send --system --print-reply --dest=org.freedesktop.locale1 /org/freedesktop/locale1 \
org.freedesktop.DBus.Properties.Get string:org.freedesktop.locale1 string:X11Layout
A layout set on the Keyboard page in ~/.config/kxkbrc outranks it.
The console colours are wrong or half black. /etc/vtrgb must be readable and hold three lines of sixteen numbers each. Setting the accent again rewrites it; see accent.
LANG or LC_MESSAGES set to another language changes nothing. That is expected; see Known gaps.
Known gaps
- Every program speaks English
- A command-line program’s dates follow seventeen regions, and its numbers none
- Emoji draw everywhere except the text console on
tty1 - Nerd Font icons are blank on
tty1, and the shipped configurations turn them off everywhere
See also
- The console: what
kdos-gettydoes, in order, and why - Language: the English-only rule
- Size and language policy: why no translations ship
- 2. Keyboard: the installer’s Keyboard page and the console-to-XKB names
/etc/keymap: the file’s reference entry- Input methods: typing Chinese, Japanese and Korean
- Time and NTP: the time zone, the other setting the profile carries
- Login and autologin: what runs on
tty1andtty2 - Session and environment:
/etc/kdos/xkb.conf - Live persistence: keeping the keymap on the live medium