本地化分段错误

本地化分段错误

我正在尝试生成语言环境,但是 locale-gen(localedef?)出现段错误。

# 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.

top看到虚拟内存被localedef -i en_US -c -f ISO-8859-1 en_US占用,然后是一些没有后缀的巨大数字,然后出现段错误。8000GG

系统有1G内存和512MBSWAP,但内存几乎没有使用(130MB在生成高峰期)。

系统数据:

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.

答案1

您的文件中似乎有以下几行/etc/default/locale

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

设置LC_CTYPE错误,因为“UTF-8”不是有效的语言环境名称。此外,设置所有这些变量毫无意义;我建议您直接删除和LC_ALLLC_CTYPE

(我最近看到了类似的东西。很想知道这LC_CTYPE=UTF-8句话是怎么出现在那里的。)

相关内容