Debian 11 区域设置问题:没有这样的文件或目录

nko*_*hvt 6 debian locale

我在 Debian bullseye (v11) 中遇到的问题:

\n

如果我执行locale -a,我会得到以下输出:

\n
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\n
Run Code Online (Sandbox Code Playgroud)\n

另外,如果我尝试使用tlmgr(LateX 的包管理器),我会得到以下信息:

\n
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.\n
Run Code Online (Sandbox Code Playgroud)\n

我搜索了该问题,并尝试了以下操作:

\n
    \n
  • dpkg-reconfigure locales并仅选择使用的区域设置(fr utf8、en-us utf8 和 en-gb utf8)
  • \n
  • dpkg-reconfigure locales并选择所有区域设置(如上所示)
  • \n
  • locale-gen
  • \n
  • 每次更改后重新启动电脑
  • \n
  • 编辑/etc/default/locale
  • \n
\n

更多信息

\n

cat /etc/default/locale给出:

\n
#  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\n
Run Code Online (Sandbox Code Playgroud)\n

ls /usr/share/locale/en给出:

\n
#  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\n
Run Code Online (Sandbox Code Playgroud)\n

ls /usr/share/locale/en/LC_MESSAGES给出:

\n
LC_MESSAGES\n
Run Code Online (Sandbox Code Playgroud)\n

问题

\n
    \n
  • 我应该重新配置区域设置并仅选择使用的区域设置吗?
  • \n
  • 错误消息表明它需要不存在的文件/文件夹。该文件/文件夹应该位于哪里?在/usr/share/locale/en
  • \n
  • 如何解决这个问题(非阻塞,因为所有应用程序似乎都可以工作,但很烦人)?
  • \n
\n

如果您有建议阅读文档以更深入地了解这个问题,我也会听取您的建议。

\n

谢谢。

\n

编辑

\n

来自@St\xc3\xa9phaneChazelas 的问题

\n

输出locale

\n
accounts-service.mo  gtk30-properties.mo  iso_3166-2.mo  kcoreaddons5_qt.qm  kwidgetsaddons5_qt.qm\ncups-pk-helper.mo    gtk30.mo\n
Run Code Online (Sandbox Code Playgroud)\n

输出strace locale 2>&1 | grep ENOENT

\n
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\n
Run Code Online (Sandbox Code Playgroud)\n

ls /usr/lib/locale给出:

\n
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)\n
Run Code Online (Sandbox Code Playgroud)\n

奇怪的 dpkg-reconfigure locales 输出

\n

如果我没记错的话,dpkg-reconfigure locales应该列出语言环境,并为每个语言环境说“最新”(如果已经生成)。但就我而言,它重新处理每个区域设置并说“完成”:

\n
C.UTF-8\nlocale-archive\n
Run Code Online (Sandbox Code Playgroud)\n

@K-att- 提出的问题

\n

dpkg -l | grep "language-pack"不返回任何内容。

\n

来自@ThatsWhatSheCoded 的问题

\n

sudo apt-get install -y locales locales-all:

\n
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  ...\n
Run Code Online (Sandbox Code Playgroud)\n

重启后,locale -a仍然给出:

\n
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) ...\n
Run Code Online (Sandbox Code Playgroud)\n

env重新安装后的打印locales

\n

执行:sudo apt-get remove locale,然后sudo apt-get install -y locales然后env

\n
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...\n
Run Code Online (Sandbox Code Playgroud)\n

GAD*_*D3R 2

export LANGUAGE=en_GB:en_US:fr从你的.bashrcthen run 中删除dpkg-reconfigure locales