How To Fix Error “Locale: Cannot Set LC_ALL to default locale: No such file or directory”
Have you ever came across the error “locale: Cannot Set LC_ALL to default locale: No such file or directory” in Linux then this blog post is for you. Here we have the solution for the error “locale: Cannot Set LC_ALL to default locale: No such file or directory”.
How To Fix Error “Locale: Cannot Set LC_ALL to default locale: No such file or directory”
Locales are mainly used in Linux to define the language that the user can use. You will come across this error if you messed up while setting up the correct locale for the non-ASCII characters.
You can list all system’s currently installed locales with the following command
locale -a
You will see the output something like below:
LANG=en_US.UTF-8
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=
Let’s go to the process to fix the error:
At first, run the following command to export variable to LC_ALL
parameter
$ export LC_ALL="en_US.UTF-8"
Now, run the following command to enable the locales:
$ sudo locale-gen "en_US.UTF-8"
$ sudo dpkg-reconfigure locales
You can also enable the locales by editing the /etc/default/locale file. You need to set LANG
parameter as below
LANG=en_US.UTF-8
Now at the last, Make sure you have installed glibc-locale package on the system.