HostOnNet Blog

Ubuntu 14.04 OpenVZ locale: Cannot set LC_ALL to default locale: No such file or directory

On a OpenVZ Ubuntu 14.04 image, when i run locale, i get following error

root@dev1:~# locale
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
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_IN.UTF-8
LC_TIME=en_IN.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_IN.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_IN.UTF-8
LC_NAME=en_IN.UTF-8
LC_ADDRESS=en_IN.UTF-8
LC_TELEPHONE=en_IN.UTF-8
LC_MEASUREMENT=en_IN.UTF-8
LC_IDENTIFICATION=en_IN.UTF-8
LC_ALL=
root@dev1:~# 

This is fixed by editing /etc/environment

vi /etc/environment

Add

LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8

Now you need to log off and log in, so environment variable is set.

Now run

locale-gen en_US.UTF-8
dpkg-reconfigure locales

Posted in Ubuntu