我在 Debian bullseye (v11) 中遇到的问题:
\n如果我执行locale -a,我会得到以下输出:
locale: Cannot set LC_CTYPE to default locale: No such file or directory\nlocale: Cannot set LC_MESSAGES to default locale: No such file or directory\nlocale: Cannot set LC_COLLATE to default locale: No such file or directory\nC\nC.UTF-8\nPOSIX\naa_DJ\naa_DJ.iso88591\naa_DJ.utf8\naa_ER\naa_ER.utf8\n...\nzh_TW\nzh_TW.big5\nzh_TW.euctw\nzh_TW.utf8\nzu_ZA\nzu_ZA.iso88591\nzu_ZA.utf8\nRun Code Online (Sandbox Code Playgroud)\n另外,如果我尝试使用tlmgr(LateX 的包管理器),我会得到以下信息:
perl: warning: Setting locale failed.\nperl: warning: Please check that your locale settings:\n LANGUAGE = "en_US:fr:en_GB",\n LC_ALL = "en-US.UTF-8",\n LC_MESSAGES = "en_US.UTF-8",\n LC_CTYPE = "en_US.UTF-8",\n LC_COLLATE = "en_US.UTF-8",\n LANG = "fr_FR.UTF-8"\n are supported and installed on your system.\nperl: warning: Falling back to a fallback locale ("fr_FR.UTF-8").\ntlmgr: no action given; try --help if you need it.\nRun Code Online (Sandbox Code Playgroud)\n我搜索了该问题,并尝试了以下操作:
\ndpkg-reconfigure locales并仅选择使用的区域设置(fr utf8、en-us utf8 和 en-gb utf8)dpkg-reconfigure locales并选择所有区域设置(如上所示)locale-gencat /etc/default/locale给出:
# File generated by update-locale\nLANG=en_US.UTF-8\nLANGUAGE=en_US.UTF-8\nLC_ALL=en_US.UTF-8\nLC_CTYPE=en_US.UTF-8\nLC_MESSAGES=en_US.UTF-8\nLC_COLLATE=en_US.UTF-8\nRun Code Online (Sandbox Code Playgroud)\nls /usr/share/locale/en给出:
# File generated by update-locale\nLANG=en_US.UTF-8\nLANGUAGE=en_US.UTF-8\nLC_ALL=en_US.UTF-8\nLC_CTYPE=en_US.UTF-8\nLC_MESSAGES=en_US.UTF-8\nLC_COLLATE=en_US.UTF-8\nRun Code Online (Sandbox Code Playgroud)\nls /usr/share/locale/en/LC_MESSAGES给出:
LC_MESSAGES\nRun Code Online (Sandbox Code Playgroud)\n/usr/share/locale/en?如果您有建议阅读文档以更深入地了解这个问题,我也会听取您的建议。
\n谢谢。
\n输出locale
accounts-service.mo gtk30-properties.mo iso_3166-2.mo kcoreaddons5_qt.qm kwidgetsaddons5_qt.qm\ncups-pk-helper.mo gtk30.mo\nRun Code Online (Sandbox Code Playgroud)\n输出strace locale 2>&1 | grep ENOENT:
locale: Cannot set LC_CTYPE to default locale: No such file or directory\nlocale: Cannot set LC_MESSAGES to default locale: No such file or directory\nlocale: Cannot set LC_ALL to default locale: No such file or directory\nLANG=fr_FR.UTF-8\nLANGUAGE=en_US:fr:en_GB\nLC_CTYPE="en-US.UTF-8"\nLC_NUMERIC="en-US.UTF-8"\nLC_TIME="en-US.UTF-8"\nLC_COLLATE="en-US.UTF-8"\nLC_MONETARY="en-US.UTF-8"\nLC_MESSAGES="en-US.UTF-8"\nLC_PAPER="en-US.UTF-8"\nLC_NAME="en-US.UTF-8"\nLC_ADDRESS="en-US.UTF-8"\nLC_TELEPHONE="en-US.UTF-8"\nLC_MEASUREMENT="en-US.UTF-8"\nLC_IDENTIFICATION="en-US.UTF-8"\nLC_ALL=en-US.UTF-8\nRun Code Online (Sandbox Code Playgroud)\nls /usr/lib/locale给出:
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, "/usr/lib/locale/en-US.UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, "/usr/lib/locale/en-US.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, "/usr/lib/locale/en-US/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, "/usr/lib/locale/en-US.UTF-8/LC_MESSAGES", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, "/usr/lib/locale/en-US.utf8/LC_MESSAGES", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, "/usr/lib/locale/en-US/LC_MESSAGES", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, "/usr/lib/locale/en-US.UTF-8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, "/usr/lib/locale/en-US.utf8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)\nopenat(AT_FDCWD, "/usr/lib/locale/en-US/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)\nRun Code Online (Sandbox Code Playgroud)\n如果我没记错的话,dpkg-reconfigure locales应该列出语言环境,并为每个语言环境说“最新”(如果已经生成)。但就我而言,它重新处理每个区域设置并说“完成”:
C.UTF-8\nlocale-archive\nRun Code Online (Sandbox Code Playgroud)\ndpkg -l | grep "language-pack"不返回任何内容。
sudo apt-get install -y locales locales-all:
perl: warning: Setting locale failed.\nperl: warning: Please check that your locale settings:\n LANGUAGE = "en_US:fr:en_GB",\n LC_ALL = "en-US.UTF-8",\n LC_MESSAGES = "en_US.UTF-8",\n LC_CTYPE = "en_US.UTF-8",\n LC_COLLATE = "en_US.UTF-8",\n LANG = "fr_FR.UTF-8"\n are supported and installed on your system.\nperl: warning: Falling back to a fallback locale ("fr_FR.UTF-8").\nlocale: Cannot set LC_CTYPE to default locale: No such file or directory\nlocale: Cannot set LC_MESSAGES to default locale: No such file or directory\nlocale: Cannot set LC_ALL to default locale: No such file or directory\n/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory\n/usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory\n/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory\nGenerating locales (this might take a while)...\n aa_DJ.UTF-8... done\n aa_DJ.ISO-8859-1... done\n aa_ER.UTF-8... done\n aa_ER.UTF-8@saaho... done\n aa_ET.UTF-8... done\n af_ZA.UTF-8... done\n af_ZA.ISO-8859-1... done\n agr_PE.UTF-8... done\n ak_GH.UTF-8... done\n am_ET.UTF-8... done\n an_ES.UTF-8... done\n an_ES.ISO-8859-15... done\n anp_IN.UTF-8... done\n ar_AE.UTF-8... done\n ar_AE.ISO-8859-6... done\n ar_BH.UTF-8... done\n ar_BH.ISO-8859-6... done\n ar_DZ.UTF-8... done\n ar_DZ.ISO-8859-6... done\n ar_EG.UTF-8... done\n ar_EG.ISO-8859-6... done\n ar_IN.UTF-8... done\n ar_IQ.UTF-8... done\n ...\nRun Code Online (Sandbox Code Playgroud)\n重启后,locale -a仍然给出:
Reading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nlocales is already the newest version (2.31-13+deb11u2).\nThe following NEW packages will be installed:\n locales-all\n0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.\nNeed to get 10.8 MB of archives.\nAfter this operation, 227 MB of additional disk space will be used.\nGet:1 http://deb.debian.org/debian bullseye/main amd64 locales-all amd64 2.31-13+deb11u2 [10.8 MB]\nFetched 10.8 MB in 21s (515 kB/s) \napt-listchanges: Can\'t set locale; make sure $LC_* and $LANG are correct!\nperl: warning: Setting locale failed.\nperl: warning: Please check that your locale settings:\n LANGUAGE = "en_GB:en_US:fr",\n LC_ALL = "en-US.UTF-8",\n LC_CTYPE = "en_US.UTF-8",\n LC_COLLATE = "en_US.UTF-8",\n LC_MESSAGES = "en_US.UTF-8",\n LANG = "fr_FR.UTF-8"\n are supported and installed on your system.\nperl: warning: Falling back to a fallback locale ("fr_FR.UTF-8").\nlocale: Cannot set LC_CTYPE to default locale: No such file or directory\nlocale: Cannot set LC_MESSAGES to default locale: No such file or directory\nlocale: Cannot set LC_ALL to default locale: No such file or directory\nSelecting previously unselected package locales-all.\n(Reading database ... 182206 files and directories currently installed.)\nPreparing to unpack .../locales-all_2.31-13+deb11u2_amd64.deb ...\nUnpacking locales-all (2.31-13+deb11u2) ...\nSetting up locales-all (2.31-13+deb11u2) ...\nRun Code Online (Sandbox Code Playgroud)\nenv重新安装后的打印locales执行:sudo apt-get remove locale,然后sudo apt-get install -y locales然后env:
locale: Cannot set LC_CTYPE to default locale: No such file or directory\nlocale: Cannot set LC_MESSAGES to default locale: No such file or directory\nlocale: Cannot set LC_COLLATE to default locale: No such file or directory\n...\nRun Code Online (Sandbox Code Playgroud)\n