我在RHEL 7.4 docker映像中遇到了相同的问题。yum reinstall glibc-common
本身并不能解决问题。它只是安装英语。
我在docker容器/etc/yum.conf
中发现该行override_install_langs=en_US
。这导致yum reinstall glibc-common
只安装英语。
将此行注释掉(或更改为所有默认值),然后重新运行,yum reinstall glibc-common
我便可以使用其他语言
docker运行/附加后的初始环境
# locale -a
C
POSIX
en_US.utf8
# grep lang /etc/yum.conf
override_install_langs=en_US
# export LANG=fr_FR
# ls foo
ls: cannot access foo: No such file or directory
我尝试在更改之前重新安装glib-common /etc/yum.conf
# yum -y -q reinstall glibc-common
Failed to set locale, defaulting to C
# ls foo
ls: cannot access foo: No such file or directory
# 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
en_US.iso88591
en_US.iso885915
en_US.utf8
#
更改/etc/yum.conf
后注释掉该行override_install_langs=en_US
# vi /etc/yum.conf
# grep lang /etc/yum.conf
#override_install_langs=en_US
# yum -y -q reinstall glibc-common
Failed to set locale, defaulting to C
# ls foo
ls: cannot access foo: Aucun fichier ou dossier de ce type
# locale -a | wc -l
789