Description of problem: locale --all-locales --verbose 执行报错 Version-Release number of selected component (if applicable): [root@iZbp1b3q91t7fog9z072ivZ devel_toolchains]# cat /etc/os-release NAME="Anolis OS" VERSION="23" ID="anolis" VERSION_ID="23" PLATFORM_ID="platform:an23" PRETTY_NAME="Anolis OS 23" ANSI_COLOR="0;31" HOME_URL="https://openanolis.cn/" BUG_REPORT_URL="https://bugzilla.openanolis.cn/" [root@iZbp1b3q91t7fog9z072ivZ devel_toolchains]# uname -a Linux iZbp1b3q91t7fog9z072ivZ 5.10.134-12.1.an23.aarch64 #1 SMP Thu Oct 13 11:31:15 CST 2022 aarch64 GNU/Linux [root@iZbp1b3q91t7fog9z072ivZ devel_toolchains]# yum info glibc-common Installed Packages Name : glibc-common Version : 2.36 Release : 2.an23 Architecture : aarch64 Size : 1.3 M Source : glibc-2.36-2.an23.src.rpm Repository : @System Summary : Common binaries and locale data for glibc URL : http://www.gnu.org/software/glibc/ License : LGPLv2+ and LGPLv2+ with exceptions and GPLv2+ and GPLv2+ with exceptions and BSD and Inner-Net and ISC and : Public Domain and GFDL Description : The glibc-common package includes common binaries for the GNU libc : libraries, as well as national language (locale) support. How reproducible: [root@iZbp1b3q91t7fog9z072ivZ devel_toolchains]# locale --all-locales --verbose 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 locale: C.utf8 directory: /usr/lib/locale/C.utf8 ------------------------------------------------------------------------------- title | C locale email | bug-glibc-locales@gnu.org revision | 2.1 date | 2022-01-30 codeset | UTF-8 Steps to Reproduce: 如上 Actual results: 如上 Expected results: 正确列出locales Additional info: an8 的结果: [root@nu1l07429 ~]# locale --all-locales --verbose locale: C.utf8 directory: /usr/lib/locale/C.utf8 ------------------------------------------------------------------------------- title | C locale email | mfabian@redhat.com language | C revision | 1.0 date | 2015-08-10 codeset | UTF-8 locale: en_AG directory: /usr/lib/locale/en_AG ------------------------------------------------------------------------------- title | English language locale for Antigua and Barbuda source | Free Software Foundation, Inc. address | http://www.gnu.org/software/libc/ email | bug-glibc-locales@gnu.org language | English territory | Antigua & Barbuda revision | 1.0 date | 2008-09-16 codeset | UTF-8 locale: en_AU directory: /usr/lib/locale/en_AU ------------------------------------------------------------------------------- title | English locale for Australia source | RAP address | Sankt J�rgens Alle 8, DK-1615 K�benhavn V, Danmark email | bug-glibc-locales@gnu.org language | Australian English territory | Australia revision | 1.0 date | 2000-06-29 codeset | ISO-8859-1 locale: en_AU.utf8 directory: /usr/lib/locale/en_AU.utf8 ------------------------------------------------------------------------------- title | English locale for Australia source | RAP address | Sankt Jørgens Alle 8, DK-1615 København V, Danmark email | bug-glibc-locales@gnu.org language | Australian English territory | Australia revision | 1.0 date | 2000-06-29 codeset | UTF-8 locale: en_BW directory: /usr/lib/locale/en_BW ------------------------------------------------------------------------------- title | English locale for Botswana source | RAP email | bug-glibc-locales@gnu.org language | English territory | Botswana revision | 1.0 date | 2000-06-29 codeset | ISO-8859-1 locale: en_BW.utf8 directory: /usr/lib/locale/en_BW.utf8 ------------------------------------------------------------------------------- title | English locale for Botswana source | RAP email | bug-glibc-locales@gnu.org language | English territory | Botswana revision | 1.0 date | 2000-06-29 codeset | UTF-8 locale: en_CA directory: /usr/lib/locale/en_CA ------------------------------------------------------------------------------- title | English locale for Canada source | RAP address | Sankt J�rgens Alle 8, DK-1615 K�benhavn V, Danmark email | bug-glibc-locales@gnu.org language | Canadian English territory | Canada revision | 1.0 date | 2000-06-29 codeset | ISO-8859-1 locale: en_CA.utf8 directory: /usr/lib/locale/en_CA.utf8 ------------------------------------------------------------------------------- title | English locale for Canada source | RAP address | Sankt Jørgens Alle 8, DK-1615 København V, Danmark email | bug-glibc-locales@gnu.org language | Canadian English territory | Canada revision | 1.0 date | 2000-06-29 codeset | UTF-8 locale: en_DK directory: /usr/lib/locale/en_DK ------------------------------------------------------------------------------- title | English locale for Denmark source | Danish Standards Association address | Kollegievej 6, DK-2920 Charlottenlund, Danmark email | bug-glibc-locales@gnu.org language | English territory | Denmark revision | 1.0 date | 2000-06-29 codeset | ISO-8859-1 locale: en_DK.utf8 directory: /usr/lib/locale/en_DK.utf8 ------------------------------------------------------------------------------- title | English locale for Denmark source | Danish Standards Association address | Kollegievej 6, DK-2920 Charlottenlund, Danmark email | bug-glibc-locales@gnu.org language | English territory | Denmark revision | 1.0 date | 2000-06-29 codeset | UTF-8 locale: en_GB directory: /usr/lib/locale/en_GB ------------------------------------------------------------------------------- title | English locale for Britain source | RAP address | Sankt J�rgens Alle 8, DK-1615 K�benhavn V, Danmark contact | Keld Simonsen email | bug-glibc-locales@gnu.org language | British English territory | United Kingdom revision | 1.0 date | 2000-06-28 codeset | ISO-8859-1 locale: en_GB.iso885915 directory: /usr/lib/locale/en_GB.iso885915 ------------------------------------------------------------------------------- title | English locale for Britain source | RAP address | Sankt J�rgens Alle 8, DK-1615 K�benhavn V, Danmark contact | Keld Simonsen email | bug-glibc-locales@gnu.org language | British English territory | United Kingdom revision | 1.0 date | 2000-06-28 codeset | ISO-8859-15 locale: en_GB.utf8 directory: /usr/lib/locale/en_GB.utf8 ------------------------------------------------------------------------------- title | English locale for Britain source | RAP address | Sankt Jørgens Alle 8, DK-1615 København V, Danmark contact | Keld Simonsen email | bug-glibc-locales@gnu.org language | British English territory | United Kingdom revision | 1.0 date | 2000-06-28 codeset | UTF-8 locale: en_HK directory: /usr/lib/locale/en_HK ------------------------------------------------------------------------------- title | English locale for Hong Kong source | IBM Globalization Center of Competency, Yamato Software Laboratory address | 1623-14, Shimotsuruma, Yamato-shi, Kanagawa-ken, 242-8502, Japan email | bug-glibc-locales@gnu.org language | English territory | Hong Kong SAR China revision | 1.0 date | 2000,October,27 (XML source:2000,July,20) codeset | ISO-8859-1 locale: en_HK.utf8 directory: /usr/lib/locale/en_HK.utf8 ------------------------------------------------------------------------------- title | English locale for Hong Kong source | IBM Globalization Center of Competency, Yamato Software Laboratory address | 1623-14, Shimotsuruma, Yamato-shi, Kanagawa-ken, 242-8502, Japan email | bug-glibc-locales@gnu.org language | English territory | Hong Kong SAR China revision | 1.0 date | 2000,October,27 (XML source:2000,July,20) codeset | UTF-8 locale: en_IE directory: /usr/lib/locale/en_IE ------------------------------------------------------------------------------- title | English locale for Ireland source | RAP address | Sankt J�rgens Alle 8, DK-1615 K�benhavn V, Danmark email | bug-glibc-locales@gnu.org language | English territory | Ireland revision | 1.0 date | 2000-06-29 codeset | ISO-8859-1 locale: en_IE@euro directory: /usr/lib/locale/en_IE@euro ------------------------------------------------------------------------------- title | English locale for Ireland with Euro source | Free Software Foundation, Inc. address | http://www.gnu.org/software/libc/ email | bug-glibc-locales@gnu.org language | English territory | Ireland revision | 1.0 date | 2000-08-20 codeset | ISO-8859-15 locale: en_IE.utf8 directory: /usr/lib/locale/en_IE.utf8 ------------------------------------------------------------------------------- title | English locale for Ireland source | RAP address | Sankt Jørgens Alle 8, DK-1615 København V, Danmark email | bug-glibc-locales@gnu.org language | English territory | Ireland revision | 1.0 date | 2000-06-29 codeset | UTF-8 locale: en_IL directory: /usr/lib/locale/en_IL ------------------------------------------------------------------------------- title | English locale for Israel source | Free Software Foundation, Inc. address | http://www.gnu.org/software/libc/ email | bug-glibc-locales@gnu.org language | English territory | Israel revision | 1.1 date | 2016-04-19 codeset | UTF-8 locale: en_IN directory: /usr/lib/locale/en_IN ------------------------------------------------------------------------------- title | English language locale for India source | IBM Globalization Center of Competency, Yamato Software Laboratory address | 1623-14, Shimotsuruma, Yamato-shi, Kanagawa-ken, 242-8502, Japan email | bug-glibc-locales@gnu.org language | English territory | India revision | 1.0 date | 2000,October,27 (XML source:2000,July,20) codeset | UTF-8 locale: en_NG directory: /usr/lib/locale/en_NG ------------------------------------------------------------------------------- title | English locale for Nigeria language | English territory | Nigeria revision | 0.2 date | 2006-02-01 codeset | UTF-8 locale: en_NZ directory: /usr/lib/locale/en_NZ ------------------------------------------------------------------------------- title | English locale for New Zealand source | RAP address | Sankt J�rgens Alle 8, DK-1615 K�benhavn V, Danmark email | bug-glibc-locales@gnu.org language | English territory | New Zealand revision | 1.0 date | 2000-06-29 codeset | ISO-8859-1 locale: en_NZ.utf8 directory: /usr/lib/locale/en_NZ.utf8 ------------------------------------------------------------------------------- title | English locale for New Zealand source | RAP address | Sankt Jørgens Alle 8, DK-1615 København V, Danmark email | bug-glibc-locales@gnu.org language | English territory | New Zealand revision | 1.0 date | 2000-06-29 codeset | UTF-8 locale: en_PH directory: /usr/lib/locale/en_PH ------------------------------------------------------------------------------- title | English language locale for Philippines source | IBM Globalization Center of Competency, Yamato Software Laboratory address | 1623-14, Shimotsuruma, Yamato-shi, Kanagawa-ken, 242-8502, Japan email | bug-glibc-locales@gnu.org language | English territory | Philippines revision | 1.0 date | 2000,October,27 (XML source:2000,July,20) codeset | ISO-8859-1 locale: en_PH.utf8 directory: /usr/lib/locale/en_PH.utf8 ------------------------------------------------------------------------------- title | English language locale for Philippines source | IBM Globalization Center of Competency, Yamato Software Laboratory address | 1623-14, Shimotsuruma, Yamato-shi, Kanagawa-ken, 242-8502, Japan email | bug-glibc-locales@gnu.org language | English territory | Philippines revision | 1.0 date | 2000,October,27 (XML source:2000,July,20) codeset | UTF-8 locale: en_SC.utf8 directory: /usr/lib/locale/en_SC.utf8 ------------------------------------------------------------------------------- title | English locale for the Seychelles source | Samsung Electronics Co., Ltd. email | akhilesh.k@samsung.com language | English territory | Seychelles revision | 1.0 date | 2017-07-24 codeset | UTF-8 locale: en_SG directory: /usr/lib/locale/en_SG ------------------------------------------------------------------------------- title | English language locale for Singapore source | IBM Globalization Center of Competency, Yamato Software Laboratory address | 1623-14, Shimotsuruma, Yamato-shi, Kanagawa-ken, 242-8502, Japan email | bug-glibc-locales@gnu.org language | English territory | Singapore revision | 1.0 date | 2000,October,27 (XML source:2000,July,20) codeset | ISO-8859-1 locale: en_SG.utf8 directory: /usr/lib/locale/en_SG.utf8 ------------------------------------------------------------------------------- title | English language locale for Singapore source | IBM Globalization Center of Competency, Yamato Software Laboratory address | 1623-14, Shimotsuruma, Yamato-shi, Kanagawa-ken, 242-8502, Japan email | bug-glibc-locales@gnu.org language | English territory | Singapore revision | 1.0 date | 2000,October,27 (XML source:2000,July,20) codeset | UTF-8 locale: en_US directory: /usr/lib/locale/en_US ------------------------------------------------------------------------------- title | English locale for the USA source | Free Software Foundation, Inc. address | http://www.gnu.org/software/libc/ email | bug-glibc-locales@gnu.org language | American English territory | United States revision | 1.0 date | 2000-06-24 codeset | ISO-8859-1 locale: en_US@ampm.UTF- directory: /usr/lib/locale/en_US@ampm.UTF-8 ------------------------------------------------------------------------------- title | English locale for the USA source | Free Software Foundation, Inc. address | http://www.gnu.org/software/libc/ email | bug-glibc-locales@gnu.org language | American English territory | United States revision | 1.0 date | 2000-06-24 codeset | UTF-8 locale: en_US.iso885915 directory: /usr/lib/locale/en_US.iso885915 ------------------------------------------------------------------------------- title | English locale for the USA source | Free Software Foundation, Inc. address | http://www.gnu.org/software/libc/ email | bug-glibc-locales@gnu.org language | American English territory | United States revision | 1.0 date | 2000-06-24 codeset | ISO-8859-15 locale: en_US.utf8 directory: /usr/lib/locale/en_US.utf8 ------------------------------------------------------------------------------- title | English locale for the USA source | Free Software Foundation, Inc. address | http://www.gnu.org/software/libc/ email | bug-glibc-locales@gnu.org language | American English territory | United States revision | 1.0 date | 2000-06-24 codeset | UTF-8 locale: en_ZA directory: /usr/lib/locale/en_ZA ------------------------------------------------------------------------------- title | English locale for South Africa source | Zuza Software Foundation (Translate.org.za) address | Box 28364, Sunnyside, 0132, South Africa contact | Dwayne Bailey email | dwayne@translate.org.za language | English territory | South Africa abbreviation | Translate.org.za revision | 1.3 date | 2007-04-19 codeset | ISO-8859-1 locale: en_ZA.utf8 directory: /usr/lib/locale/en_ZA.utf8 ------------------------------------------------------------------------------- title | English locale for South Africa source | Zuza Software Foundation (Translate.org.za) address | Box 28364, Sunnyside, 0132, South Africa contact | Dwayne Bailey email | dwayne@translate.org.za language | English territory | South Africa abbreviation | Translate.org.za revision | 1.3 date | 2007-04-19 codeset | UTF-8 locale: en_ZM directory: /usr/lib/locale/en_ZM ------------------------------------------------------------------------------- title | English locale for Zambia source | ANLoc contact | Martin Benjamin email | locales@africanlocalization.net language | English territory | Zambia revision | 1.0 date | 2011-04-18 codeset | UTF-8 locale: en_ZW directory: /usr/lib/locale/en_ZW ------------------------------------------------------------------------------- title | English locale for Zimbabwe source | RAP email | bug-glibc-locales@gnu.org language | English territory | Zimbabwe revision | 1.0 date | 2000-06-29 codeset | ISO-8859-1 locale: en_ZW.utf8 directory: /usr/lib/locale/en_ZW.utf8 ------------------------------------------------------------------------------- title | English locale for Zimbabwe source | RAP email | bug-glibc-locales@gnu.org language | English territory | Zimbabwe revision | 1.0 date | 2000-06-29 codeset | UTF-8
需要安装glibc-langpack-en
1、报错信息: locale: Cannot set LC_CTYPE to default locale: No such file or directory 需要通过locale查看当前的LANG设置的是什么语言,如果是en,则需要安装对应的glibc-langpack-en包。 2、an8环境上输出了更多的locale信息,则需要比较两台环境上安装的langpack系列包是否相同。 可以通过rpm -qa | grep langpack来查看比较。
通过ISO安装的虚拟机镜像执行locale不会报错。 默认的locale环境变量可以查看/etc/locale.conf。 ecs实例报错,通过排查发现cloud-init有设置: 2023-02-22 14:02:08,388 - cc_locale.py[DEBUG]: Setting locale to en_US.UTF-8 2023-02-22 14:02:08,388 - util.py[DEBUG]: Reading from /etc/locale.conf (quiet=False) 2023-02-22 14:02:08,388 - util.py[DEBUG]: Read 19 bytes from /etc/locale.conf 2023-02-22 14:02:08,389 - util.py[DEBUG]: Writing to /etc/locale.conf - wb: [644] 17 bytes 所以ecs镜像默认需要安装glibc-langpack-en。
anolis23 anck 15 rc1版本测试时,使用vhd镜像安装的ecs实例,也存在相似的问题 vhd镜像: # cat /etc/image-id image_name="Anolis OS 23. 64 bit" image_id="anolis_23_x64_20G_alibase_20230619.vhd" release_date="20230619041314" # locale 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_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" 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 C.utf8 POSIX 安装glibc-langpack-en包后,问题可解决,但是用户体验并不好,既然使用vhd镜像安装的ecs,默认字符编码是en_US.UTF-8,那是否可以在vhd镜像中默认包含glibc-langpack-en包