Keyboard Layout

From Kicksecure
Jump to navigation Jump to search
Documentation Previous page: USBGuard Index page: Documentation Next page: Project-APT-Repository Keyboard Layout

This wiki page provides information on keyboard layouts and how to configure them in Kicksecure.

Kicksecure

[edit]

Desktop Environment

[edit]

Kicksecure 18 and later.

System-wide configuration.

System-wide Keyboard Layout Change for GUI (labwc) and virtual terminals (CLI)
Platform Steps
System-wide - TUI

Terminal User Interface (TUI)

Interactive:

sudo set-system-keymap --interactive

System-wide - CLI

command line interface (CLI)

View available keymaps.

localectl list-x11-keymap-layouts

Syntax:

sudo set-system-keymap keymap

Example:

Note: Replace de with the actual keymap to use.

sudo set-system-keymap de

Manually: See below.

Other Wayland compositors Differs depending on the Wayland compositor in use. Usually can be set using DE-specific tools, and may require editing a configuration file and then restarting the compositor to make changes take effect.

Per-user configuration. (Not system-wide configuration.)

Desktop Keyboard Layout Change
Platform Steps
LXQt + labwc Wayland compositor - TUI

Terminal User Interface (TUI)

Interactive:

set-labwc-keymap --interactive

LXQt + labwc Wayland compositor - CLI

command line interface (CLI)

View available keymaps.

localectl list-x11-keymap-layouts

Syntax:

set-labwc-keymap keymap

Example:

Note: Replace de with the actual keymap to use.

set-labwc-keymap de

Manually: See footnote. [1]

Other Wayland compositors Differs depending on the Wayland compositor in use. Usually can be set using DE-specific tools, and may require editing a configuration file and then restarting the compositor to make changes take effect.

Multiple Keyboard Layouts

[edit]

You can configure multiple keyboard layouts at the same time, and switch between them with a keyboard shortcut. [2] A maximum of four keyboard layouts can be configured simultaneously.

1 Open a terminal.

2 Run a keymap configuration tool with the --interactive option.

Chose either option A) or B).

  • A) system-wide, requires administrative ("root") rights:
    • sudo set-system-keymap --interactive
  • B) graphical user interface (GUI) only, no admin rights required:
    • set-labwc-keymap --interactive

3 When prompted to enter the keyboard layouts to use, input a comma-separated list of layouts. For instance, to use US English and German keyboard layouts, type us,de, then press Enter.

4 When prompted to enter keyboard layout variants, press Enter to use the default layout variants. [3]

5 When prompted to enter keyboard layout options, type grp:alt_shift_toggle, then press Enter.

6 Done.

You can now press Alt + Shift to switch between the selected keyboard layouts.

Changing the system or console keymap when using Full Disk Encryption

[edit]

Special care must be taken when changing the console keyboard layout if you are using full disk encryption. Failure to follow these instructions may result in an unbootable system!

The disk decryption prompt is displayed during early boot. The keyboard layout used by the decryption prompt is hardcoded into the "initramfs", a small filesystem used as part of the boot process to prepare the real OS for startup. In order to decrypt the OS's primary disk, the keyboard layout used by the initramfs must allow the user to type all characters that make up the passphrase. The initramfs is occasionally regenerated so that system updates apply to it. When this occurs, the current console keyboard layout is embedded in the initramfs, and becomes the keyboard layout used at the disk decryption prompt.

This means that, if you change your keyboard layout to one that does not allow typing all characters that are part of your passphrase, the system will become unbootable the next time the initramfs is generated. For instance, if you were using a German keyboard layout, and included a ß or § character in the passphrase, the system will become unbootable if the keyboard layout is switched to US English and the initramfs is regenerated. This is because the US English keyboard layout is not able to type the ß and § characters.

set-system-keymap regenerates the initramfs as part of the keyboard layout change process. This will result in a system lockout on the next reboot if the above scenario occurs. set-console-keymap does not regenerate the initramfs, so it may not immediately cause a system lockout. However, software updates will automatically regenerate the initramfs frequently, so a system lockout will likely occur after the next software update if care is not taken.

Note that if the new keyboard layout is capable of typing all characters that are part of the disk passphrase, there is no risk of lockout. One will simply have to type their passphrase using the new keyboard layout rather than the old one.

If you need to change your keyboard layout, and the new layout is incompatible with your disk passphrase, you will have to change the disk passphrase to be compatible with the new keyboard layout. To do this on GUI systems:

1 Open two terminal windows, and place them side-by-side on the desktop.

2 In one window, run:

sudo crypt-pwchange

3 When prompted to choose a device to change the passphrase of, choose the device the root filesystem (/) is mounted from. You can use lsblk to determine which device is mounted at /.

4 When prompted for the existing passphrase, click the other terminal window, and run:

set-labwc-keymap --no-persist OLD_KEYMAP

Replace OLD_KEYMAP with the keyboard layout the existing disk passphrase can be typed in. This will ensure your graphical session's keyboard layout is appropriate for typing the existing passphrase.

5 Click the terminal window where crypt-pwchange is running, and type the existing disk passphrase.

6 When prompted for the new passphrase, click the other terminal window again, and run:

set-labwc-keymap --no-persist NEW_KEYMAP

Replace NEW_KEYMAP with the new keyboard layout you wish to use. This will ensure your graphical session's keyboard layout is appropriate for typing the new disk passphrase.

7 Click the terminal window where crypt-pwchange is running, and type the new disk passphrase.

8 Type the new disk passphrase again to confirm.

9 Click the other terminal window again, and run one of the following commands.

To change the system-wide keyboard layout:

sudo set-system-keymap NEW_KEYMAP

To change only the console keymap:

sudo set-console-keymap NEW_KEYMAP && sudo dracut --regenerate-all --force

Replace NEW_KEYMAP with the new keyboard layout you wish to use.

10 Done.

The process of changing the keyboard layout and disk passphrase is complete.

On CLI-only systems, you can use the same instructions as above using two virtual terminals instead of two terminal windows. Use set-console-keymap KEYMAP rather than set-labwc-keymap --no-persist KEYMAP to change the keyboard layout as needed during the process.

Virtual Terminal

[edit]

To change the keyboard layout.

Note: Changes the keyboard layout for virtual terminals only. This does not affect the graphical environment. [4]

  • sudo set-console-keymap
  • or:
  • sudo set-system-keymap

[5] [6]

sudo set-console-keymap

Simple

[edit]

set-system-keymap sets both keyboard layouts for,

  • 1) command line interface (CLI), and
  • 2) graphical user interface (GUI).

With 1 command only. It can either be started from

Terminal User Interface (TUI):

sudo set-system-keymap --interactive

CLI:

sudo set-system-keymap

If installing Kicksecure using its ISO, Kicksecure's Calamares based installer uses set-system-keymap internally to configure the keyboard layout.

Kicksecure-Qubes

[edit]

To correctly apply changes system-wide via dom0: [7]

  • System ToolsKeyboardLayout

Alternatively, language localization inputarchive.org iconarchive.today icon can be configured on a per VM basis.

If problems are encountered, see: My keyboard layout settings are not behaving correctly. What should I do?archive.org iconarchive.today icon in the Qubes FAQ.

Related Qubes upstream bug report:

Forum Discussions

[edit]

See Also

[edit]

Footnotes

[edit]
  1. labwc uses the XKB_DEFAULT_LAYOUT environment variable, as documented at labwc getting startedarchive.org iconarchive.today icon. To permanently change the keyboard layout, apply the following steps.
    • Open a terminal → Run mkdir -p ~/.config/labwc → Run nano ~/.config/labwc/environment → Type XKB_DEFAULT_LAYOUT=zz, replacing zz with the code for your keyboard layout → Type Ctrl+S to save, then Ctrl+X to exit → Run labwc --reconfigure to load the new settings.
  2. Kicksecure forum threadarchive.org iconarchive.today icon
  3. If you need non-standard keyboard layout variants, you may enter them here. You must specify the same number of layouts and layout variants. The layouts must be comma-separated. For instance, if you are using the layouts us,de, and want to use the Colemak layout for the US keyboard and the Dvorak layout for the German keyboard, specify colemak,dvorak as the variants.

    If you need to use a default keyboard layout for a variant, you may omit the variant from the list. However, you must type any commas that would have been present otherwise. For instance, to use the Colemak layout for the US keyboard, and the default layout for the German keyboard, specify colemak, as the variants. To use the default layout for the US keyboard, and the Dvorak layout for the German keyboard, specify ,dvorak as the variants.
  4. Manually: sudo dpkg-reconfigure keyboard-configuration && sudo setupcon
    French keyboards:
    Perhaps an upstream bug. May no longer be applicable.
    (Clonezilla live known issues (archived)archive.org icon)
    If you are using a French keymap, remember to use "Select keymap from full list":
    1. Select keymap from full list
    2. pc / azerty / French / Same as X11 (latin 9) / Standard
  5. Alternative /etc/default/keyboard method:
    Open file /etc/default/keyboard in an editor with administrative ("root") rights.

    1 Select your platform.

    Kicksecure

    2 Notes.

    • Sudoedit guidance: See Open File with Root Rights for details on why using sudoedit improves security and how to use it.
    • Editor requirement: Close Featherpad (or the chosen text editor) before running the sudoedit command.

    3 Open the file with root rights.

    sudoedit /etc/default/keyboard

    Kicksecure-Qubes

    2 Notes.

    • Sudoedit guidance: See Open File with Root Rights for details on why using sudoedit improves security and how to use it.
    • Editor requirement: Close Featherpad (or the chosen text editor) before running the sudoedit command.
    • Template requirement: When using Kicksecure-Qubes, this must be done inside the Template.

    3 Open the file with root rights.

    sudoedit /etc/default/keyboard

    4 Notes.

    • Shut down Template: After applying this change, shut down the Template.
    • Restart App Qubes: All App Qubes based on the Template need to be restarted if they were already running.
    • Qubes persistence: See also Qubes Persistence
    • General procedure: This is a general procedure required for Qubes and is unspecific to Kicksecure-Qubes.

    Others and Alternatives

    2 Notes.

    • Example only: This is just an example. Other tools could achieve the same goal.
    • Troubleshooting and alternatives: If this example does not work for you, or if you are not using Kicksecure, please refer to Open File with Root Rights.

    3 Open the file with root rights.

    sudoedit /etc/default/keyboard

  6. Alternative loadkeys method:
    Temporary until reboot. sudo loadkeys de
  7. The Qubes bug report the change does not propagate to other VMsarchive.org iconarchive.today icon has now been resolved.

Documentation Previous page: USBGuard Index page: Documentation Next page: Project-APT-Repository

Notification image

We believe security software like Kicksecure needs to remain Open Source and independent. Would you help sustain and grow the project? Learn more about our 13 year success story and maybe DONATE!