28

When I boot pi it it throws the following warnings:

-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
->bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

When I do

>locale
 locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

I changed the contents of /etc/default/locale to the following

# File generated by update-locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=en_US.UTF-8

I tried to reconfigure locale using

sudo dpkg-reconfigure locales

But every time the menu opens, with no selection made. I have to select

en_US.UTF-8 UTF-8

every time.And selecting this throws the error

Generating locales (this might take a while)...
Generation complete.
*** update-locale: Error: invalid locale settings: LANG=en_GB.UTF-8 LANGUAGE="en_US.UTF-8" LC_ALL="en_US.UTF-8"

How do I remove these warnings?

3
  • 1
    Have you used raspi-config to setup International options?
    – Milliways
    Mar 4, 2016 at 10:51
  • 1
    yes I did that but to no avail. I had wheezy when this problem was there. Now I have installed Jessie, still this persists. I don't know how after formatting the card and installing a new os this problem can still be there.
    – aayu5h
    Mar 14, 2016 at 17:39
  • This worked for me... daker.me/2014/10/… Good luck!!!
    – Mirthless
    Feb 12, 2018 at 9:13

4 Answers 4

34

This blog post helped me: Raspberry Pi -- Fixing your Locale http://www.jaredwolff.com/blog/raspberry-pi-setting-your-locale

  • Edit /etc/locale.gen and uncomment the line with en_US.UTF-8 e.g. sudo nano /etc/locale.gen
    uncomment line by deleting leading #

  • Run sudo locale-gen en_US.UTF-8

  • Run sudo update-locale en_US.UTF-8
3
  • 2
    This worked for me
    – kartsims
    Jan 25, 2017 at 7:38
  • This worked for me also
    – timbram
    Apr 15, 2018 at 19:11
  • Thank you, This works still as of November 2019.
    – Agustin
    Nov 14, 2019 at 3:18
12

The other answers weren't working for me but I found one that did.

Run sudo nano /etc/default/locale

Change it to include these three lines:

LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
LANGUAGE=en_US.UTF-8

Then reboot the system and it should be updated.

1
  • This is what worked for me after creating images using rpi-imager. The original Noobs created image was ok.
    – Clifford
    Aug 13 at 17:59
1

Edit your /etc/locale.gen then uncomment the following line:

en_GB.UTF-8 UTF-8

Run:

sudo locale-gen en_GB.UTF-8 UTF-8
sudo update-locale en_GB.UTF-8 UTF-8
export LANGUAGE=en_GB.UTF-8
export LC_ALL=en_GB.UTF-8

Verify it;

locale

You may get:

LANG=en_GB.UTF-8
LANGUAGE=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=en_GB.UTF-8

And Done !!!

0

Since you flashed a new image and it continues to not work, it sounds like you might have a hardware issue. Do you have another raspberry pi to try it on? If you do and you get the same error, make sure you are downloading the right image or try noobs to make sure. If you do not have another raspberry pi, I recommend running sudo update-locale en_US.UTF-8 and seeing if that fixes the issue.

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