Debian
Debian 11 的語言環境問題:沒有這樣的文件或目錄
我在使用 Debian Bullseye (v11) 時遇到的問題:
如果我執行
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.UTF-8 POSIX aa_DJ aa_DJ.iso88591 aa_DJ.utf8 aa_ER aa_ER.utf8 ... zh_TW zh_TW.big5 zh_TW.euctw zh_TW.utf8 zu_ZA zu_ZA.iso88591 zu_ZA.utf8
另外,如果我嘗試使用
tlmgr
(LateX 的包管理器),我會得到以下資訊:perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_US:fr:en_GB", LC_ALL = "en-US.UTF-8", LC_MESSAGES = "en_US.UTF-8", LC_CTYPE = "en_US.UTF-8", LC_COLLATE = "en_US.UTF-8", LANG = "fr_FR.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("fr_FR.UTF-8"). tlmgr: no action given; try --help if you need it.
我搜尋了這個問題,並嘗試了以下方法:
dpkg-reconfigure locales
並僅選擇使用的語言環境(fr utf8、en-us utf8 和 en-gb utf8)dpkg-reconfigure locales
並選擇所有語言環境(如上所示)locale-gen
- 每次更改都重新啟動 PC
- 編輯 /etc/default/locale
更多資訊
cat /etc/default/locale
給出:# File generated by update-locale LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
ls /usr/share/locale/en
給出:LC_MESSAGES
ls /usr/share/locale/en/LC_MESSAGES
給出:accounts-service.mo gtk30-properties.mo iso_3166-2.mo kcoreaddons5_qt.qm kwidgetsaddons5_qt.qm cups-pk-helper.mo gtk30.mo
問題
- 我應該重新配置語言環境並只選擇使用的語言環境嗎?
- 錯誤消息說它需要不存在的文件/文件夾。這個文件/文件夾應該放在哪裡?在
/usr/share/locale/en
?- 如何解決這個問題(非阻塞,因為所有應用程序似乎都可以工作,但很煩人)?
如果您有建議閱讀文件以深入了解這個問題,我也會聽到。
謝謝你。
編輯
來自@StéphaneChazelas 的問題
的輸出
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=fr_FR.UTF-8 LANGUAGE=en_US:fr:en_GB 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=en-US.UTF-8
輸出
strace locale 2>&1 | grep ENOENT
:access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en-US.UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en-US.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en-US/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en-US.UTF-8/LC_MESSAGES", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en-US.utf8/LC_MESSAGES", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en-US/LC_MESSAGES", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en-US.UTF-8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en-US.utf8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en-US/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
ls /usr/lib/locale
給出:C.UTF-8 locale-archive
奇怪的 dpkg-reconfigure locales 輸出
如果我沒記錯的話,
dpkg-reconfigure locales
應該列出語言環境並為它們中的每一個說“最新”(如果已經生成)。但就我而言,它重新處理每個語言環境並說“完成”:perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_US:fr:en_GB", LC_ALL = "en-US.UTF-8", LC_MESSAGES = "en_US.UTF-8", LC_CTYPE = "en_US.UTF-8", LC_COLLATE = "en_US.UTF-8", LANG = "fr_FR.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("fr_FR.UTF-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 /usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory /usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory /usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory Generating locales (this might take a while)... aa_DJ.UTF-8... done aa_DJ.ISO-8859-1... done aa_ER.UTF-8... done aa_ER.UTF-8@saaho... done aa_ET.UTF-8... done af_ZA.UTF-8... done af_ZA.ISO-8859-1... done agr_PE.UTF-8... done ak_GH.UTF-8... done am_ET.UTF-8... done an_ES.UTF-8... done an_ES.ISO-8859-15... done anp_IN.UTF-8... done ar_AE.UTF-8... done ar_AE.ISO-8859-6... done ar_BH.UTF-8... done ar_BH.ISO-8859-6... done ar_DZ.UTF-8... done ar_DZ.ISO-8859-6... done ar_EG.UTF-8... done ar_EG.ISO-8859-6... done ar_IN.UTF-8... done ar_IQ.UTF-8... done ...
來自@K-att-的問題
dpkg -l | grep "language-pack"
不返回任何東西。來自@ThatsWhatSheCoded 的問題
sudo apt-get install -y locales locales-all
:Reading package lists... Done Building dependency tree... Done Reading state information... Done locales is already the newest version (2.31-13+deb11u2). The following NEW packages will be installed: locales-all 0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. Need to get 10.8 MB of archives. After this operation, 227 MB of additional disk space will be used. Get:1 http://deb.debian.org/debian bullseye/main amd64 locales-all amd64 2.31-13+deb11u2 [10.8 MB] Fetched 10.8 MB in 21s (515 kB/s) apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct! perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_GB:en_US:fr", LC_ALL = "en-US.UTF-8", LC_CTYPE = "en_US.UTF-8", LC_COLLATE = "en_US.UTF-8", LC_MESSAGES = "en_US.UTF-8", LANG = "fr_FR.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("fr_FR.UTF-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 Selecting previously unselected package locales-all. (Reading database ... 182206 files and directories currently installed.) Preparing to unpack .../locales-all_2.31-13+deb11u2_amd64.deb ... Unpacking locales-all (2.31-13+deb11u2) ... Setting up locales-all (2.31-13+deb11u2) ...
重新啟動後,
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 ...
env
重裝後列印locales
執行:
sudo apt-get remove locale
,然後sudo apt-get install -y locales
,然後env
:SHELL=/bin/bash WINDOWID=79691783 QT_ACCESSIBILITY=1 KDED_STARTED_BY_KDEINIT=1 COLORTERM=truecolor XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1 LANGUAGE=en_GB:en_US:fr SSH_AUTH_SOCK=/tmp/ssh-eAB2uCmvHnDY/agent.872 SHELL_SESSION_ID=08a2a2b1e969432881e34e2775568d69 DESKTOP_SESSION=plasma SSH_AGENT_PID=911 GTK_RC_FILES=/etc/gtk/gtkrc:/home/nkoniishvt/.gtkrc:/home/nkoniishvt/.config/gtkrc XCURSOR_SIZE=24 GTK_MODULES=gail:atk-bridge XDG_SEAT=seat0 PWD=/home/nkoniishvt XDG_SESSION_DESKTOP=KDE LOGNAME=nkoniishvt XDG_SESSION_TYPE=x11 GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1 XAUTHORITY=/home/nkoniishvt/.Xauthority GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/nkoniishvt/.gtkrc-2.0:/home/nkoniishvt/.config/gtkrc-2.0 HOME=/home/nkoniishvt LANG=fr_FR.UTF-8 LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: XDG_CURRENT_DESKTOP=KDE KONSOLE_DBUS_SERVICE=:1.63 KONSOLE_DBUS_SESSION=/Sessions/1 PROFILEHOME= XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 KONSOLE_VERSION=201203 KDE_SESSION_UID=1000 XDG_SESSION_CLASS=user TERM=xterm-256color USER=nkoniishvt COLORFGBG=15;0 KDE_SESSION_VERSION=5 PAM_KWALLET5_LOGIN=/run/user/1000/kwallet5.socket DISPLAY=:0 SHLVL=1 LC_MESSAGES=en_US.UTF-8 XDG_VTNR=7 XDG_SESSION_ID=3 LC_CTYPE=en_US.UTF-8 XDG_RUNTIME_DIR=/run/user/1000 LC_ALL=en-US.UTF-8 QT_AUTO_SCREEN_SCALE_FACTOR=0 LC_COLLATE=en_US.UTF-8 XCURSOR_THEME=breeze_cursors KDE_FULL_SESSION=true PATH=/home/nkoniishvt/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus KDE_APPLICATIONS_AS_SCOPE=1 KONSOLE_DBUS_WINDOW=/Windows/1 _=/usr/bin/env
export LANGUAGE=en_GB:en_US:fr
從您的.bashrc
then 執行中刪除dpkg-reconfigure locales
。