centos - linux下/etc/sysconfig/i18n在系统启动时什么时候被调用的?

 手机用户2502855061 发布于 2022-11-07 17:38

我想修改centos6.5下的终端中的字体,tty下通过命令

setfont /lib/kbd/consolefonts/ter-p20b.psf.gz

成功修改了字体。于是想将其设置为终端下的默认字体。打开了/etc/sysconfig/i18n文件,将其修改为:

LANG="en_US.UTF-8"
SYSFONT="ter-p20b"

其中的SYSFONT无论设置成

SYSFONT="ter-p20b.psf.gz"

还是

SYSFONT="/lib/kbd/consolefonts/ter-p20b.psf.gz"

均在重启后没看到效果。网上找了很久,发现该网页中这样描述:

/etc/sysconfig/i18n
Controls the system font settings. The language variables are used in /etc/profile.d/lang.sh. An example i18n file:

LANG="en_US"
LC_ALL="en_US"
LINGUAS="en_US"

Options:

  • LANG= set locale for all categories, can be any two letter ISO language code.
  • LC_CTYPE= localedata configuration for classification and conversion of characters.
  • LC_COLLATE= localedata configuration for collation (sort order) of strings.
  • LC_MESSAGES= localedata configuration for translation of yes and no messages.
  • LC_NUMERIC= localedata configuration for non-monetary numeric data.
  • LC_MONETARY= localedata configuration for monetary data.
  • LC_TIME= localedata configuration for date and time.
  • LC_ALL= localedata configuration overriding all of the above.
  • LANGUAGE= can be a : separated list of ISO language codes.
  • LINGUAS= can be a ' ' separated list of ISO language codes.
  • SYSFONT= any font that is legal when used as /usr/bin/consolechars -f $SYSFONT ... (See console-tools package for consolechars command)
  • UNIMAP= any SFM (screen font map, formerly called Unicode mapping table - see consolechars(8))

    /usr/bin/consolechars -f $SYSFONT --sfm $UNIMAP

  • SYSFONTACM= any ACM (application charset map-see consolechars(8))

    /usr/bin/consolechars -f $SYSFONT --acm $SYSFONTACM

The above is used by the /sbin/setsysfont command (which is run by rc.sysinit at boot time.)

我尝试了下setsysfont命令,正确地显示了字体;但是发现系统中没有consolechars命令(yum中也没有),查看了下rc.sysinit文件,没有找到关于setsysfont或者使用i18n的语句。
但是我曾经改过1i8n中的LANG,而且在重启后tty中生效了(我改成了中文,在tty下显示的乱码),这说明系统的确启动时读取了该文件。请问系统到底是在什么时候调用的该文件,其中的SYSFONT为什么没有同时生效呢?

1 个回答
  • 纯终端 显示中文会是方块,需要给内核打补丁,并设置内核的framebuffer支持,具体可以参考1

    不打补丁可以使用fbterm来显示中文。

    setfont是修改字体而无法解决中文显示的问题。


    1. http://blog.chinaunix.net/uid/436750.html ↩

    2022-11-12 01:58 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有