Raspberry Pi 3, Set Locale

Localisation

Problem of Can’t set locale; make sure $LC_* and $LANG are correct!

$ sudo apt-get install tree
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  tree
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 41.4 kB of archives.
After this operation, 93.2 kB of additional disk space will be used.
Get:1 http://mirrordirector.raspbian.org/raspbian stretch/main armhf tree armhf 1.7.0-5 [41.4 kB]
Fetched 41.4 kB in 0s (208 kB/s)
apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct!
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_TIME = "de_CH.UTF-8",
	LC_MONETARY = "de_CH.UTF-8",
	LC_ADDRESS = "de_CH.UTF-8",
	LC_TELEPHONE = "de_CH.UTF-8",
	LC_NAME = "de_CH.UTF-8",
	LC_MEASUREMENT = "de_CH.UTF-8",
	LC_IDENTIFICATION = "de_CH.UTF-8",
	LC_NUMERIC = "de_CH.UTF-8",
	LC_PAPER = "de_CH.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_ALL to default locale: No such file or directory
Selecting previously unselected package tree.
(Reading database ... 34443 files and directories currently installed.)
Preparing to unpack .../tree_1.7.0-5_armhf.deb ...
Unpacking tree (1.7.0-5) ...
Setting up tree (1.7.0-5) ...
Processing triggers for man-db (2.7.6.1-2) ...


$ export
declare -x LANG="en_GB.UTF-8"
declare -x LC_ADDRESS="de_CH.UTF-8"
declare -x LC_IDENTIFICATION="de_CH.UTF-8"
declare -x LC_MEASUREMENT="de_CH.UTF-8"
declare -x LC_MONETARY="de_CH.UTF-8"
declare -x LC_NAME="de_CH.UTF-8"
declare -x LC_NUMERIC="de_CH.UTF-8"
declare -x LC_PAPER="de_CH.UTF-8"
declare -x LC_TELEPHONE="de_CH.UTF-8"
declare -x LC_TIME="de_CH.UTF-8"

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

$ locale -a
C
C.UTF-8
en_GB.utf8
es_US.utf8
POSIX

$ perl -e exit
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_MEASUREMENT = "de_CH.UTF-8",
	LC_PAPER = "de_CH.UTF-8",
	LC_MONETARY = "de_CH.UTF-8",
	LC_NAME = "de_CH.UTF-8",
	LC_ADDRESS = "de_CH.UTF-8",
	LC_NUMERIC = "de_CH.UTF-8",
	LC_TELEPHONE = "de_CH.UTF-8",
	LC_IDENTIFICATION = "de_CH.UTF-8",
	LC_TIME = "de_CH.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").


$ sudo sh -c "cat << EOF  > /etc/default/locale
# /etc/default/locale
LANG=ar_EG.UTF-8
LANGUAGE=ar_EG.UTF-8
LC_ALL=ar_EG.UTF-8
EOF";

In /etc/ssh/ssh_config:
SendEnv LANG LC_*

In /etc/ssh/sshd_config:
AcceptEnv LANG LC_*
$ sudo dpkg-reconfigure locales
or
$ sudo vim /etc/locale.gen
uncomment:
en_US.UTF-8 UTF-8
$ sudo locale-gen
$ sudo nano /etc/profile
add:
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

Leave a Reply

Your email address will not be published. Required fields are marked *