bash: warning: setlocale: LC_ALL: cannot change locale (en_US)

Problem

Error I faced while sourcing my bashrc settings:
bash: warning: setlocale: LC_ALL: cannot change locale (en_US)

Theory

Locale is set of language/user input/keyboard characters specific to regions. For instance, "en_US" represents US english character set. It has to be set to correct value (en_US.UTF-8 or anything else, there are lots for different regions)for server to understand the character sequence keyboard input provides. "setlocale" enables the user to set the locale.

To read more on the theory of Locales, please divert here.

What eventually worked for me

These two commands:

sudo locale-gen en_US.UTF-8

sudo dpkg-reconfigure locales

The error "bash: warning: setlocale: LC_ALL: cannot change locale (en_US)" occurs when the remote server does not understand the locale "en_US.UTF-8". The fix is to generate the locale using the command "sudo locale-gen en_US.UTF-8" and update the locale repository to store this locale, such that future connections(ssh) can understand this locale. The command "sudo dpkg-reconfigure locales" updates the local repository with the newly generated locale, i.e en_US.UTF-8.

The /etc/default/locale file also needs to be updated to the latest locale and language setting:

sakshi@sakshi-laptop:~$ cat /etc/default/locale
#LANG="en_IN"(old locale)
#LANGUAGE="en_IN:en"(old setting)
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8


Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Oracle Blogs Admin-Oracle

Search

Categories
Archives
« March 2015
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    
       
Today