我将系统区域设置更改为en_US.UTF-8
with dpkg-reconfigure locales
。该locale
命令输出:
LANG=en_US.UTF-8
LANGUAGE=
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=
在/etc/default/locale
我有以下内容:
LANG=en_US.UTF-8
另外,/etc/locale.gen
确实仅包含en_US.UTF-8 UTF-8
.
unattended-upgrades
每天早上运行都会/etc/cron.daily/apt-compat
在我的系统日志中产生以下错误:
apt.systemd.daily[3829]: --- Logging error ---
apt.systemd.daily[3829]: Traceback (most recent call last):
apt.systemd.daily[3829]: File "/usr/lib/python3.5/logging/__init__.py", line 983, in emit
apt.systemd.daily[3829]: stream.write(msg)
apt.systemd.daily[3829]: UnicodeEncodeError: 'ascii' codec can't encode character '\xfc' in position 43: ordinal not in range(128)
apt.systemd.daily[3829]: Call stack:
apt.systemd.daily[3829]: File "/usr/bin/unattended-upgrade", line 1538, in <module>
apt.systemd.daily[3829]: main(options)
apt.systemd.daily[3829]: File "/usr/bin/unattended-upgrade", line 1219, in main
apt.systemd.daily[3829]: logging.info(_("Allowed origins are: %s"), allowed_origins)
apt.systemd.daily[3829]: Message: 'erlaubte Urspr\xfcnge sind: %s'
apt.systemd.daily[3829]: Arguments: (['origin=Debian,codename=stretch,label=Debian-Security'],)
系统尝试翻译Allowed origins are: %s
为德语版本erlaubte Ursprünge sind: %s
,其中包含一个特殊字符ü
。经过一番研究后,我发现带有翻译的文件可以在这里找到:/usr/share/locale/de/LC_MESSAGES/unattended-upgrades.mo
。
为什么apt
/unattended-upgrades
尝试将英语翻译成德语,因为我已经将语言环境更改为正确的英语值?我怎样才能阻止这种行为?
答案1
通过再次发出以下命令解决了该问题:
dpkg-reconfigure locales
localectl set-locale LANG=en_US.UTF-8 LANGUAGE=en_US:en