Differences between revisions 32 and 33
Revision 32 as of 2015-01-10 11:04:21
Size: 4989
Editor: ?AndreasMohr
Comment: Improve altgr-intl variant and toggle key (XkbOptions).
Revision 33 as of 2015-04-10 13:55:29
Size: 4930
Comment: console-data is optional, the keymap with will be dynamically generated ( see setupcon -v, as called by service keyboard-setup restart )
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
* DebianPkg:console-data
Line 20: Line 19:
# dpkg-reconfigure console-data

Translation(s): English - Français - Italiano - Русский

http://www.debian.org/logos/openlogo-nd-50.png http://www.debian.org/Pics/debian.png

Portal/IDB/logo_portal.png Welcome to the Debian portal for keyboard information

Keyboard configuration

To configure the keyboard, you have to install following packages:

* keyboard-configuration

The keyboard settings are stored in /etc/default/keyboard file. It's provided by keyboard-configuration package (it's a part of the console-setup source package), and other packages use this information in order to configure the keyboard on the console or in X Window System.

You can change your keyboard settings using:

# dpkg-reconfigure keyboard-configuration
# service keyboard-setup restart

As usual, it will prompt you for the model of keyboard (what the keyboard *is*), and then for the keyboard layout (what the keys should *do*). Use this tool to change your keyboard map, e. g. from QWERTY to QWERTZ or to Dvorak, or for non-English layouts.

To apply new settings, restarting the keyboard-setup service should suffice, otherwise you can try to restart kernel input system via udev:

udevadm trigger --subsystem-match=input --action=change

or reboot the whole OS.

You can also edit /etc/default/keyboard manually, here's an example:


# Consult the keyboard(5) manual page.


  • XKBMODEL is a keyboard model variable (look at a /usr/share/X11/xkb/rules/base.lst (plain text) or /usr/share/X11/xkb/rules/base.xml (XML) for a full list);

  • XKBLAYOUT variable contains a list of used layouts;
  • "grp:alt_shift_toggle" sets a layout switching key combination (<Alt>+<Shift>).

See also:

  • keyboard(5) man page.

  • Keyboard layout (keymap) section in debian-reference ("dpkg-reconfigure --priority=low xserver-xorg" command suggested by the page linked above does not work in Squeeze. You may try to add something like "setxkbmap us,ru -option grp:ctrl_shift_toggle" into ~/.xsessionrc instead).

  • Configure additional multimedia keys.

How to set keyboard layout in initramfs

The appropriate section of /etc/initramfs-tools/initramfs.conf needs to be changed to have a localized keyboard layout at boot time:

# KEYMAP: [ y | n ]
# Load a keymap during the initramfs stage.


Apply changes:

# update-initramfs -u

How to enable USB keyboard in initramfs

The initramfs-tools must include the usbhid module and its dependencies for USB keyboard support at boot time. Either the configuration file /etc/initramfs-tools/conf.d/driver-policy must include most modules, or they will have to be specified in another file:

# MODULES: [ most | netboot | dep | list ]
# most - Add most filesystem and all harddrive drivers.
# dep - Try and guess which modules to load.
# netboot - Add the base modules, network modules, but skip block devices.
# list - Only include modules from the 'additional modules' list


If the configuration above was not set to include most modules, then the necessary modules have to be specified in the file /etc/initramfs-tools/modules:

# USB keyboard at boot

Apply changes:

# update-initramfs -u

How to switch a keyboard layout in X11 / graphical desktop environment

Use your favorite desktop keyboard layout switcher applet. You can also switch the layout from the terminal, e. g.:

$ setxkbmap de
$ setxkbmap fr
$ setxkbmap us

Of special interest for keyboard hardware with us layout might be the altgr-intl variant (this provides a simple AltGr mapping for many umlauts and special symbols):

$ setxkbmap -rules evdev -model evdev -layout us -variant altgr-intl


$ setxkbmap -model pc105 -layout us -variant altgr-intl

To configure a simple key for toggling between multiple configured keyboard layouts, see Option XkbOptions in Section InputClass somewhere within the xorg config file collection (see [SOLVED] Setxkbmap .xinitrc).