Page 1 of 1

How to change keyboard to US layout?

Posted: Tue Jul 17, 2012 5:12 am
by xmanmonk
I'm in the U.S. (sorry :) and I need to find a way to change the keyboard layout to a US 101-key keyboard. Anyone know where I can do that? I've looked around the lxde environment and can't seem to find it. Any help will be greatly appreciated. Thanks!

Re: How to change keyboard to US layout?

Posted: Tue Jul 17, 2012 6:18 am
by W. H. Heydt
Change to US k/b config...

Use this...

- Run 'sudo dpkg-reconfigure locales' and changing from en_GB.UTF-8 to en_US.UTF-8
(or whatever country setting you need).
- Run 'sudo dpkg-reconfigure keyboard-configuration' and change the keyboard to USA PC101
(again, change as needed).
- Reboot.

You make the changes by using cursor keys and hitting 'space' to select or deselect an entry.

Note that to get the keyboard-configuration to work, you have to be on the console. For the locale setting, you can do it from the console or from another machine using an ssh connection (e.g. PuTTY). By "console", I mean directly on the Pi without LXDE up, or in LXDE using the terminal program.

Re: How to change keyboard to US layout?

Posted: Tue Jul 17, 2012 2:11 pm
by xmanmonk
Thanks much. I'll give that a try today. I''ve only been connecting on the console. Haven't tried ssh-ing from my other box. I've done this sort of thing before on Ubuntu, Mint, etc., but never had to do it from the command-line. Thanks!

Re: How to change keyboard to US layout?

Posted: Tue Jul 17, 2012 5:00 pm
by xmanmonk
Worked perfectly (as long as one remembers to reboot after each step :) ) Thanks!

Re: How to change keyboard to US layout?

Posted: Fri Jul 20, 2012 4:45 pm
by jamesb0nd
I got it to work too, but make sure you are not in xwindows. You need to do this before you "startx". If you are already in the GUI logoff and then issue the commands.

Re: How to change keyboard to US layout?

Posted: Fri Jul 20, 2012 5:53 pm
by sherman
W. H. Heydt wrote:Change to US k/b config...

Use this...

- Run 'sudo dpkg-reconfigure locales' and changing from en_GB.UTF-8 to en_US.UTF-8
(or whatever country setting you need).
- Run 'sudo dpkg-reconfigure keyboard-configuration' and change the keyboard to USA PC101
(again, change as needed).
- Reboot.

You make the changes by using cursor keys and hitting 'space' to select or deselect an entry.

Note that to get the keyboard-configuration to work, you have to be on the console. For the locale setting, you can do it from the console or from another machine using an ssh connection (e.g. PuTTY). By "console", I mean directly on the Pi without LXDE up, or in LXDE using the terminal program.
This works perfectly. Just a couple comments though. After you run the first one, 'sudo dpkg-reconfigure locales', reboot the Pi. When you go to change the second one, 'sudo dpkg-reconfigure keyboard-configuration', select your keyboard model or the generic of that brand. On the next window, select 'English (US)' at the top of the list. Then select 'the default for the keyboard layout' in the next window. Select '<no composite key>' in the next window. Finally, in the last window select '<no>'. Reboot the Pi again. Those last two options may be different if you prefer - I am only explaining what I did so that I could type the correct double-quotation marks AND back-slashes while writing Python code. You can also do all of this from the terminal window.

Re: How to change keyboard to US layout?

Posted: Wed Sep 05, 2012 5:15 am
by dlbalt
> I got it to work too, but make sure you are not in xwindows.

I ran the commands from a terminal inside X, rebooted, and everything worked fine.

Thanks

Re: How to change keyboard to US layout?

Posted: Thu Jan 16, 2014 7:03 pm
by smokinCannon
This was helpful info for me that I didn't find anywhere else, thanks all.

Re: How to change keyboard to US layout?

Posted: Wed Jun 11, 2014 6:21 pm
by vcrewchief
Super. Thanks.

Re: How to change keyboard to US layout?

Posted: Fri Sep 26, 2014 9:07 pm
by mob-i-l
W. H. Heydt wrote:Change to US k/b config...

- Run 'sudo dpkg-reconfigure keyboard-configuration' and change the keyboard to USA PC101
(again, change as needed).

Note that to get the keyboard-configuration to work, you have to be on the console. For the locale setting, you can do it from the console or from another machine using an ssh connection (e.g. PuTTY). By "console", I mean directly on the Pi without LXDE up, or in LXDE using the terminal program.
Why can't you do this when you have no keyboard connected:

Code: Select all

sudo dpkg-reconfigure keyboard-configuration
over SSH? It would be practical to be able to reconfigure a keyboard I would like to use without connecting it. I would like to record a screen cast in Ubuntu without a USB-keyboard when I use raspi-config over SSH, but it doesn't work because of this. I've tried to follow dpkg-reconfigure to find out why it doesn't work, but it's a complicated Perl-program. I did find this documentation: /usr/share/doc/keyboard-configuration/README.Debian . And this Perl-file: /usr/share/console-setup/KeyboardNames.pl .

Re: How to change keyboard to US layout?

Posted: Fri Sep 26, 2014 9:18 pm
by DougieLawson
The keyboard layout for PuTTY with SSH is a function of PuTTY not a function of the remote machine you're connecting to.

raspi-config is just a simple shell script that calls dpkg-reconfigure keyboard-configuration then invoke-rc.d keyboard-setup start.

Re: How to change keyboard to US layout?

Posted: Sat Sep 27, 2014 7:57 am
by mob-i-l
DougieLawson wrote:The keyboard layout for PuTTY with SSH is a function of PuTTY not a function of the remote machine you're connecting to.

raspi-config is just a simple shell script that calls dpkg-reconfigure keyboard-configuration then invoke-rc.d keyboard-setup start.
I knew this, but I would like to hack dpkg-reconfigure keyboard-configuration so that it doesn't require a connected keyboard. Now, I workaround this by having a numeric keyboard connected. The purpose is to make better videos of using Raspi-Config without using a keyboard, but still configuring one that could be connected. Here is a video I made: http://youtu.be/oihYkX-8KEA

Re: How to change keyboard to US layout?

Posted: Sat Sep 27, 2014 8:54 am
by DougieLawson
I think you are way off track compared to the normal user. NOOBS expects that the new user will have a keyboard and mouse on first boot. It's not until you've completed the install and raspi-config that you'd get the network and sshd running and be able to go headless.

For what you're trying to do something like raspbian-ua-netinst may be more suitable.

Re: How to change keyboard to US layout?

Posted: Sun Sep 28, 2014 10:49 am
by mob-i-l
DougieLawson wrote:I think you are way off track compared to the normal user. NOOBS expects that the new user will have a keyboard and mouse on first boot. It's not until you've completed the install and raspi-config that you'd get the network and sshd running and be able to go headless.

For what you're trying to do something like raspbian-ua-netinst may be more suitable.
But I wanted to make a video for new users with wrong keyboard, without me as a youtuber needing a real keyboard. I don't see why one must have a keyboard connected in order to configure a keyboard that one wants to connect later. It would be good if the program to change the keyboard (Raspi-Config in this case) could detect the keyboard automatically, but that doesn't seem to be the case, and thus it is pointless to require a connected keyboard. Even if it could detect a keyboard-type it should not prevent users from overriding the setting or configure another keyboard that will be used later using a wrong keyboard. Since the keyboard configuration program (dpkg-reconfigure keyboard-configuration) seems to be written in Perl I could hack out the line that requires a keyboard, but I haven't been able to find it.

Thanks for the tip about raspbian-ua-netinst, but this will not help the users who borrow our Raspberry Pi:s since they need to be able to change the keyboard layout themselves.

Re: How to change keyboard to US layout?

Posted: Sun Sep 28, 2014 10:53 am
by DougieLawson
You can run raspi-config with ANY USB QWERTY keyboard. For the US folks there's only a few punctuation characters that move.

Set it to "Generic 104-key PC" and you won't have any troubles.

Re: How to change keyboard to US layout?

Posted: Sun Sep 28, 2014 11:20 am
by jojopi
mob-i-l wrote:Why can't you do this when you have no keyboard connected:
Since Debian runs on lots of different platforms, it may be that it wants to know whether you have a USB keyboard or one connected to a proprietary Apple or Sun or HP bus. Or it could just be so that "dpkg-reconfigure --all" does not ask unnecessary questions when run remotely on a headless server.

As I am sure you realise, your situation is unusual. Normally if you have no keyboard you have no need to set the keyboard layout.

Re: How to change keyboard to US layout?

Posted: Sun Sep 28, 2014 12:27 pm
by mob-i-l
DougieLawson wrote:You can run raspi-config with ANY USB QWERTY keyboard.
It works also with numeric keyboards, and also with the dongle of a wireless keyboard (I've not tried this last thing myself).

Re: How to change keyboard to US layout?

Posted: Fri Jan 05, 2018 9:57 pm
by cfillekes
US vs GB layouts often remap important keys like "|" (pipe), "~" (tilde) and "#" (hash)

If you're using some weird offbrand keyboard from out of the attic that is NOT listed in the keyboard-configuration list and heaven only knows what keyboard they thought they were emulating and the model number isn't even listed in the manufacturer's website anymore...but the whole thing works except for not giving you a "pipe" key (but TWO tildes!! yay?) -- try changing just the locale of the layout from gb to us with

sudo setxkbmap -layout us

Then you can at least pipe the results of things like apt list --installed through grep eg

apt list --installed | grep jdk