arch 上的奇怪语言环境问题

Strange locale issue on arch

最近我的 gnome 终端停止工作了。使用 xterm 启动它后,我看到以下内容:

(process:3975): Gtk-WARNING **: Locale not supported by C library.
    Using the fallback 'C' locale.
Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error calling StartServiceByName for org.gnome.Terminal: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.gnome.Terminal exited with status 8

它似乎与我的语言环境有关,如下所示:

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
LANG=en_GB.utf8
LC_CTYPE="en_GB.utf8"
LC_NUMERIC="en_GB.utf8"
LC_TIME="en_GB.utf8"
LC_COLLATE="en_GB.utf8"
LC_MONETARY="en_GB.utf8"
LC_MESSAGES="en_GB.utf8"
LC_PAPER="en_GB.utf8"
LC_NAME="en_GB.utf8"
LC_ADDRESS="en_GB.utf8"
LC_TELEPHONE="en_GB.utf8"
LC_MEASUREMENT="en_GB.utf8"
LC_IDENTIFICATION="en_GB.utf8"
LC_ALL=

我的 locale -a 看起来像这样:

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_COLLATE to default locale: No such file or directory
C
POSIX
en_US.utf8
fr_CA.utf8
pl_PL.utf8

我真的不确定语言环境输出中所有 en_GB.utf8 来自哪里。

我按照类似问题的帖子中的建议尝试了 locale-gen,但这并没有解决问题。我该如何修复?这台电脑上的其他帐户没有这个问题,只有我的。我不记得做过什么特别的事情会导致这种情况。

有两种方法可以解决此问题。

  1. 生成缺少的语言环境。打开 /etc/locale.gen 并取消注释缺少语言环境的行 (en_GB.utf8)。然后 运行 locale-gen 作为 root.
  2. 查找区域设置设置为错误值的位置。尝试 grep LANG ~/.*profile ~/.bashrc ~/.pam_environment ~/.xinitrc。注释包含错误导出命令的行。

为确保更改已应用,请重新登录或重新启动。