Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

In the last couple of days my locales have a serious issue. I normally am "en_GB.UTF-8". Suddenly when running apt, error messages are appearing saying

Traceback (most recent call last):
File "/usr/bin/apt-listchanges", line 33, in <module>
from ALChacks import *
File "/usr/share/apt-listchanges/ALChacks.py", line 32, in <module>
sys.stderr.write(_("Can't set locale; make sure $LC_* and $LANG are correct!\n"))
NameError: name '_' is not defined
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = "en_gb",
LC_MONETARY = "en_gb",
LC_NUMERIC = "en_gb",
LANG = "en_US.utf8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
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
Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale. at /usr/share/perl5/Debconf/FrontEnd    /Gnome.pm line 97, <> line 1.

Also if I try to run "gnome-control-center region" it either segfaults or the GUI appears, but if I try to set anything, it segfaults. Notice the "en_gb"s in the error message - a lower-case "GB" is illegal. Also I don't think en_US even exists as a locale on my system. When I login a dialog asks me if I want to rename directories as "my language has changed" - a bit disturbing. I think it started after an update, but I did try to install gnome-shell 3.2 from sid (because I mistakenly believed it would be easy to fulfil its dependencies, & wanted to use gnome extensions). I rolled it back, but could that have bent something out of shape? If so what should I reinstall?

Output of /usr/bin/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

Output of locale -a:

share|improve this question
What's the output of locale -a and locale? – user13742 Jan 3 '12 at 22:08

Locale definitions take up a lot of disk space (if you add up all the different locales that are available), so Debian and other distributions generate them upon request. On Debian, run dpkg-reconfigure locales (as root) and select the locales you are interested in. Make sure to check the box for en_US.utf8 (and other en_US variants while you're at it). Also, some categories are strangely declared as en_gb; search for the string en_gb in your configuration files (grep -r en_gb ~/.[!.]* /etc) and fix the offending file.

share|improve this answer
Yes, I've done this several times. I suspect some python mapping, where the locales are mapped to internal representations (I think) that are lower case. That was the only example of en_gb I could find. Unfortunately after reconfiguring locales, they look ok, but control centre still segfaults & on reboot everything is back the same again. My locale is en_GB by the way - I don't want or need en_US as its not my language. Until 3 days ago(ish) my locale was set to en_GB.UTF8 (& only that) & everything was fine – andywebsdale Jan 4 '12 at 10:23
@andywebsdale You have $LANG set to en_US.utf8. If you don't want that, you need to track down the setting (either at the system level, in /etc, or in your dot files) and remove it, or override it (e.g. with unset LANG in ~/.profile). – Gilles Jan 4 '12 at 11:17
I've been using Debian since Potato, & using the same locale. Nothing like this has ever happened to me before. – andywebsdale Jan 4 '12 at 21:09
(too late for edit) Tried grepping already, also just did your suggested grep - nothing came up(as expected). I think the problem is in some code, otherwise gnome-control-center wouldn't segfault, would it? – andywebsdale Jan 4 '12 at 21:16
@andywebsdale Something is setting LANG to en_US.utf8. Does it happen if you log in on a text console or over ssh? – Gilles Jan 4 '12 at 21:29

Finally found where the "en_gb" was coming from. Ran dconf (the new gconf2-style gnome config replacement. I should've checked these settings before :-). Under system->locale, lo! & behold! there it is. I altered it to "en_GB" & restarted the Gnome session. Now the output of /usr/bin/locale is exactly as expected, no lower-case locales & no spurious en_US ones either. Not sure how the dconf stting came to be miss-set. I certainly have no memory of doing it myself & can't think why I'd want to alter it either. "gnome-control-center region" works fine now also. No segfaulting, & all seems to work OK. Bit shabby that a non-existent locale causes it to fall over, surely it wouldn't be too hard to fail more gracefully & perhaps offer up an informative message. Thanks to Gilles for his helpful suggestions - he was right about the config aspect, I don't know how I missed it. Shall have to see how dconf data is actually stored.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.