0

I have been trying hard to set my locale on my Raspberry Pi4 with Raspian 10 buster with these steps:

sudo locale-gen en_US.UTF-8 UTF-8

export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LC_TIME=en_US.UTF-8
export LC_MONETARY=en_US.UTF-8
export LC_ADDRESS=en_US.UTF-8
export LC_TELEPHONE=en_US.UTF-8
export LC_NAME=en_US.UTF-8
export LC_MEASUREMENT=en_US.UTF-8
export LC_IDENTIFICATION=en_US.UTF-8
export LC_NUMERIC=en_US.UTF-8
export LC_PAPER=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8

sudo nano /etc/locale.gen

(uncommented en_US.UTF-8 UTF-8)

sudo update-locale en_US.UTF-8 UTF-8

it does show the correct settings if I check with

locale

but as soon as I reboot, everything is reset to

LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

How can I fix this, please?

also tried:

L='us' && sudo sed -i 's/XKBLAYOUT=\"\w*"/XKBLAYOUT=\"'$L'\"/g' /etc/default/keyboard

and

sudo nano ~/.bashrc
setxkbmap us

and

loadkeys us

and

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

but as soon as I reboot, everything is reset again.

1

Your problem is unclear. It could be as simple as file permissions.

You should not attempt to set locale manually (I used to do this on other Linux platforms so it SHOULD be possible).

There are tools in raspi-config which should make sure that the correct changes are applied, although these have had known problems (see https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=286940).
In my case these stubbornly set locale to en_US.UTF-8, which I only managed to fix by manually editing /etc/default/locale

You can re-run the initial Pi GUI setup tool with sudo piwiz

PS I just looked at my /etc/default/locale and noticed that YET AGAIN it was incorrect - presumably some of the updates since have affected it. I again corrected by manually editing. (The missing ".UTF-8" only caused problems over ssh.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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