"setting locale failed" if using other keyboard layout than language

Bug #229699 reported by Daniel Kulesz on 2008-05-12
46
This bug affects 8 people
Affects Status Importance Assigned to Milestone
debian-installer (Ubuntu)
Undecided
Unassigned
Nominated for Jaunty by Mikael Frykholm

Bug Description

I am experiencing this problem since the very early days I began using Ubuntu (4.10), and it's still there in 8.04. I get the following messages on a clean, fresh installation when running i.e. perl-version:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_CTYPE = "de_DE@euro",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

The problem only happens if you choose a different keyboard layout than the language. In my case, I want to have everything in English but I am using a german keyboard layout. I guess this problem is related to the installer, since it does not generate the correct locales.

Here is some output from just running "locale":

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE=de_DE@euro
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=

And here's the output from "locale -a":

locale: Cannot set LC_CTYPE to default locale: No such file or directory
C
en_US.utf8
POSIX

As you can see, the de_DE@euro locale simply did not get generated. Seems like other people (http://forums.vpslink.com/showthread.php?t=286, http://ubuntuforums.org/showthread.php?t=159177) experienced this problem as well. The solution here is simply to generate this missing locale:

locale-gen de_DE@euro

But actually the "normal human being" would be happy if the installer would have done this for him/her already.

Daniel Kulesz (kuleszdl) wrote :

Sorry I forgot to mention that the installation was done using the text-based installer, not the graphical one. The server-edition is affected as well.

 Thank you for taking the time to report this bug and helping to make Ubuntu better. You reported this bug a while ago and there hasn't been any activity in it recently. We were wondering if this is still an issue for you. Can you try with the latest Ubuntu release? Thanks in advance.

Changed in debian-installer:
status: New → Incomplete
Colin Watson (cjwatson) wrote :

It's really rather bizarre that de_DE@euro was selected at all. We should never be selecting this locale by default.

It's even more bizarre that the keyboard layout has anything to do with locales at all. I would only ever expect a default keyboard layout to be selected based on the locale you select; keyboard layout selection should *never* influence locale selection.

The forums threads you link to don't appear to be the same issue. Although they talk about locales, they're not about an unsupported LC_CTYPE.

Is it possible that there is anything else non-default that you're doing? Are you using expert mode or anything? The more you can walk me through what I'd need to do, the more chance I have of fixing this; at the moment I'm entirely stumped since none of the components responsible for locale selection or keyboard layout in the installer touch LC_CTYPE at all.

Changed in debian-installer:
assignee: ubuntu-installer → nobody
Daniel Kulesz (kuleszdl) wrote :

Actually there is noting else I am doing special, except selecting English as default language and German as Keyboard Layout. It was just a suspicion that could have something do to with it, maybe there is a completely different reason responsible for this. All that I've seen is that this bug does not happen if I select both English language/keyboard or both German language/keyboard.
I encountered this bug also in one of my more recent 8.10 installations. One difference here is that "locale -a" is showing more extensive output:

locale: Cannot set LC_CTYPE to default locale: No such file or directory
C
POSIX
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_NG
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZW.utf8

Mikael Frykholm (mikael) wrote :

This has been around since forever. I fix this on every server I install. Note the uppercase UTF instead of lowecase as the locale output reports.

sudo locale-gen sv_SE.UTF-8
Generating locales...
  sv_SE.UTF-8... done
Generation complete.

Steps to reproduce:
1. install ubuntu server, any recent version
2. select english for everything except keyboard layout
3. install a package on the commandline and watch perl complain like this:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = (unset),
 LC_ALL = "",
 LC_TIME = "sv_SE.utf-8",
 LC_CTYPE = "en_US.utf-8",
 LC_MONETARY = "sv_SE.utf-8",
 LC_COLLATE = "en_US.utf-8",
 LC_ADDRESS = "sv_SE.utf-8",
 LC_TELEPHONE = "sv_SE.utf-8",
 LC_MESSAGES = "en_US.utf-8",
 LC_NAME = "sv_SE.utf-8",
 LC_MEASUREMENT = "sv_SE.utf-8",
 LC_IDENTIFICATION = "en_US.utf-8",
 LC_NUMERIC = "sv_SE.utf-8",
 LC_PAPER = "sv_SE.utf-8",
 LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

My guess is that the installer forgets to create the locale.

Feb 9 16:51:18 localechooser: Generating locales...
Feb 9 16:51:18 localechooser: en_US.UTF-8...
Feb 9 16:51:20 localechooser: done
Feb 9 16:51:20 localechooser: Generation complete.
Feb 9 16:51:20 localechooser: Generating locales...
Feb 9 16:51:20 localechooser: en_US.UTF-8...
Feb 9 16:51:20 localechooser: up-to-date
Feb 9 16:51:20 localechooser: Generation complete.
Feb 9 16:51:20 preseed: perl: warning: Setting locale failed.
Feb 9 16:51:20 preseed: perl: warning: Please check that your locale settings:
Feb 9 16:51:20 preseed: LANGUAGE = (unset),
Feb 9 16:51:20 preseed: LC_ALL = (unset),
Feb 9 16:51:20 preseed: LANG = "C.UTF-8"
Feb 9 16:51:20 preseed: are supported and installed on your system.
Feb 9 16:51:20 preseed: perl: warning: Falling back to the standard locale ("C").
Feb 9 16:51:20 preseed: locale: Cannot set LC_CTYPE to default locale: No such file or directory
Feb 9 16:51:20 preseed: locale: Cannot set LC_MESSAGES to default locale: No such file or directory
Feb 9 16:51:20 preseed: locale: Cannot set LC_ALL to default locale: No such file or directory
<snip>
Feb 9 17:00:03 finish-install: info: Running /usr/lib/finish-install.d/05localechooser

tgunr (davec-polymicrosystems) wrote :

I just recently install 8.10 and getting similar problems.
[ub1]davec (429): locale
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=en_US
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=

dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = (unset),
 LC_ALL = (unset),
 LC_CTYPE = "en_US.UTF-8",
 LANG = "en_US"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
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
Generating locales...
  en_AU.UTF-8... up-to-date
  en_BW.UTF-8... up-to-date
  en_CA.UTF-8... up-to-date
  en_DK.UTF-8... up-to-date
  en_GB.UTF-8... up-to-date
  en_HK.UTF-8... up-to-date
  en_IE.UTF-8... up-to-date
  en_IN.UTF-8... up-to-date
  en_NG.UTF-8... up-to-date
  en_NZ.UTF-8... up-to-date
  en_PH.UTF-8... up-to-date
  en_SG.UTF-8... up-to-date
  en_US.UTF-8... up-to-date
  en_ZA.UTF-8... up-to-date
  en_ZW.UTF-8... up-to-date
Generation complete.

locale-gen en_US.UTF-8
Generating locales...
  en_US.UTF-8... up-to-date
Generation complete.

locale
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=en_US
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=

I have tried every fix I can find on the net to no avail, any ideas as to which file it is failing to find? Some clues from the error messages would be nice to use new users.

Daniel Kulesz (kuleszdl) wrote :

Update: I just installed a 9.04 Server yesterday and guess what - the issue is still present there as well. :(

Daniel Kulesz (kuleszdl) wrote :

Why is this bug actually marked as "incomplete"? Is there something missing in the reproduction steps Mikael posted?

maxstirner (philipp-d) wrote :

+1. Fresh 9.04 install @ my vhost..

"locale-gen en_US.UTF-8" fixes this.

Daniel Kulesz (kuleszdl) wrote :

Not for me. I have to run:

locale-gen de_DE@euro

(as stated in my initial port). Nevertheless - the question is, why this locales don't get generated automatically after installation?

MFeif (matt-feifarek) wrote :

Confirmed.

Just did a complete naked re-install with the "Alternate Install" disc in text-mode. Now I get this perl warning for EVERY SINGLE PACKAGE dpkg configures.

Daniel Kulesz (kuleszdl) on 2009-07-15
Changed in debian-installer (Ubuntu):
status: Incomplete → Confirmed
tags: added: lucid maverick natty
Daniel Kulesz (kuleszdl) wrote :

Just did a fresh installation of 11.10 - the issue seems to be fixed! After entering the language options in the installer a new screen pops up which forces me to select an encoding. As far as I remember this was already the case for 11.04...

Can someone else confirm the fix please?

Why was this not marked as "fix committed" or "fix released" btw?

andrew bezella (abezella) wrote :

i'm still seeing this on a newly-built 12.04 server (installed using fai). the`locale-gen` workaround takes care of it for me.

Daniel Kulesz (kuleszdl) wrote :

Actually I did not experience it anymore with the "alternative"-ISOs in 12.04 final (non-server) - it informs me that there is no locale for this combination and asks which one I'd like to use.

So I guess if it's still broken, then only for the server installs.

Daniel Kulesz (kuleszdl) wrote :

On my 12.04 installation the "locale-gen" workaround does not seem to work anymore. I tried regenerating all locales but I always end up with the following when running a command like perl:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US:en",
        LC_ALL = (unset),
        LC_PAPER = "a4",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

I used the alternative-ISO for installing and as written previously it asked me which locale I wanted to use, but it does not seem to work anymore as it did in 11.10 and 11.04.

Anders Hall (a.hall) wrote :

I also have noted this bug many times over the years. However, it is more severe for me in the server versions were we require utf8 (and only need one language). In a server/client configuration this can really mess things up (it does create severe charset bugs).

Apparently working solutions differs both between ubuntu versions and within the same version, according to users. E.g., for me no solution with locale-gen etc will work anymore (lots of them on the Internet) - when starting a fresh 12.04 build from ubuntu.com as mentioned previously (on amazon in my latest case).

The only viable solution i have found is to set "/etc/default/locale", then manually and run "dpkg-reconfigure locales" (with log-off/exit and login after). What is missing is ALWAYS variable LANGUAGE and LC_ALL (on server). What is worse is that apt-get often removes manual fixes to this problem when running apt-get dist-upgrade.

example locale file i altered (note use versions such as "en_US.UTF8" is not stable it seems, even though locale -a list it exactly that way).

LANGUAGE=en_US:en
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8

Also, does anyone know what the difference between variable "LANGUAGE" and "LANG" is? I really would like to know if i can set ALL handling to utf8 (which LANGUAGE appears to be missing).

NOTE 2: must be many more duplicate bugs for this on debian/ubuntu. Is this the only one (few admin/bugfixes/sysnotes as far as i can se)?

Anders Hall (a.hall) wrote :

Duplicate: Bug #1005334

Anders Hall (a.hall) wrote :

Duplicate: Bug #642706

George Politis (gpolitis) wrote :

Ubuntu 14.04 is affected... The fix from comment #16 solves the problem.

Daniel Kulesz (kuleszdl) on 2014-12-29
summary: - "setting locale failed" if using other keyboard layout then language
+ "setting locale failed" if using other keyboard layout than language
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.