How do I change the keyboard layout?

Help with Raspberry Pi Foundation Boards (Raspberry Pi, Pi Zero, Pi Zero W, Pi A, Pi B, Pi B+, Pi2 B, Pi3 B, Pi 3 B+)
Post Reply
WB2KWC
Posts: 18
Joined: Sun Apr 15, 2018 2:15 am
Location: Massapequa, NY

How do I change the keyboard layout?

Post by WB2KWC »

I have plugged a USB keyboard into my Raspberry Pi running Pi-Star and the keyboard layout is not correct. When I hit the @ key (shift 2) I get a ". When I hit the " key I get a @. Normally on Raspian I would use the sudo raspi-config command to configure the keyboard but I get an error message telling me that the raspi-config command was not found.

Ken WB2KWC
AF6VN
Posts: 821
Joined: Fri Jul 20, 2018 1:15 am

Re: How do I change the keyboard layout?

Post by AF6VN »

Going by post dates, one of the more recent suggestions would seem to be

https://www.linuxquestions.org/question ... an-285750/

You do have me wondering now -- I'm tempted to connect my Logitech "unifying" keyboard/mouse and an HDMI cable to see how it interprets them? Coming in via SSH seems to mean my Win10 keymap is in control (and my other R-Pi's have all gone through the graphical configuration system).

Getting an official response might be nice (maybe a new "standard" script like the ones for updating?) (Actually, I'd like some information on changing the color scheme of the console as seen by PuTTY -- dark blue text on black is just impossible... Strike that, think I found the main culprit: /etc/bash.bashrc)

--
AF6VN
Dennis L Bieber
WB2KWC
Posts: 18
Joined: Sun Apr 15, 2018 2:15 am
Location: Massapequa, NY

Re: How do I change the keyboard layout?

Post by WB2KWC »

That told how to do it in the KDE control panel but Pi-Star has removed the graphical environment so unfortunately that is not applicable :(
AF6VN
Posts: 821
Joined: Fri Jul 20, 2018 1:15 am

Re: How do I change the keyboard layout?

Post by AF6VN »

And here I thought I'd skipped over the Google entries for graphical environments.

https://manpages.debian.org/stretch/key ... .5.en.html claims to apply to console and X.

Just checked, and pi-star was set for "gb" -- I've edited mine now to "us" and rebooted. Hopefully that is not one of the files that it refreshes overnight <G>.

--
AF6VN
Dennis L Bieber
WB2KWC
Posts: 18
Joined: Sun Apr 15, 2018 2:15 am
Location: Massapequa, NY

Re: How do I change the keyboard layout?

Post by WB2KWC »

Thank you Dennis, that was the solution. For anyone elso experiencing the problem here are the steps to fix it:

1 - Make the SD card writeable with the rpi-rw command
2 - Edit the /etc/default/keyboard with the sudo vi /etc/default/keyboard command
3 - change XKBLAYOUT="gb" to XKBLAYOUT="us"
4 - save the file with the :wq! command
5 - restore the SD card to read-only status with the rpi-ro command
6 - reboot the Raspberry Pi from the web interface
AF6VN
Posts: 821
Joined: Fri Jul 20, 2018 1:15 am

Re: How do I change the keyboard layout?

Post by AF6VN »

Heh -- I usually install "vim"... and use ZZ for save/exit.

However -- nice to see I'm not the only masochist. So many guides invoke "nano" or something like it.

--
AF6VN
Dennis L Bieber
Post Reply