Raspberry Pi 3b language constant setting

After logging in to the Raspberry Pi with ssh and using apt-get to install some commonly used software, it is strange to find that there is such a warning every time:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "zh_CN.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").

 

Research found that this is because the raspberry pi's ssh server is enabled to accept client language constants: i.e. in /etc/ssh/sshd_config

AcceptEnv LANG LC_*

The system cannot recognize the relevant locale. After checking, it is found that this is zh_CN.UTF-8. The output warning can be reproduced using the command

perl -e exit

 

The solution is to disable AcceptEnv or install the corresponding locale.

The latter is used here:

sudo vi /etc/locale.gen

 Then comment out the line where zh_CN UTF-8 is located

Rerun the following command to automatically install locale:

sudo locale.gen

After this the warning disappears.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325049032&siteId=291194637