341 lines
12 KiB
HTML
341 lines
12 KiB
HTML
<!--startcut ==============================================-->
|
|
<!-- *** BEGIN HTML header *** -->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML><HEAD>
|
|
<title>A common case of startx/xinit failure LG #93</title>
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
|
|
ALINK="#FF0000">
|
|
<!-- *** END HTML header *** -->
|
|
|
|
<!-- *** BEGIN navbar *** -->
|
|
<A HREF="lechnyr.html"><< Prev</A> | <A HREF="index.html">TOC</A> | <A HREF="../index.html">Front Page</A> | <A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue93/yuan.html">Talkback</A> | <A HREF="../faq/index.html">FAQ</A> | <A HREF="wilson.html">Next >></A>
|
|
<!-- *** END navbar *** -->
|
|
|
|
<!--endcut ============================================================-->
|
|
|
|
<TABLE BORDER><TR><TD WIDTH="200">
|
|
<A HREF="http://www.linuxgazette.com/">
|
|
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
|
|
WIDTH="200" HEIGHT="41" border="0"></A>
|
|
<BR CLEAR="all">
|
|
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
|
|
</TD><TD WIDTH="380">
|
|
|
|
|
|
<CENTER>
|
|
<BIG><BIG><STRONG><FONT COLOR="maroon">A common case of startx/xinit failure</FONT></STRONG></BIG></BIG>
|
|
<BR>
|
|
<STRONG>By <A HREF="../authors/yuan.html">Yufei Yuan</A></STRONG>
|
|
</CENTER>
|
|
|
|
</TD></TR>
|
|
</TABLE>
|
|
<P>
|
|
|
|
<!-- END header -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
|
|
<html>
|
|
<body>
|
|
|
|
<p>
|
|
Many of us gnu/linux users have had such a terrible experience. When you
|
|
login and type the sweet <b>startx</b> as usual, you only receive scrolling lines 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
|
|
the last lines of the file may look like this:
|
|
</p>
|
|
|
|
<p>
|
|
<pre><small>
|
|
Could not init font path element unix/:7100, removing from list!
|
|
|
|
Fatal server error:
|
|
could not open default font 'fixed'
|
|
</small></pre>
|
|
</p>
|
|
|
|
<p>
|
|
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 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 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 with X font server.
|
|
</p>
|
|
|
|
<p>
|
|
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.
|
|
</p>
|
|
|
|
<p>
|
|
<b>Note:</b> The following examples run on my Red Hat box. But I believe they are general enough to be used for other distributions.
|
|
</p>
|
|
|
|
<br><p><b> 1. Check if the X font server is running. </b></p>
|
|
<p>
|
|
Some people like me tend to suspect it is caused by bugs in the X font
|
|
server, but it turned out that X font server is quite robust. We can run
|
|
the <b>xfs</b> script under /etc/init.d to see if the font server is running.
|
|
</p>
|
|
|
|
<p>
|
|
<pre><small>
|
|
[root@localhost /root]# /etc/init.d/xfs status
|
|
xfs (pid 1385) is running...
|
|
</small></pre>
|
|
</p>
|
|
|
|
<p>
|
|
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:
|
|
</p>
|
|
|
|
<p>
|
|
<pre><small>
|
|
[root@localhost /root]# /etc/init.d/xfs start
|
|
Starting xfs: [ OK ]
|
|
</small></pre>
|
|
</p>
|
|
|
|
<p>
|
|
Well, my learned lesson is don't take this '[OK]' for granted. You have
|
|
to check the status again to see if it is running. If it does run, you can
|
|
try <b>startx</b> to see if you can start X windows. If you still cannot
|
|
start 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. </p>
|
|
|
|
<p>
|
|
<b>Note:</b> In a weird case, my root partition was fully filled by two huge
|
|
log files occupying more than 2 GB. The font server dies when it cannot write
|
|
to /tmp. So the simple solution was finding the huge files and deleting
|
|
them.
|
|
</p>
|
|
|
|
<br><p><b> 2. Check if the font 'fixed' is accessible. </b></p>
|
|
<p>
|
|
Now it is time to ensure that the font 'fixed' is accessible. First, we can use command <b>fslsfonts</b> to see if font 'fixed' exists in the search path:
|
|
</p>
|
|
|
|
<p>
|
|
<pre><small>
|
|
[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
|
|
</small></pre>
|
|
</p>
|
|
|
|
<p>
|
|
This is the normal output when 'fixed' is available. Here, we can see that 'fixed' is actually an alias for the font '-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 path for fonts. We can use command <b>chkfontpath</b> to look at those paths:
|
|
</p>
|
|
|
|
<p>
|
|
<pre><small>
|
|
[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
|
|
</small></pre>
|
|
</p>
|
|
|
|
<p>
|
|
These are the font paths on my box. It shows that xfs looks into these
|
|
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 of the paths. For example, let's go to /usr/X11R6/lib/X11/fonts/100dpi, and open the files. The files look like this:
|
|
</p>
|
|
|
|
<p>
|
|
<pre><small>
|
|
[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
|
|
...
|
|
</small></pre>
|
|
</p>
|
|
|
|
<p>
|
|
The first line specifies the number of fonts under current directory. Following lines map file names to font names.
|
|
</p>
|
|
|
|
<p>
|
|
<pre><small>
|
|
[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
|
|
...
|
|
</small></pre>
|
|
</p>
|
|
|
|
<p>
|
|
This file maps font alias to font names. So it is clear that once font '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 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.
|
|
</p>
|
|
|
|
<br><p><b> 3. Rebuild font list. </b></p>
|
|
<p>
|
|
Font list can be rebuilt using the script file <b>xfs</b> under /etc/init.d. Following is an excerpt of the script:
|
|
</p>
|
|
|
|
<p>
|
|
<pre><small>
|
|
...
|
|
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
|
|
}
|
|
...
|
|
</small></pre>
|
|
</p>
|
|
|
|
<p>
|
|
For readers not familiar with shell programming, this excerpt means that each time <b>xfs</b> script is run, it will check whether there is a fonts.dir file in each listed font path. If fonts.dir is missing in a path, font list needs to be rebuilt. If a fonts.dir does exist for each path, it will check if the status of any file in the font directory is changed after the last change of fonts.dir. If this is true, the font list also needs to be rebuilt.
|
|
</p>
|
|
|
|
<p>
|
|
For newbies not interested in learning shell programming, we play a small trick in the subroutine buildfontlist(). We can set "NEEDED=yes" in the first instance to force the rebuilding of font list.
|
|
</p>
|
|
|
|
<br><p><b> 4. Fonts really missing? </b></p>
|
|
<p>
|
|
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.
|
|
</p>
|
|
|
|
</body>
|
|
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- *** BEGIN author bio *** -->
|
|
<P>
|
|
<P>
|
|
<!-- *** BEGIN bio *** -->
|
|
<P>
|
|
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
|
|
<em>
|
|
Yufei is a graduate student in the University of Alberta. He uses GNU/linux for work and for fun. He develops image and video compression algorithms on GNU/Linux for his research project. His RH9 box@home has a Conexant HSF winmodem, which works pretty well for browsing the Web and listening to streamed audio.
|
|
</em>
|
|
<br CLEAR="all">
|
|
<!-- *** END bio *** -->
|
|
|
|
<!-- *** END author bio *** -->
|
|
|
|
|
|
<!-- *** BEGIN copyright *** -->
|
|
<hr>
|
|
<CENTER><SMALL><STRONG>
|
|
Copyright © 2003, Yufei Yuan.
|
|
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
|
Published in Issue 93 of <i>Linux Gazette</i>, August 2003
|
|
</STRONG></SMALL></CENTER>
|
|
<!-- *** END copyright *** -->
|
|
<HR>
|
|
|
|
<!--startcut ==========================================================-->
|
|
<CENTER>
|
|
<!-- *** BEGIN navbar *** -->
|
|
<A HREF="lechnyr.html"><< Prev</A> | <A HREF="index.html">TOC</A> | <A HREF="../index.html">Front Page</A> | <A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue93/yuan.html">Talkback</A> | <A HREF="../faq/index.html">FAQ</A> | <A HREF="wilson.html">Next >></A>
|
|
<!-- *** END navbar *** -->
|
|
</CENTER>
|
|
</BODY></HTML>
|
|
<!--endcut ============================================================-->
|