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?

aayu5h
  • 381
  • 1
  • 3
  • 3
  • 2
    Have you used raspi-config to setup International options? – Milliways Mar 04 '16 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 '16 at 17:39
  • This worked for me... http://daker.me/2014/10/how-to-fix-perl-warning-setting-locale-failed-in-raspbian.html Good luck!!! – Mirthless Feb 12 '18 at 09:13

4 Answers4

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
arne.z
  • 113
  • 8
beepscore
  • 441
  • 4
  • 3
14

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.

Pikamander2
  • 349
  • 3
  • 9
  • 1
    This is what worked for me after creating images using rpi-imager. The original Noobs created image was ok. – Clifford Aug 13 '23 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 !!!

Abdul Basit
  • 211
  • 1
  • 4
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.

dalearn
  • 109
  • 6