linux Grub中文出现乱码的原因和解决办法

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/chenyiyue/article/details/51064987

我使用的是Xubuntu 16.04, 把系统语言设置为中文之后update-grub之后发现开机的时候的引导项的中文都显示成了乱码,究其原因,发现
以下文档中提到:
https://www.gnu.org/software/grub/manual/html_node/lang.html

13.1.12 lang

If this variable is set, it names the language code that the gettext command (see gettext) uses to translate strings. For example, French would be named as ‘fr’, and Simplified Chinese as ‘zh_CN’.

grub-mkconfig (see Simple configuration) will try to set a reasonable default for this variable based on the system locale.

https://www.gnu.org/software/grub/manual/html_node/gettext.html#gettext

14.3.16 gettext

Command: gettext string
Translate string into the current language.

The current language code is stored in the ‘lang’ variable in GRUB’s environment (see lang). Translation files in MO format are read from ‘locale_dir’ (see locale_dir), usually /boot/grub/locale.

而我发现我的/boot/grub/locale目录里面是空的,没有编码文件,恐怕这是问题原因,现在我

sudo gedit /etc/grub.d/00_header

把其中的grub_lang=echo $LANG | cut -d . -f 1 注释掉,
然后
sudo update-grub
更新grub,
现在重新启动,看一下问题应该解决了!

展开阅读全文

没有更多推荐了,返回首页