Last Updated: February 25, 2016
·
5.687K
· kaiifalcutela

How did i fix my locale issues in Ubuntu

Im probably in the middle of setting out our prod environment in aws ec2 install through ssh. But evertime i do run an installation for a new version of ruby an error probably occurs telling

perl: warning: Setting locale failed.   
perl: warning: Please check that your locale settings:   
LANGUAGE = "en_US:en",   
LC_ALL = (unset),   
LC_MESSAGES = "en_US.UTF-8",   
LANG = "en_US.UTF-8"   
are supported and installed on your system.   
perl: warning: Falling back to the standard locale     ("C").   
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   
(Reading database ... 21173 files and directories currently installed.)  
Removing bind9 ...  
* Stopping domain name service... bind9                                                                                [ OK ]   
Processing triggers for man-db ...   
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  

What i specifically do to solve the problem and fix the error is

1.Check the list of locale i have to see what should i miss or have.

$ sudo locale

it would display list of locale settings

LANG=C
LANGUAGE= (unset)
LC_CTYPE=fi_FI.UTF-8
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE=fi_FI.UTF-8
LC_MONETARY="C"
LC_MESSAGES=fi_FI.UTF-8
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=(unset)

you will see some locales that havent set yet.

2.Generate missing locales

$ sudo locale-gen en_PH.UTF-8

this will output a result of

Generating locales...
fi_FI.UTF-8... done
Generation complete.

3.Lastly reconfig your locales with the generated missing locales you got.

$ sudo dpkg-reconfigure locales

Generating locales...
en_US.UTF-8... done
fi_FI.UTF-8... up-to-date
Generation complete.

After this errors occuring for locales problem is gone