Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This self-answered question solves the following issues:

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

and some other locale related problems.

EDIT: Restricting this to my own answer only seems, in retrospect, rather inefficient. Please feel free to add your 2cents. Or as many as you can spare....

share|improve this question
up vote 9 down vote accepted

We are working completely in the shell (bash).

The first thing everyone should do is

sudo dpkg-reconfigure locales

The output may be the errors mentioned above and a list of locales that the script generates. Note that the locales generated there are the only ones valid for your system. As you can see the language settings are just a bunch of environment variables. You can, just for fun, try a different language bash like this:

LANG=es_NI.UTF-8 bash
ls somedirectorynamethatdoesnotexistonyoursystem

Tu hablas espaniol? :-) (if the es_NI.UTF-8 was not in your list of locales just choose another)

Ok. Obviously the LANG environment variable helps with the rest of the settings, because, in our spanish bash we can now do

dpkg-reconfigure locales

or whatever command whose error messages led you here, and there should be no errors. If there are, then there's something more sinister wrong that will not be covered by this post.

So, where do we set this variable LANG? A quick search through the /etc/ directory (with rgrep LANG /etc/*) leads us to the file /etc/default/locale. There you can set the value of the variable to something different/correct. For example


(That one should always work) To finish this: The variables mentioned in the error messages, all "derive" from LANG, meaning that they default to whatever LANG is set to, but you can set them to your liking if you want your shell to speak a different language. The package language-env helps with this.

sudo apt-get install language-env

The script is meant to automatically creates entries for your .bashrc etc.

I haven't tried it myself.

I hope this helps someone.


  1. you can find the generated locales under ls usr/share/locale
share|improve this answer

Short answer:

Run dpkg-reconfigure locales as root.

(While in the dialog press Enter until you find your language, see its number, press Enter again, until you are asked for the number. Enter the number of you language, Enter, done. If you don't know better, take the UTF8-Version of you language)


share|improve this answer

I have tried many many solutions and none of them worked for me on Debian 7.

So, I added export LC_ALL=en_US.UTF-8 to /etc/default/locale and the warnings have gone.

share|improve this answer
You should edit /etc/default/locale instead. – Sep 21 '13 at 20:04
Thanks, I edited. – sekrett Jan 9 '15 at 14:34

I was using German VPS and couldn't change locale because there was no English language pack installed.

After installing I could finally change locale

aptitude install language-pack-en
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .