Home Fix Locale warning when ssh in to server
Post
Cancel

Fix Locale warning when ssh in to server

When we ssh in to the VPS server or other linux system, some times our local machine language do not match target server language, and we get warning some thing like below, it is very common warning that very bothering. Here is how to fix it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
locale: Cannot set LC_ALL to default locale: No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_TIME = "es_ES.UTF-8",
	LC_MONETARY = "es_ES.UTF-8",
	LC_ADDRESS = "es_ES.UTF-8",
	LC_TELEPHONE = "es_ES.UTF-8",
	LC_NAME = "es_ES.UTF-8",
	LC_MEASUREMENT = "es_ES.UTF-8",
	LC_IDENTIFICATION = "es_ES.UTF-8",
	LC_NUMERIC = "es_ES.UTF-8",
	LC_PAPER = "es_ES.UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
  1. First run following command to regenerate locale on server:
    1
    2
    
    sudo locale-gen en_US.UTF-8
    sudo update-locale
    
  2. Set the Default Locale
    1
    
    sudo update-locale LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8
    
  3. Also configure the /etc/default/locale
    1
    
    sudo vim /etc/default/locale
    

    add these lines, if there already have xxx.UTF-8 change it all to en_US.UTF-8

    1
    2
    3
    
    LANG=en_US.UTF-8
    LANGUAGE=en_US.UTF-8
    LC_ALL=en_US.UTF-8
    
  4. Finally reboot the system
    1
    
    sudo reboot
    

Hopefully after reboot that ugly warning will disapear.

This post is licensed under CC BY 4.0 by the author.