I have several Rpi3Bs and for the most part they work well.

But one of them insists on changing the USB keyboard type to the UK keyboard.

I fix it after a reboot by going into Menu..Preferences..Keyboard..Keyboard and Mouse..Keyboard Layout

It would me nice if I could figure out where this setting is stored and mark the file read-only or something. The one thing I have figured out is that it is not set in /boot/config.txt

In Raspi-config, localization is set for both gb and en_US - not sure why.

So the question is in the title: How can I force Raspbian stay set to the US keyboard?

  • 2
    I would have hoped that would have worked. Have a look at superuser.com/questions/646425/…
    – joan
    Apr 20, 2017 at 14:54
  • 1
    I found that in /etc/default/keyboard it was set to "gb" so I changed it to "en_US" and it survived a reboot. ..so I did a sudo chmod -w keyboard. Thank you for the tip, @joan
    – SDsolar
    Apr 20, 2017 at 15:06
  • This isn't daily but keeps happening. Clue: It is the only Pi where I have an actual keyboard and screen on it. In /etc/default/keyboard it is back to XBLAYOUT=gb" - perhaps I should simply make the file read-only once it is fixed.
    – SDsolar
    Jul 7, 2017 at 22:56

2 Answers 2


Maybe this can be solved with

Persistent configuration

A persistent keymap can be set in /etc/vconsole.conf which is read by systemd on start-up.

  • The KEYMAPvariable is used for specifying the keymap. If the variable is empty or not set, the uk keymap is used as default value.

    • For example: /etc/vconsole.conf KEYMAP=uk ...
    • For convenience, localectl may be used to set console keymap. It will change the KEYMAP variable in /etc/vconsole.conf  $ localectl set-keymap --no- convert keymap

    • The --no-convert option can be used to prevent localectl from automatically changing the Xorg keymap to the nearest match. See man localectl for more information.

  • That file does not exist on my system. There is no /etc/vcon* of any kind.
    – SDsolar
    Apr 20, 2017 at 19:31
  • You might cat /boot/os_config.json and verify "keyboard" is set correctly.
    – bstipe
    May 24, 2017 at 2:37
  • And now it has happened again. This time it was just a restart. Switching the @ and " signs aren't that big of a problem, but the tilde turns into a weird sideways half-bracket. This is getting old. I can go into Preferences, Keyboard & Mouse, Keyboard, Keyboard layout, then set it back. /boot/os_config.json has it set to gb. So I change it to us and reboot, only to find it set back to gb. -- I even did sudo chmod a-w os_config.json
    – SDsolar
    Aug 3, 2017 at 20:42

After setting the keyboard layout in

Mouse and Keyboard Settings
Keyboard tab
Keyboard Layout
Pick United States on the left,
then English (US) on the right.

The keyboard is set properly.

Then the rest of the locale stuff is set by using this:

sudo raspi-config
Localization options

...is the same as running

sudo dpkg-reconfigure locales

As per this article:

“Americanizing” the Raspberry Pi

Make sure the gb localization is unchecked.

Set the locale to be en_US.UTF-8 like so:

en_US.UTF-8 UTF-8
Spacebar to mark it with an asterisk
tab to OK then press Enter

It will give you a confirmation page.

Make sure you look at it and that you are selected to en_US.UTF-8

Once set, tab to OK and press enter.

After doing this, it will be set to persist through restarts.

One nice side-effect is that the date format will be mm/dd/yy

  • The “Americanizing” the Raspberry Pi - link is dead :-(
    – mvermand
    Jan 15, 2019 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.