lightdm doesn't set locale correctly

Bug #797249 reported by Chad Miller
This bug report is a duplicate of:  Bug #793366: Sets $LANG to invalid value "de". Edit Remove
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Light Display Manager
Confirmed
Undecided
Unassigned

Bug Description

Console without X works as expected. GDM works. LightDM doesn't set locale information in the same way, and various apps break, like perl and bzr.

Perl, for instance, emits

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

and strace shows these syscalls that are unique to running lightdm.

open("/usr/lib/locale/en_US:en/LC_IDENTIFICATION", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en/LC_IDENTIFICATION", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US:en/LC_IDENTIFICATION", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_IDENTIFICATION", O_RDONLY) = -1 ENOENT (No such file or directory)

'etckeeper' runs 'bzr' which says.

etckeeper warning: bzr add failed
bzr: warning: unsupported locale setting
  bzr could not set the application locale.
  Although this should be no problem for bzr itself, it might
  cause problems with some plugins. To investigate the issue,
  look at the output of the locale(1p) tool.

My /etc/default/locales:

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

From GDM session:

cmiller@hypatia:~$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
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=

I'll attach output from lightdm soon.

Revision history for this message
Chad Miller (cmiller) wrote :

cmiller@hypatia:~$ 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
LANGUAGE=en_US:en
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES=en_US.UTF-8
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=
cmiller@hypatia:~$ perl -e print\;
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = "en_US:en",
 LC_ALL = (unset),
 LC_MESSAGES = "en_US.UTF-8",
 LANG = "en_US"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
cmiller@hypatia:~$ bzr info
bzr: warning: unsupported locale setting
  bzr could not set the application locale.
  Although this should be no problem for bzr itself, it might
  cause problems with some plugins. To investigate the issue,
  look at the output of the locale(1p) tool.
bzr: ERROR: Not a branch: "/home/cmiller/".

Oh, sorry: lightdm 0.3.7-0ubuntu2

Revision history for this message
z3z (z3z) wrote :

I've experienced this bug on three different setups. I have a PC running Narwhal, where I installed LightDM, and this problem occurred. On a separate partition on the same machine, I installed Narwhal, then immediately upgraded to Oneiric and had the same issue. Also on a laptop, after upgrading from Narwhal to Oneiric, I have the same issue.

All setups are running LightDM version 0.3.7

I see errors in the terminal when I run apt-get or other command. The error is below:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_GB:en",
    LC_ALL = (unset),
    LC_MESSAGES = "en_GB.UTF-8",
    LANG = "en_GB"
    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_ALL to default locale: No such file or directory

If I type "locale" into the terminal, I get:

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_GB
LANGUAGE=en_GB:en
LC_CTYPE="en_GB"
LC_NUMERIC="en_GB"
LC_TIME="en_GB"
LC_COLLATE="en_GB"
LC_MONETARY="en_GB"
LC_MESSAGES=en_GB.UTF-8
LC_PAPER="en_GB"
LC_NAME="en_GB"
LC_ADDRESS="en_GB"
LC_TELEPHONE="en_GB"
LC_MEASUREMENT="en_GB"
LC_IDENTIFICATION="en_GB"
LC_ALL=

After a bit of messing around, I discovered that the following commands should fix it (at least, it worked for me!)

sudo dpkg-reconfigure locales
sudo locale-gen en_GB
sudo update-locale LANG=en_GB.UTF8

(Obviously the above is for British English, and would need to be changed to your language preference).

After running these commands, if I type locale again, I get the following (without any error)

LANG=en_GB
LANGUAGE=en_GB:en
LC_CTYPE="en_GB"
LC_NUMERIC="en_GB"
LC_TIME="en_GB"
LC_COLLATE="en_GB"
LC_MONETARY="en_GB"
LC_MESSAGES=en_GB.UTF-8
LC_PAPER="en_GB"
LC_NAME="en_GB"
LC_ADDRESS="en_GB"
LC_TELEPHONE="en_GB"
LC_MEASUREMENT="en_GB"
LC_IDENTIFICATION="en_GB"
LC_ALL=

I can run apt-get without any errors after these steps.

Revision history for this message
3vi1 (launchpad-net-eternaldusk) wrote :

I'm seeing this too. It makes it impossible to start ccsm until you export those variables.

Revision history for this message
z3z (z3z) wrote :

3vi1, yes I experienced that too, though the fix I used above sorted it.

Revision history for this message
Hernando Torque (htorque) wrote :

LightDM seems to use the value of the 'Language' variable in '~/.dmrc' to set 'LANG' (unlike GDM). However, GDM doesn't set that variable to a LANG-compatible value (like en_US.utf8), so LANG becomes invalid and introduces all those problems.

Changed in lightdm:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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