HostOnNet Blog

locale: Cannot set LC_CTYPE to default locale: No such file or directory

Looking for Linux Server Admin or WordPress Expert? We can help.

When i login to a server, i get following error

-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

To verify en_US.UTF-8 is available on the system, run locale -a

root@testing:~# locale -a
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_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX
en_GB.utf8
root@testing:~#

On this server en_US.UTF-8 is not installed. To enable this, run

dpkg-reconfigure locales

You will get screen with all available locales, select the one you need to install, in this cause i selected en_US.UTF-8

On next screen, you will be asked to select default locale (language) for your system, select the one you want.

Now log off and re connect. You should not get any error. Verify locale with

root@testing:~# locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
root@testing:~# 

Posted in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.