Raspbian keyboard layout

  • I want to set my keyboard settings to Swedish, but on the Raspbian configuration tool my keyboard is not on the list.

    Update: Changing XKBLAYOUT to "se" doesn't work. And internationalization in raspi-config doesn't either. My keyboard is a Logitech Wireless Touch Keyboard K400r, if that might help.

    Isn't the language code for swedish "sw"? I seriously consider trying that.

  • syb0rg

    syb0rg Correct answer

    7 years ago

    Take a look at the Raspberry Pi wiki on re-mapping the keyboard with Debian Squeeze:

    Re-mapping the keyboard with Debian Squeeze

    If different letters appear on-screen from that which you typed, you need to reconfigure you keyboard settings. In Debian, from a command line type:

    sudo dpkg-reconfigure keyboard-configuration

    Follow the prompts. To apply the changes type:

    sudo setupcon

    From the command line type:

    sudo nano /etc/default/keyboard

    Then find where it says


    and change the gb to the two letter code for your country.

    Here is the list of current country codes from Wikipedia if you don't know your country code (use the codes in the column labeled alpha-2).

    Another way you can try switching the keyboard layout:

    $ setxkbmap de
    $ setxkbmap fr
    $ setxkbmap us

    none of these worked, any idea why? 'sudo: dkpg-reconfigure: command not found' and changing the keyboard defaults to 'se' did nothing even tho I saved before quiting.

    Did you restart after saving that file?

    @hustlerinc I'm not sure why `sudo dpkg-reconfigure keyboard-configuration` isn't working for you. Are you working from a fully updated vanilla Raspbian OS?

    Yeah, haven't really done much at all since writing the img, and I always do update > upgrade before trying to install new packages to make sure I have the latest updates. But pretty much everything has gone wrong like bad SD card that wont boot NOOBS, wifi dongle with broken drivers and the keyboard issues. It's a good learning experience though.

    @hustlerinc Have you run `sudo rpi-update` since you wrote the image?

    I can't remember ever doing it, did it now and then tried your solution again. 'sudo dkpg-reconfigure keyboard-configuration' says 'dkpg-reconfigure: command not found', trying to install it says I already have the newest version. Really strange, but the problem might be there? Is it necessary for keyboard layout to work?

    @hustlerinc It would be a point of concern for me, and a place to start fixing this problem.

    @hustlerinc I've posted another way to change the keyboard layout, could you try it out?

    I F*****G LOVE YOU! Well deserved bounty, how did you find this solution?

    @hustlerinc on this wiki. I was doing some research into the problem running that command, and I came across that page. Scrolling down to the bottom, I found the solution.

    Was that menat for X or console mapping?

    @ppumkin I'm not really sure. If you look at the section name **How to switch a keyboard layout in X11 / graphical desktop environment** it tells you to use your favorite desktop keyboard layout switcher applet. It then goes on to say "You can also switch the layout from the terminal..."

    @syb0rg This setting resets on reboot, is there a command to save it so it's permanent? Tried google but no success.

    Take a look at my answer for running a script on startup.

  • Here is one thing to try out:

    Edit /etc/default/keyboard with your favorite editor (vim, nano,). Remember to use sudo:

    sudo nano /etc/default/keyboard

    Make the file look like this:

    # Consult the keyboard(5) manual page.

    Save the file, then reboot.

    This didn't work either. =(

    Exactly, what does not work? You do not get @ when pressing ALTGR+2? Or doesn't Ö show up in the terminal?

    It's not about the special characters, I know they have no place in terminal. The problem is your first example, always having to google "US keyboard layout" and have an image open to find the brackets, semi colon etc is starting to piss me off. :P

    Do you have these to packages installed? `keyboard-configuration` and `kbd` (Use `dpkg -l` to check)

    No it wasn't installed, atleast when trying dkpg -l, but apt-get install keyboard-configuration says "keyboard-configuration is already the newest version", same with kbd, but syb0rgs answer didn't work for some reason, says it's not installed. :S

  • sudo vim /etc/default/keyboard


    Didn't work the only thing added though was ctrl:swapcaps. The problem seems to be it doesn't recognize "se".

    @hustlerinc You did both? Well it should work. Did you try at the initial configuration as well?

    Yeah, the "se" part was allready there. By initial configuration do you mean raspi-config? If so yeah, hundreds of times but my exact keyboard is not there, so I tried with a few other models by the same manufacturer.

    @hustlerinc Yeah I meant raspi-config... :S Sorry I couldn't be a help Goodluck man I dont think theres much I can do for you

    np, you get some bonus reputation for the effort.

  • My solution was to run "dpkg-reconfigure console-data" as root and select "select keymap from full list" from the appearing dialog window. No reboot needed.

    # Consult the keyboard(5) manual page. 
  • It seems to have something to do with that speciffic keyboard (Logitech K400). I ran into the same problem when trying to use the Danish layout.

    Everything seemed to be configured correctly, but the actual layout was still US. When I switched to another keyboard, the layout was Danish, without any further modifications...

  • I have an emulation of Raspbian in a Sony Vaio VGN-FW-11E in Spanish language.

    I could solve the problem by runing in command prompt sudo raspi-config and then going to Advanced Setup and then "Update" (this tool to the latest version). This connects your computer to a raspberry pi server and download the latest version of the config tool, which assures that you have the most updated options and languages.

    Then I could choose the language of my keyboard which is Spanish and everything went fine!

  • I suppose the problem disapears when you use a wired keyboard.

    If it is the case, it seems linked to this bug: https://bugs.freedesktop.org/show_bug.cgi?id=39460

    You have got the beginnings of a great answer, just include some specifics on the bug and you'll be there!

  • Gents, the best way if you want several keyboard layout available is to right click on your top panel icon (the hour for example) then go to : 'Add/Remove Panel Items' then go to : 'Panel Aplets' tab then 'Add' then select : 'Keyoard layout handler' then it will appear as an icon in your panel (it can be a flag or keyboard or country code). Right click on the keyboard icon go to 'kyboard layout settings' and then un-check the box 'system settings' and then add as many keyboard layout you want! Enjoy.

  • This issue is related to the logitech unifying receiver. See my answer given here

    Could you please include the information in the link in your answer?

    Welcome to Raspberry Pi! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Please take the tour and visit the helpcenter to see how things work here.

    We're trying a new policy with regard to informationless link-only answers here. If this post is not edited to contain information that can stand as an answer, however minimal, in 48 hours it will be converted to Community Wiki to simplify having it corrected by the community.

    This answer did it for me. Indeed, I'm also using a logitech K400 keyboard

License under CC-BY-SA with attribution

Content dated before 6/26/2020 9:53 AM