很多linux用户有如此一个惨痛经历。当你和平常一样登陆和输入这可爱的startx时,你只是接收到错误信息。

Many of us gnu/linux users have had such a terrible experience. When you

很多linux用户有如此一个惨痛经历。当你

login and type the sweet startx as usual, you only receive scrolling lines

和平常一样登陆和输入这可爱的startx时,你只是接收到

of error messages. One copy of the error message is usually stored in

错误信息。错误通常存储在

/var/log/XFree86.0.log. If you can access the log file, you will notice

/var/log/XFree86.0.log。如果你读取这个日志文件,你将会注意到

the last lines of the file may look like this:

文件的最后一行通常如这样:

Could not init font path element unix/:7100, removing from list!

Fatal server error:

could not open default font 'fixed'

I have to admit that I was in panic when I saw this message in the first

我不得不承认我感到恐慌当我最初几次看到这些信息。

several times. As an intermediate user of linux system, I was not so

作为一个中级的linux系统用户,我感到用命令控制台拨号和用lynx冲浪不

comfortable using text console for modem dialup and surfing with lynx. So

舒服冲浪。所以

I had to spend a lot of time on another box and use Google to search for

我不得不花费很多时间在另一台电脑的使用Google在网上搜索帮助。

help on web. It was amazing that so many people like me have this exact

另人感到意外的是如此多人像我一样拥有如此

terrible experience and those replies in web forums and mailing lists

恐怖的经历和那些网上论坛和邮件列表的答复

generally offer more sympathy than real help. Using our common sense and

一般提供更多的同情心而不是真正的帮助。用我们一般的理解和

some research, most of us can figure out this failure has something to do

研究,我们大部分可以判断这是X字体服务的失败。

with X font server.

After having done a little more research, now I believe that this failure

做完进一步的研究之后,我现在相信这

may not be so serious as it looks. Please follow me by doing the steps

不像人们想象中的那么严重。请跟着我做下面的这些步骤,

below, in most of the cases you will get your X windows starting up again.

在大部分的案例中你将可以重新进入X windows。

Note: The following examples run on my Red Hat box. But I believe they are

注意:这些例子在我的Red Hat系统上。但我相信他们

general enough to be used for other distributions.

通常足够应用在其它发行版上。

1. Check if the X font server is running.

1、检查X字体服务是否正在运行。

Some people like me tend to suspect it is caused by bugs in the X font

一些人像我一样趋向于怀疑这是由X字体服务的bugs引起的,

server, but it turned out that X font server is quite robust. We can run

但它证明这X字体服务是良好的。我们可以运行

the xfs script under /etc/init.d to see if the font server is running.

这xfs格本文件夹在/etc/init.d去看是否字体服务正在运行。

[root@localhost /root]# /etc/init.d/xfs status

xfs (pid 1385) is running...

In some cases, the only reason for the failure is that the font server is

在一些案例,唯一失败的原因是字体服务停止

dead. So, you need to restart font server like this:

所以,你需要重新启动字体服务象这样:

[root@localhost /root]# /etc/init.d/xfs start

Starting xfs: [ OK ]

Well, my learned lesson is don't take this '[OK]' for granted. You have to

好,我的学习课程不承认OK是真的。你必须

check the status again to see if it is running. If it does run, you can

再次检查状况去看看是否正在运行。如果它不运行,你可以尝试

try startx to see if you can start X windows. If you still cannot start X

startx去看看是否可以开始X windows。当字体服务运行时,如果你仍然不可以运行X

server when the font server runs, it means you are having more serious

服务,它意味着你拥有更严重的错误。

trouble. You need to waste a little more time reading on the following

你需要花费更多的一点时间阅读以下的步骤。

steps.

Note: In a weird case, my root partition was fully filled by two huge log

注意:在一个古怪的案例,我的根目录是被两个大于2GB的信息文件所占据满的。

files occupying more than 2 GB. The font server dies when it cannot write

当它不可能写进/tmp字体服务停止。

to /tmp. So the simple solution was finding the huge files and deleting

因此一些例子的解决办法是寻找巨大文件的删除掉他们。

them.

2. Check if the font 'fixed' is accessible.

检查是否字体“fixed”可以理解的。

Now it is time to ensure that the font 'fixed' is accessible. First, we

现在是时侯确保字体“fixed”是受影响的。首先

can use command fslsfonts to see if font 'fixed' exists in the search

我们可以运行命令fslsfonts去看是否字体存在在所寻找的路径:

path:

[root@localhost alex]# fslsfonts -server unix/:7100 -ll -fn fixed

DIR MIN MAX EXIST DFLT ASC DESC NAME

--> 0 255 some 0 11 2 fixed

FONTNAME_REGISTRY

FOUNDRY Misc

FAMILY_NAME Fixed

WEIGHT_NAME Medium

SLANT R

SETWIDTH_NAME SemiCondensed

ADD_STYLE_NAME

PIXEL_SIZE 13

POINT_SIZE 120

RESOLUTION_X 75

RESOLUTION_Y 75

SPACING C

AVERAGE_WIDTH 60

CHARSET_REGISTRY ISO8859

CHARSET_ENCODING 1

COPYRIGHT Public domain font. Share and enjoy.

CAP_HEIGHT 9

X_HEIGHT 6

FONT -Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO8859-1

WEIGHT 10

RESOLUTION 103

QUAD_WIDTH 6

This is the normal output when 'fixed' is available. Here, we can see that

当“fixed”是可用的,这是通常输出的情况,我们可以看到

'fixed' is actually an alias for the font

“fixed”实际上是字体的别名。

'-Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO8859-1'. If

there is no font 'fixed', we first need to gain knowledge of the search

如果不是字体“fixed”,我们首先需要获得更多的信息在字体的所在路径。

path for fonts. We can use command chkfontpath to look at those paths:

我们可以运用命令chkfontpath去看那些路径:

[root@localhost alex]# /usr/sbin/chkfontpath

Current directories in font path:

1: /usr/X11R6/lib/X11/fonts/misc:unscaled

2: /usr/X11R6/lib/X11/fonts/75dpi:unscaled

3: /usr/X11R6/lib/X11/fonts/100dpi:unscaled

4: /usr/X11R6/lib/X11/fonts/misc

5: /usr/X11R6/lib/X11/fonts/Type1

6: /usr/X11R6/lib/X11/fonts/Speedo

7: /usr/X11R6/lib/X11/fonts/CID

8: /usr/X11R6/lib/X11/fonts/75dpi

9: /usr/X11R6/lib/X11/fonts/100dpi

10: /usr/share/fonts/default/Type1

11: /usr/share/fonts/default/TrueType

12: /usr/share/fonts/ja/TrueType

13: /usr/X11R6/lib/X11/fonts/latin2/100dpi:unscaled

14: /usr/X11R6/lib/X11/fonts/latin2/100dpi

15: /usr/share/fonts/ISO8859-7/misc:unscaled

16: /usr/share/fonts/ISO8859-7/75dpi:unscaled

17: /usr/share/fonts/ISO8859-7/100dpi:unscaled

18: /usr/share/fonts/ISO8859-7/misc

19: /usr/share/fonts/ISO8859-7/Type1

20: /usr/share/fonts/ISO8859-7/75dpi

21: /usr/share/fonts/ISO8859-7/100dpi

22: /usr/share/fonts/ISO8859-9/misc:unscaled

23: /usr/share/fonts/ISO8859-9/100dpi:unscaled

24: /usr/share/fonts/ISO8859-9/misc

25: /usr/share/fonts/ISO8859-9/100dpi

26: /usr/share/fonts/KOI8-R/100dpi:unscaled

27: /usr/share/fonts/KOI8-R/100dpi

28: /usr/share/fonts/zh_CN/TrueType

29: /usr/share/fonts/zh_TW/TrueType

30: /usr/share/AbiSuite/fonts

These are the font paths on my box. It shows that xfs looks into these

这些字体路径在我的电脑上。它显示当它被修复的时候xfs观察这些路径寻找一个特殊的字体。

paths seeking a specific font when it is required. There are two types of

有两种类型的重要文件:

important files: fonts.dir in each of these paths, and fonts.alias in some

fonts.dir在每一个路径中,和fonts.alias在一些路径中。

of the paths. For example, let's go to /usr/X11R6/lib/X11/fonts/100dpi,

例如,让我们进入/usr/X11R6/lib/X11/fonts/100dpi,

and open the files. The files look like this:

和打开文件。文件象这样:

[fonts.dir]

775

UTI___14.pcf.gz -adobe-utopia-regular-i-normal--19-140-100-100-p-104-iso10646-1

UTBI__14.pcf.gz -adobe-utopia-bold-i-normal--19-140-100-100-p-109-iso10646-1

UTI___12.pcf.gz -adobe-utopia-regular-i-normal--17-120-100-100-p-89-iso10646-1

UTI___24.pcf.gz -adobe-utopia-regular-i-normal--33-240-100-100-p-179-iso10646-1

courO08.pcf.gz -adobe-courier-medium-o-normal--11-80-100-100-m-60-iso10646-1

UTBI__12.pcf.gz -adobe-utopia-bold-i-normal--17-120-100-100-p-93-iso10646-1

...

The first line specifies the number of fonts under current directory.

这第一行详细说明字体的数量在当前目录。

Following lines map file names to font names.

以下几行是字体文件的名字。

[fonts.alias]

lucidasans-bolditalic-8 -b&h-lucida-bold-i-normal-sans-11-80-100-100-p-69-iso8859-1

lucidasans-bolditalic-10 -b&h-lucida-bold-i-normal-sans-14-100-100-100-p-90-iso8859-1

lucidasans-bolditalic-12 -b&h-lucida-bold-i-normal-sans-17-120-100-100-p-108-iso8859-1

lucidasans-bolditalic-14 -b&h-lucida-bold-i-normal-sans-20-140-100-100-p-127-iso8859-1

lucidasans-bolditalic-18 -b&h-lucida-bold-i-normal-sans-25-180-100-100-p-159-iso8859-1

lucidasans-bolditalic-24 -b&h-lucida-bold-i-normal-sans-34-240-100-100-p-215-iso8859-1

...

This file maps font alias to font names. So it is clear that once font

这个文件显示字体文件的别名与原名。因此清楚知道从前字体的“fixed”是需要的,

'fixed' is needed, the font server search fonts.alias in each font path

字体服务在比赛中寻找字体别名在每一字体路径中。

for a match. If the match exists, the corresponding font file is specified

如果比赛是存在,那相应的字体文件是指定在fonts.dir。

in fonts.dir. If no match exists, which is a rare situation, the X server

如果比赛不存在,那是非常罕见的情形,字体服务不可以运行我们需要重建字体列表。

cannot start and we need to rebuild the font lists. The rebuilding process

这重建的过程

will generate new fonts.dir and fonts.alias files.

将会产生新的fonts.dir和fonts.alias文件。

3. Rebuild font list.

重建字体列表。

Font list can be rebuilt using the script file xfs under /etc/init.d.

运用格本文件xfs在/etc/init.d下,字体列表可以被重建

Following is an excerpt of the script:

以下是格本文件的摘录:

...

buildfontlist() {

pushd . &> /dev/null

for d in $(/usr/sbin/chkfontpath --list | cut -f 2 -d ':') ;do

if [ -d "$d" ]; then

cd $d

# Check if we need to rerun mkfontdir

NEEDED=no

if ! [ -e fonts.dir ]; then

NEEDED=yes

elif [ "$(find . -type f -cnewer fonts.dir 2>/dev/null)" != "" ];then

NEEDED=yes

fi

if [ "$NEEDED" = "yes" ]; then

...

}

...

start() {

if [ -L /usr/X11R6/bin/X ]; then

echo -n $"Starting $prog: "

[ -x /usr/sbin/chkfontpath ] && buildfontlist

rm -fr /tmp/.font-unix

daemon xfs -droppriv -daemon

ret=$?

[ $ret -eq 0 ] && touch /var/lock/subsys/xfs

echo

return $ret

fi

}

...

For readers not familiar with shell programming, this excerpt means that

因为读者不熟悉运行命令程序,这格本文件的意思是每次xfs格本在运行,

each time xfs script is run, it will check whether there is a fonts.dir

它将会检查是否有fonts.dir在列表中的每一个字本路径中。

file in each listed font path. If fonts.dir is missing in a path, font

当fonts.dir在路径中消失,字体列表需要重建。

list needs to be rebuilt. If a fonts.dir does exist for each path, it will

如果fonts.dir不存在于每一路径中,它将会

check if the status of any file in the font directory is changed after the

检查是否所有文件在字体目录是被改变在fonts.dir最后一次改变。

last change of fonts.dir. If this is true, the font list also needs to be

如果这是真实的,字体列表也需要被重建。

rebuilt.

For newbies not interested in learning shell programming, we play a small

作为网络新手是对学习命令不感兴趣的,我们玩一个小窍门在子程序buildfontlist()。

trick in the subroutine buildfontlist(). We can set "NEEDED=yes" in the

我们可以设置"NEEDED=yes" 在第一情况下强制重建字体列表。

first instance to force the rebuilding of font list.

4. Fonts really missing?

字体确实不见了?

If all steps above fail. My last suggestion is to check if the font file

如果以上所有的步骤都失败了。我的最后一个意见书是检查是否字体文件

is really removed by some processes. Then you need to reinstall the font.

真正地被一些程序删去。然后你们需要重新设置字体.'

linux startx无效_startx启动图形界面失败的几个解决方法相关推荐

  1. linux startx无效_startx启动失败的几个解决方法

    很多linux用户有如此一个惨痛经历.当你和平常一样登陆和输入这可爱的startx时,你只是接收到错误信息. Many of us gnu/linux users have had such a te ...

  2. Linux服务器init 5启动图形界面,报错Retrigger failed udev events的解决方法

    1.开启linux系统的桌面环境,使用startx未成功,报如下错误: 提示:Retrigger failed udev events [root@5201351 /]# startx xauth: ...

  3. linux startx无效_startx命令_Linux startx 命令用法详解:用来启动X Window

    startx命令用来启动X Window,实际上启动X Window的程序为xinit. 语法startx(参数) 参数客户端及选项:X客户端及选项: 服务器及选项:X服务器及选项. 实例 要在工作站 ...

  4. CentOS7.6安装图形界面失败,startx执行失败

    网上关于CentOS7使用startx命令启动图形界面失败的帖子很多,不过找了一天也没解决我的问题,于是把自己掉坑过程复述一下,然后有爬出来的过程,如果有相似经历的同学可以参考看看能不能爬出坑. 1. ...

  5. 虚拟机安装Linux没有图形界面,虚拟机安装linux后显示不出图形界面,是什么原因?...

    虚拟机安装linux后显示不出图形界面,是什么原因? 用root和密码登陆后出现[root@localhost tmp]# 按照mount -t iso9660 /dev/cdrom /mnt (加载 ...

  6. centos运行java图形化界面_CentOS设置默认启动命令行(不启动图形界面)

    CentOS中如何进入图形界面和文字界面,Linux真正的服务器是不会运行图形化界面的,怎么样才能在不卸载桌面的前提下开机直接进入命令界面呢?(我安装的是CentOS 6.5)下面就简单介绍以下: 一 ...

  7. linux装nvidia驱动没有图形界面,[转]Fedora 13下安装Nvidia显卡驱动的方法/Linux无法进入X Windows 图形界面的解决方法...

    再试一试这个方法:[转自]http://www.myexception.cn/image/505352.html VirtualBox3.1.2安装Fedora12后无法启动图形界面问题 Virtua ...

  8. linux8如何开启多个桌面,CentOS8安装GNOME3桌面并设置开机启动图形界面

    原标题:CentOS8安装GNOME3桌面并设置开机启动图形界面 本篇文章介绍如何在CentOS8 Linux操作系统中安装GNOME3桌面环境和GDM(GNOME Display Manager)现 ...

  9. qt 历史记录控件_基于Qt图形界面软件的操作日志记录方法及系统_2015106293015_说明书_专利查询_专利网_钻瓜专利网...

    技术领域 本发明涉及一种软件系统的日志记录技术,特别涉及一种基于Qt图形界面软件的操作日志记录方法及系统. 背景技术 软件操作日志是记录用户在使用软件的过程中,通过鼠标和键盘在操作界面上执行的点击和输 ...

最新文章

  1. jsp 环境配置记录
  2. Spring+SpringMvc+Hibernate 框架搭建
  3. 5G NGC — CAPIF 网络能力开放框架
  4. numpy and pandas
  5. 岗位推荐 | 百度视觉技术部招聘移动端视觉算法工程师
  6. POI LastRowNum and PhysicalNumberOfRows
  7. 协调多个对象之间的交互——中介者模式
  8. MATLAB三维散点图的绘制(scatter3、plot3),同时标明序号
  9. DOM克隆操作(深克隆/浅克隆)
  10. nginx 403 Forbidden
  11. chrome提示安装unity web player
  12. mysql集群解决方案mysql复制原理
  13. 基于voidAR实现增强现实之初音未来
  14. LearnOpenGL 模型加载—Assimp
  15. 蓝桥杯 18总决赛 A2 方阵阅兵(暴力)
  16. java上传文件夹文件
  17. xxx was compiled with optimization - stepping may behave oddly; variables may not be available.
  18. 20款对设计师非常有用的在线配色工具
  19. sunday 算法python实现
  20. 基于gh60设计的新配列机械键盘K68

热门文章

  1. 2022中山大学计算机考研专硕初试经验分享
  2. 你知道视频怎么去水印吗?试试这三个方法学会怎么去视频水印
  3. 开源录屏软件Captura安装和使用
  4. 网易企业邮箱注册后,管理员怎么管理邮箱?
  5. 什么是甘特图?怎么做甘特图?
  6. 2021小米笔记本pro14和小新pro14有什么区别 哪个好详细性能配置对比
  7. 网站微信扫码授权登录
  8. Python手册(Machine Learning)--statsmodels(列联表和多重插补)
  9. c++基础学习:输入cin、输出cout、换行endl
  10. 【Reinforcement Learning】蒙特卡洛算法