Ubuntu 区域设置无效:没有这样的文件或目录

Ubuntu 区域设置无效:没有这样的文件或目录

我已经尝试在 ubuntu 20 中设置我的语言环境(我在过去的 x 年里成功地做到了),不幸的是现在我不能因为缺少一些东西:

$ 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=hu_HU.UTF-8
LANGUAGE=hu_HU.UTF-8
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=C.UTF-8

我尝试过的:

sudo localectl set-locale LC_ALL=hu_HU.UTF-8
Failed to issue method call: Invalid Locale data.

(我也尝试过使用 c.UTF-8 相同的输出)

$ sudo update-locale
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "hu_HU.UTF-8",
    LC_ALL = "C.UTF-8",
    LANG = "hu_HU.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "hu_HU.UTF-8",
    LC_ALL = "C.UTF-8",
    LANG = "hu_HU.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
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
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline

$ sudo nano /etc/default/locale

此处编辑 LANG、LANGUAGE、LC_ALL 设置如上,没有任何效果

整个系统重启了很多次...

我做错了什么?我不关心我喜欢的区域设置,它现在应该可以更有效地工作,没有任何问题。

谢谢你的帮助。

答案1

因此,在花了这么多时间之后,我找到了解决方案:首先,从以下位置删除所有(手动)插入的配置:

sudo nano /etc/environment (delete rows)
sudo nano /etc/locale.conf (delete rows)
sudo nano /etc/default/locale

--> 在 /etc/default/locale 中更改/设置为默认值,例如。 C.UTF-8

然后(Ubuntu 20):

nano .bashrc

--> 像上面一样在这里添加您的默认值

source .bashrc
reboot

现在,不再有错误或警告消息:)

相关内容