Locale issue in Linux Mint

1

1

I have this problem with locale on my Linux Mint Debian (LMDE). How can I fix this?

cj@linux ~ $ 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=\(null\)
LANGUAGE=
LC_CTYPE="(null)"
LC_NUMERIC="(null)"
LC_TIME="(null)"
LC_COLLATE="(null)"
LC_MONETARY="(null)"
LC_MESSAGES="(null)"
LC_NAME="(null)"
LC_ADDRESS="(null)"
LC_TELEPHONE="(null)"
LC_MEASUREMENT="(null)"
LC_IDENTIFICATION="(null)"
LC_ALL=

Would this cause any problems for programs and applications ?

cjMec

Posted 2015-12-05T06:17:13.650

Reputation: 13

Answers

2

The export, locale-gen and dpkg-reconfigure method.

Depends on what “locale” you want set, but this works for me when clearing up similar issues on Ubuntu 12.04 which is Debian-based just like Linux Mint. In these examples I am using en_US.UTF-8 but be sure to change that to match your actual desired locale settings.

First, run the following export commands:

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

Then run locale-gen like this:

sudo locale-gen en_US.UTF-8

Then run dpkg-reconfigure locales like this:

sudo dpkg-reconfigure locales

Reboot your machine and it should all be cleared when it comes back online. Check the output of locale which should now be something like this:

LANG=en_US.UTF-8
LANGUAGE=
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=

The adding a LC_ALL value to /etc/environment method.

Another idea is that you can just set the global locale in this file:

/etc/environment

By using sudo and your favorite editor; I prefer to use nano but feel free to use whatever text editor you want to use:

sudo nano /etc/environment

And then just adding this value to the bottom of that file:

LC_ALL="en_US.UTF-8"

Reboot or logout and login again and that should work as well.

JakeGould

Posted 2015-12-05T06:17:13.650

Reputation: 38 217

after executing the export commands everything in locale becomes equal to "en_US.UTF-8" but once I reopen the terminal and check locale it's null values and the same persists after reboot – cjMec – 2015-12-05T08:15:01.290

@cjMec Those export commands are temporary. Look at my instructions and follow them. Do the export stuff first, then run that locale-gen command followed by the dpkg-reconfigure command. Also look at my suggestion to edit /etc/environment. But like I said, I’ve helped as best as I can. I cannot help you any more. I wish you the best of luck! – JakeGould – 2015-12-05T08:19:27.337

i tried changing /etc/environment and that worked after reboot. However I found that there was nothing inside the /etc/environment when i opened to change it as you said. Is that supposed to be so? – cjMec – 2015-12-05T08:29:11.020

@cjMec Some systems don't have that file set initially so you might have needed to create it to fix this issue. Happy this was solved. – JakeGould – 2015-12-05T08:45:56.907

:-/ Perhaps this is how it used to work. But now on Debian 9.6 locale-gen doesn't take a parameter. Instead it reads /etc/locale.gen to get it's list of locales to compile. You can look at this script yourself to confirm this. – Elliptical view – 2018-12-04T20:53:24.337