My blog has moved!

You should be automatically redirected. If not, visit
http://benohead.com
and update your bookmarks.

Friday, April 27, 2012

Debian: change the keyboard layout from the console

I've installed a new test system to play around a little bit (a Debian Squeeze install). Since I was too lazy to install it from scratch and I'm using VMWare anyway, I thought I'd just download a pre-installed virtual machine.

Now this virtual machine had a US keyboard configured and I'm using a German keyboard. After googling for how to change the keyboard layout from the console, I found a few hints:

dpkg-reconfigure console-data

Unfortunately the package console-data is not installed on my system.

Then I found the following:

dpkg-reconfigure keyboard-configuration

This package is installed and you can choose a keyboard layout. Great !

After saving, I pressed "Z" and got a "Y" on the console. So still having a US keyboard configured.

Since keyboard-configuration modifies the file /etc/default/keyboard, I checked this file:

# cat /etc/default/keyboard
# Check /usr/share/doc/keyboard-configuration/README.Debian for
# documentation on what to do after having modified this file.
 
# The following variables describe your keyboard and can have the same
# values as the XkbModel, XkbLayout, XkbVariant and XkbOptions options
# in /etc/X11/xorg.conf.

XKBMODEL="pc105"
XKBLAYOUT="de"
XKBVARIANT="nodeadkeys"
XKBOPTIONS=""

# If you don't want to use the XKB layout on the console, you can
# specify an alternative keymap. Make sure it will be accessible
# before /usr is mounted.
# KMAP=/etc/console-setup/defkeymap.kmap.gz

Everything looks fine... But the hint in the beginning of the file might be pointing to the solution. So let's check this README.Debian file:

# cat /usr/share/doc/keyboard-configuration/README.Debian
After modifying /etc/default/keyboard, you can apply the changes to the linux console by running setupcon. If X is configured to use that file too, then the changes will become visible to X only if

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

There is the solution:

#setupcon

And the keyboard layout is German !!

No comments:

Post a Comment