Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to generate locales, but locale-gen (localedef?) segfaults.

# sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = "en_US.UTF-8",
        LC_CTYPE = "UTF-8",
        LANG = "en_US.UTF-8"
    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
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Generating locales...
  en_US.ISO-8859-1... /usr/sbin/locale-gen: line 177: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/usr/sbin/locale-gen: line 243:  3809 Segmentation fault      localedef $no_archive -i $input -c -f $charset $locale_alias $locale
failed
  en_US.UTF-8... /usr/sbin/locale-gen: line 177: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/usr/sbin/locale-gen: line 243:  3836 Segmentation fault      localedef $no_archive -i $input -c -f $charset $locale_alias $locale
failed
Generation complete.

In top I see localedef -i en_US -c -f ISO-8859-1 en_US taking up 8000G of virtual memory, then some huge number without even G suffix and then segfault.

System has 1G memory and 512MB SWAP, but memory is barely used (130MB at peak of generation).

System data:

root@docs:~# uname -a
Linux docs 2.6.32-042stab078.28 #1 SMP Mon Jul 8 10:17:22 MSK 2013 x86_64 x86_64 x86_64 GNU/Linux

root@docs:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.4 LTS"

root@docs:~# dpkg-query --show glibc*
glibc-2.13-1
glibc-doc

root@docs:~# sudo apt-get update && sudo apt-get upgrade
...skipped...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
share|improve this question

1 Answer 1

It looks like you have these lines in your /etc/default/locale file:

LC_ALL=en_US.UTF-8
LC_CTYPE=UTF-8
LANG=en_US.UTF-8

The LC_CTYPE setting is wrong, since "UTF-8" is not a valid locale name. Also, it makes no sense to set all those variables; I would recommend that you simply remove the LC_ALL and LC_CTYPE lines.

(I saw something similar recently. It would be interesting to know how that LC_CTYPE=UTF-8 statement ended up there in the first place.)

share|improve this answer
    
Actually I have only those: LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 –  Slava N Mar 5 at 16:29
    
Setting LC_CTYPE=en_US.UTF-8 and then sudo locale-gen en_US.UTF-8, then sudo dpkg-reconfigure locales helped! Thanks! –  Slava N Mar 5 at 16:34
    
Oops, was running commands on wrong machine. Setting LC_CTYPE explicitly didn't help, still segfault :( –  Slava N Mar 5 at 16:38
    
Don't bother with locale-gen and dpkg-reconfigure. Your problem is that LC_CTYPE is incorrectly set somewhere, apparently somewhere else but /etc/default/locale. Maybe some of your config files in $HOME contains the incorrect statement, such as ~/.bashrc or ~/.profile. –  Gunnar Hjalmarsson Mar 5 at 20:10

Your Answer

 
discard

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.