Ad Code

Fix: Raspberry Pi - perl: warning: Please check that your locale settings

perl: warning: Please check that your locale settings

My issue was solved by making sure the following content was in /etc/default/locale:

defgw@proto-pi ~ $ cat /etc/default/locale
#  File generated by update-locale
LANG=en_GB.UTF-8
LANGUAGE=en_GB:en
LC_ALL=en_GB.UTF-8

Problem

I recently installed a new Raspbian Scratch image on my protoboard, i.e. on a throwaway Raspberry Pi memory card for testing purposes.

Installing new packages came with an error like below:

$ sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = "en_US.UTF-8",
LC_CTYPE = "UTF-8",
LANG = "en_GB.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_GB.UTF-8").
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
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory

This is definitely not ideal, and googling for a solution came up with various instructions and most related to Ubuntu (maybe this is a more prevalent issue among Ubuntu community?). I did not find a good solution, so I decided to find out where these settings are located.

Fast forward here, a lot of searching, trial and error ensued…

Solution

The locales are configured in /etc/default/locale, and for some reason mine only had the following content:

#  File generated by update-locale
LANG=en_GB.UTF-8

Adding the lines in the error message and changing everything to en_GB.UTF-8 to be in line with the existing LANG setting (and then rebooting for good measure) removed the issue:

$ cat /etc/default/locale
#  File generated by update-locale
LANG=en_GB.UTF-8
LANGUAGE=en_GB:en
LC_ALL=en_GB.UTF-8

The problem is now solved and the error message is gone.

Feedback

If you know whether I have messed something up during Raspbian installation (raspi-config?) or perhaps this is default behaviour, please let me know in comments below. 

Post a Comment

0 Comments