````text id="41827" # TTY Keyboard Layouts Without X ## Overview A Linux system does not need a graphical environment in order to support multiple keyboard layouts. When working directly in a virtual console (TTY), keyboard configuration can be handled at the console level without starting X11 or Wayland. This is particularly useful on lightweight systems, minimal installations, recovery environments, servers, and machines where a graphical stack is unnecessary. The configuration below provides three keyboard layouts: ```text US Ukrainian Russian ```` with **Left Alt + Left Shift** used to switch between them. --- ## Configure the Virtual Console Edit: ```bash sudo nano /etc/default/keyboard ``` Use the following configuration: ```text XKBMODEL="pc105" XKBLAYOUT="us,ua,ru" XKBVARIANT="" XKBOPTIONS="grp:lalt_lshift_toggle,terminate:ctrl_alt_bksp,grp_led:scroll" BACKSPACE="guess" ``` Apply the configuration: ```bash sudo setupcon ``` The new layout can then be tested directly from the current TTY. --- ## Switching Layouts The configured layouts are: ```text US UA RU ``` Press: ```text Left Alt + Left Shift ``` to cycle through the layouts. The keyboard group indicator can be assigned to the Scroll Lock LED with: ```text grp_led:scroll ``` if the hardware supports it. --- ## Why Not Win + Space? `Win + Space` is commonly associated with desktop input-method handling. A pure Linux virtual console does not provide the same input-method infrastructure as an X11 or Wayland desktop session. Therefore, if the goal is to keep the machine completely outside the graphical stack, relying on `Win + Space` is unnecessary and generally inappropriate for a TTY-only configuration. The traditional XKB group-switching mechanism is sufficient: ```text grp:lalt_lshift_toggle ``` This keeps keyboard layout handling inside the console environment itself. --- ## Useful Additional Options The configuration above also contains: ```text terminate:ctrl_alt_bksp ``` which enables: ```text Ctrl + Alt + Backspace ``` as a console termination sequence where supported. The complete configuration therefore combines three independent functions: ```text grp:lalt_lshift_toggle terminate:ctrl_alt_bksp grp_led:scroll ``` They control: 1. Keyboard layout switching 2. Console termination 3. Optional layout indication through the Scroll Lock LED --- ## Applying the Configuration After modifying `/etc/default/keyboard`, run: ```bash sudo setupcon ``` If the configuration is intended to be the permanent system configuration, it will also be applied during subsequent console initialization. No graphical server is required. No desktop environment is required. No X11 packages are required for the keyboard switching mechanism itself. --- ## Minimal TTY Principle For a lightweight Unix/Linux installation, this approach has a useful property: ```text Kernel Virtual Console (TTY) XKB keyboard configuration US UA RU ``` There is no need to introduce: ```text X11 Wayland desktop environment graphical input-method framework ``` merely to obtain multilingual keyboard input. The console can remain a console. --- ## Removing Unnecessary Graphical Components Once keyboard configuration and other required functions work correctly from the TTY, unnecessary graphical components can be reviewed and removed separately. This should be done as a **dependency-aware cleanup**, rather than by blindly deleting packages associated with X. Before removing anything, inspect which installed packages actually depend on the graphical stack. Useful commands include: ```bash dpkg -l | grep -E 'xorg|xserver|x11' ``` and: ```bash apt-mark showmanual ``` On Debian-based systems, package relationships can also be inspected with: ```bash apt-cache depends ``` and: ```bash apt-cache rdepends ``` The objective is not simply to make the package database smaller. The objective is to leave a system with a clear dependency chain: ```text TTY shell console tools keyboard configuration required system services ``` while removing graphical components that have no remaining purpose. --- ## Result The resulting environment provides a clean multilingual TTY without requiring a graphical session: ```text TTY US UA RU Alt + Shift ``` This is a simple, traditional Unix/Linux solution: configure the console directly, keep the dependency tree small, and do not install a graphical subsystem merely to solve a keyboard-layout problem. ``` ```