如何修复 Debian 挤压中的区域设置

blo*_*kie 22 localization debian-squeeze

我偶尔会遇到语言环境错误,我尝试运行 dpkg-reconfigure locales 来解决这个问题。这是输出:

:~$ sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    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_ALL to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Run Code Online (Sandbox Code Playgroud)

我寻找 /usr/bin/locale 但它在我的系统上不存在。我需要创建它吗?我在里面放什么?

我还发现了一个相关的问题,说他的问题的原因在 sshd_config 文件中。该文件具有以下条目:

AcceptEnv LANG LC_*
Run Code Online (Sandbox Code Playgroud)

我主要担心它可能会导致我的 VPS 出现问题,否则如果不是什么大问题,我会很乐意忽略这个问题。我该怎么办?谢谢!

小智 16

第一的:

sudo apt-get purge locales
Run Code Online (Sandbox Code Playgroud)

然后:

sudo aptitude install locales
Run Code Online (Sandbox Code Playgroud)

和著名的:

sudo dpkg-reconfigure locales
Run Code Online (Sandbox Code Playgroud)

这摆脱了语言环境系统,然后重新安装语言环境并将 libc6 从 2.19 降级到 2.13,这是问题所在。然后再次配置语言环境。


小智 12

如果在通过 SSH 连接到您的机器时发生这种情况,而不是在控制台上,请尝试重新配置您的ssh 客户端(在您的本地机器上)。例如在 Mac OS X 上编辑 /private/etc/ssh_config 并注释掉

# SendEnv LANG LC_*
Run Code Online (Sandbox Code Playgroud)

感谢 bredman 在Rasberry Pi 公告板上的帖子。

  • 现在该文件:/private/etc/ssh/ssh_config (4认同)

Hon*_*Lai 8

我遇到这个问题很长时间了,所有关于 dpkg-reconfigure locales、locale-gen 等的常见建议都没有帮助。所以我玩了一点环境变量,我发现系统在LC_CTYPE环境变量上运行缓慢!UTF-8不是它的有效值。设置它来en_US.UTF-8修复它。

为了使更改永久化,我跑了

update-locale LC_CTYPE=en_US.UTF-8
Run Code Online (Sandbox Code Playgroud)

写入/etc/default/locale. 然后重启系统使其完全生效。


Cha*_*ler 2

我以前在较旧的 Debian 安装上见过这种情况,虽然很烦人,但我从未见过它引起问题。

如果

  /usr/bin/locale 
Run Code Online (Sandbox Code Playgroud)

缺少,请尝试(以 root 身份):

  apt-get install libc-bin
Run Code Online (Sandbox Code Playgroud)

应该安装 libc-bin,提供 /usr/bin/locale。

sshd_config 中的 AcceptEnv 行非常标准,不应该是这里出现问题的原因。