34

I'm trying to configure a Debian Linux (ARMHF 3.8.13-bone20) on a BeagleBone Black to use German as the default language and keyboard layout, which does not work, and I can't see why. I'm talking about the console settings, not X or Gnome etc. Here are my settings and what I did so far:

dpkg-reconfigure locales

Here I chose de_DE.UTF-8 UTF-8 and unselected en_US.UTF-8 UTF-8.

Output from locale:

LANG=de_DE.UTF-8
LANGUAGE=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

Content of /etc/default/locale:

LANG=de_DE.UTF-8
LANGUAGE=de_DE.UTF-8

Content of /etc/default/keyboard:

# KEYBOARD CONFIGURATION FILE
# Consult the keyboard(5) manual page.
XKBMODEL="pc105"
XKBLAYOUT="de"
XKBVARIANT="nodeadkeys"
XKBOPTIONS="terminate:ctrl_alt_bksp"
BACKSPACE="guess"

I ran setupcon after making these settings and it didn't change anything, the layout still was en_US.

After that, I ran

dpkg-reconfigure keyboard-configuration

and set German - no dead keys as keyboard layout. Still no change, neither at once nor after a reboot.

Next, I tried

dpkg-reconfigure console-data

Here I chose

Choose layout from entire list

and then

pc / quertz / German / Standard / latin1 - no dead keys

The output after that was:

Looking for keymap to install:
de-latin1-nodeadkeys
#

At this moment, the correct keyboard layout is present, but unfortunately things revert to the English (US) keyboard layout after reboot.

What can I do to permanently change the keyboard layout? As far as I can see the correct keymap must be present as it can get loaded, but only until the next reboot. What am I missing here?

Update: When connecting via SSH the German keymap gets loaded.

3
  • Hi, I've exact the same issues with my gnome installation. Are there some new information?
    – zzeroo
    Feb 26, 2014 at 8:48
  • 2
    This question is from 2 years and 9 months ago and it is still happening to me in July 2017. Has anyone actually solved this? It is annoying that I keep getting set back to the gb keyboard. Not that big a deal since for me that means the " and @ get reversed. I can live with that. Going in through the GUI fixes it until the next (very rare) power recycle as I back up the SD card. I echo the clue in the update: This only happens to the one RPi where I have a keyboard and monitor. It never happens when I use RDP. I don't see an accepted answer so I guess we're left to just deal with it.
    – SDsolar
    Jul 7, 2017 at 23:45
  • 1
    2020 and getting this only now.
    – RichieHH
    Nov 2, 2020 at 20:53

7 Answers 7

3

The combination of commands that worked for me were:

$ sudo dpkg-reconfigure keyboard-configuration
$ setupcon
$ sudo update-initramfs -u

And then reboot.

The last command rebuilds your GRUB boot settings. I don't know for sure if the keyboard layout is set in the boot image, but I noticed that the prompt for the full-disk encryption passphrase uses my system keyboard layout setting. At the point that prompt appears the keyboard settings couldn't be loaded from /etc because the root partition hasn't been decrypted yet. That led me to believe that there is probably a setting written into the boot partition, thus the motivation to run update-initramfs.

1
  • Ah, the update-initramfs -u finally made it stick after reboot!
    – some
    Feb 22 at 20:48
16

You might try to add the boot parameters of debian-installer/keymap=de and keymap=de.

Also, the answer at the thread Keyboard layout HELP says :

  1. Go to the webmin and do this SYSTEM -> SOFTWARE PACKADGES -> UPGRADE ALL

  2. (I don't recall if the order was this) Go to the console and do the following:

    apt-get install console-data
    apt-get install console-setup
    apt-get install console-locales
    apt-get install keyboard-configuration

  3. Do the dpkg-reconfigure for each of the packets above. REBOOT.

So maybe your problem is that you haven't done all of them before rebooting.

6
  • This didn't work for me (on Ubuntu 12.04), I have to run dpkg-reconfigure keyboard-configuration after every reboot.
    – Suzana
    May 21, 2015 at 14:05
  • On Raspbian I just had to install console-data and then selected pc/quertz/German/Standard/latin1 and everything works.
    – ASA
    Jun 10, 2015 at 21:07
  • 1
    does not work for me (debian stretch 9.1.0).
    – ribamar
    Feb 8, 2018 at 14:12
  • You misspelled "packages". Mar 27, 2018 at 22:25
  • 1
    @IkemKrueger: This is in the original quote, 8 years ago.
    – harrymc
    Mar 28, 2018 at 6:19
16

After dpkg-reconfigure keyboard-configuration, you need to run

setupcon
NAME
       setupcon - sets up the font and the keyboard on the console

SYNOPSIS
       setupcon [OPTION]... [VARIANT]

DESCRIPTION
       setupcon  is a program for fast and easy setup of the font and the key‐
       board on the console.  Most of the time  you  invoke  setupcon  without
       arguments.   The  keyboard configuration is specified in ~/.keyboard or
       /etc/default/keyboard.  The font configuration is specified in  ~/.con‐
       sole-setup or /etc/default/console-setup.  Consult keyboard(5) and con‐
       sole-setup(5) for instructions how to configure these two files.
4
  • 2
    Should be the accepted answer, simple and effective.
    – ryancey
    Sep 29, 2017 at 13:30
  • 4
    does not work for me (debian stretch 9.1.0).
    – ribamar
    Feb 8, 2018 at 14:03
  • Works on Debian 9.13
    – Alex
    Feb 20, 2021 at 16:01
  • use sudo may help - it doesn't give an error if it is required
    – Marwie
    Aug 2, 2022 at 13:12
9

On Stretch you'll need console-setup (in addition to keyboard-configuration), which includes the necessary systemd-service keyboard-setup:

apt-get install keyboard-configuration console-setup
1
  • I think this one is the most general/useful answer... console-setup is the key
    – matpop
    Mar 17, 2021 at 9:41
2
dpkg-reconfigure keyboard-configuration
udevadm trigger --subsystem-match=input --action=change
3
  • 6
    While these commands look like they might achieve something that the asker wants, it would be good to add a brief description of why they would do so.
    – Mokubai
    Mar 11, 2017 at 16:22
  • does not work for me (debian stretch 9.1.0).
    – ribamar
    Feb 8, 2018 at 14:04
  • This doesnt work long term if it's not already working. the udevadm just triggers the config change without a reboot.
    – RichieHH
    Nov 2, 2020 at 21:03
2

The solution for me was to comment out all the locale relevant variables at /etc/profile

#export LANG="de_DE.utf8"
#export LANGUAGE="de_DE.utf8"
#export LC_ALL="de_DE.utf8"

(I wanted to get rid off the German :))

and then set my locale as I wish within /etc/default/locale

The debian wiki page https://wiki.debian.org/Locale was the most helpfull document I found.

1
  • locale and keyboard layout are not one of the same.
    – RichieHH
    Nov 2, 2020 at 21:27
1

To change the german keyboard in Kali Linux 2020.02 (Debian) do the following:

  1. dpkg-reconfigure locales

    Choose de_DE.UTF-8 UTF-8 and unselect en_US.UTF-8 UTF-8 (by pressing Space)

  2. dpkg-reconfigure keyboard-configuration

    Choose your keyboard hardware

  3. For Kali Linux 2020.2 (Debian) goto GUI

    Settings/Settings Editor

    To Channel Keyboard-layout

    Under Line XkbLayout String change the value to de (delete us)

This permanently changes the layout to the german keyboard.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .