运行 Debian 的 Beaglebone Black 上的语言环境损坏

运行 Debian 的 Beaglebone Black 上的语言环境损坏

这一切始于我想在运行 Debian 的 Beaglebone Black 上安装自定义守护进程,update-rc.d mydaemon defaults 97就像我在 Mint 主机上开发时多次做过的那样。然后我收到了:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
   LANGUAGE = (unset),
   LC_ALL = (unset),
   LC_PAPER = "es_CL.UTF-8",
   LC_ADDRESS = "es_CL.UTF-8",
   LC_MONETARY = "es_CL.UTF-8",
   LC_NUMERIC = "es_CL.UTF-8",
   LC_TELEPHONE = "es_CL.UTF-8",
   LC_IDENTIFICATION = "es_CL.UTF-8",
   LC_MEASUREMENT = "es_CL.UTF-8",
   LC_NAME = "es_CL.UTF-8",
   LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
update-rc.d: using dependency based boot sequencing

我随后尝试修复它dpkg-reconfigure locales,它回复了

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = "es_CL.UTF-8",
    LC_ADDRESS = "es_CL.UTF-8",
    LC_MONETARY = "es_CL.UTF-8",
    LC_NUMERIC = "es_CL.UTF-8",
    LC_TELEPHONE = "es_CL.UTF-8",
    LC_IDENTIFICATION = "es_CL.UTF-8",
    LC_MEASUREMENT = "es_CL.UTF-8",
    LC_NAME = "es_CL.UTF-8",
    LANG = "en_US.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
/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)...
  en_US.ISO-8859-1...locale alias file `/usr/share/locale/locale.alias' not found: No such file or directory
 done
Generation complete.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_MONETARY = "es_CL.UTF-8",
    LC_ADDRESS = "es_CL.UTF-8",
    LC_TELEPHONE = "es_CL.UTF-8",
    LC_NAME = "es_CL.UTF-8",
    LC_MEASUREMENT = "es_CL.UTF-8",
    LC_IDENTIFICATION = "es_CL.UTF-8",
    LC_NUMERIC = "es_CL.UTF-8",
    LC_PAPER = "es_CL.UTF-8",
    LANG = "C"
     are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_MONETARY = "es_CL.UTF-8",
    LC_ADDRESS = "es_CL.UTF-8",
    LC_TELEPHONE = "es_CL.UTF-8",
    LC_NAME = "es_CL.UTF-8",
    LC_MEASUREMENT = "es_CL.UTF-8",
    LC_IDENTIFICATION = "es_CL.UTF-8",
    LC_NUMERIC = "es_CL.UTF-8",
    LC_PAPER = "es_CL.UTF-8",
    LANG = "C"
     are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

我不知道如何修复它,因为它拒绝让我安装任何软件包或更新任何东西...有人有什么想法吗?我很困惑...

我已经看到了在 Debian 上配置区域设置这对我不起作用(即source /etc/default/locale

pps 我还检查了/etc/locales.genshell 并且en_US.UTF-8 UTF-8取消了注释,因为它应该是,并且 shell 脚本建议运行locale-gen,我得到了

Generating locales (this might take a while)...
en_US.UTF-8...locale alias file `/usr/share/locale/locale.alias' not found: No such file or directory

答案1

因此,在查看了所有 Debian 手册和 BeagleBone 版本后,我终于弄清楚了发生了什么!我想把这个贴出来以防有人遇到这个问题。为了修复语言环境,我需要手动重写文件/etc/default/locale:(例如,如果您在北美,则应使用“en_US.UTF-8”)。

LANG="en_US.UTF-8"
LC_NUMERIC="es_CL.UTF-8"
LC_MONETARY="es_CL.UTF-8"
LC_PAPER="es_CL.UTF-8"
LC_NAME="es_CL.UTF-8"
LC_ADDRESS="es_CL.UTF-8"
LC_TELEPHONE="es_CL.UTF-8"
LC_MEASUREMENT="es_CL.UTF-8"
LC_IDENTIFICATION="es_CL.UTF-8"

然后您需要确保 shell 脚本中/etc/locale.gen您打算使用的所有语言环境都已取消注释,即sudo nano /etc/locale.gen

然后,您需要修复语言环境所需的符号链接,内核应该在安装时创建该链接,具体操作如下:sudo ln -s /etc/locale.alias /usr/share/locale/locale.alias

最后运行dpkg-reconfigure locales修复链接,现在一切都应该正常运行。

(附注:我后来意识到这update-rc.d是更高版本的 Debian 中的遗留工具,例如 BeagleBone black 上的工具,应该使用守护进程 shell 来安装insserv mydaemon

相关内容