LTSP - How To Enable X Font Server in Mandrake

John P. New

jnew at hazelden dot ca
              

Revision History
Revision 1.0.02004-March-20 Revised by: John P. New

This document describes how to enable XFS for an LTSP environment running on a Mandrake server, but it should be applicable, with modifications, on any distribution.



Table of Contents

Introduction 1. Enabling the X Font Server Footnotes

Introduction

X Font Server (XFS) has been used to serve fonts to X since Mandrake 6.0. However, the default configuration does not allow XFS to serve fonts to LTSP workstations over a network. This document describes how to enable XFS for an LTSP environment running on a Mandrake server, but it should be applicable, with modifications, on any distribution.


1. Disclaimer

Neither the author nor the distributors, or any other contributor of this document are in any way responsible for physical, financial, moral or any other type of damage incurred by following the suggestions in this text.


2. Copyright and License

This document is copyright 2004 by John P. New, and is released under the terms of the GNU Free Documentation License, which can be found at http://www.gnu.org/licenses/fdl.html.


1. Enabling the X Font Server

The X Font Server (XFS) provides system fonts to X display servers. It is the only way to provide anti-aliased fonts such as freetype to most X Terminals. [1]

In Mandrake, as in most Linux systems, XFS is started from a script in /etc/init.d, and/or on startup from one or more scripts, /etc rc.d/init.d or in one of the run-level initialization scripts in /etc/rc[0-6].d. The most important thing to verify is that the X Terminal and the X Host are broadcasting and listening on the same port.

Essentially, the process involves

  1. Configuring XFS by changing configuration files.
  2. Restarting XFS on the server.
  3. Restarting the workstations.

1.1. Configuring XFS

In a normal Mandrake installation, XFS is not configured to serve fonts across a network. In order to allow this, four files must be modified:
  1. /etc/X11/XF86Config-4
  2. /etc/rc.d/init.d/xfs
  3. /etc/X11/fs/config
  4. /opt/ltsp/i386/etc/lts.conf

1.1.1 /etc/X11/XF86Config-4

This file controls the X session that is started on the server.If you will not be launching an X session on the server then modifying this file is optional. However, if you do not modify the X configuration files and try to start an X session on the server, the X session will fail because it will not be able to connect to XFS.

It is important to choose the right configuration file: XFree86 version 4.x uses the XF86Config-4 file, while XFree86 3.x and below uses XF86Config. in the "Files" section, comment out the existing line beginning with FontPath, and add a new one:

Section "Files"
    # Multiple FontPath entries are allowed (they are concatenated together)
    # By default, Mandrake 6.0 and later now use a font server independent of
    # the X server to render fonts.
#   FontPath "unix/:-1"
    FontPath "tcp/localhost:7100"
EndSection

Figure 1-1. /etc/X11/XF86Config-4

This change allows the X Server to open TCP port :7100 that will allow it to communicate with XFS. Thus, when you are logged in at the server in a graphical environment, your X session will be able to pick up the fonts from XFS.


1.1.2 /etc/rc.d/init.d/xfs

This is the initialization script that init.d uses to start XFS. Two lines need to be modified. In the start) section, comment out the existing line beginning with daemon, and add a new one:

start)
    gprintf "Starting X Font Server: "
    mkdir -p /tmp
    chmod a+w,+t /tmp
    rm -fr /tmp/.font-unix
#   daemon --check xfs xfs -port -1 -daemon -droppriv -user xfs
    daemon --check xfs xfs -port 7100 -daemon -droppriv -user xfs
    touch /var/lock/subsys/xfs
    echo
    ;;

Figure 1-2. /etc/rc.d/init.d/xfs

Next, in the restart) section, comment out the existing line beginning with daemon, and add a new one:

restart)
    gprintf "Restarting X Font Server. "
    if [ -f /var/lock/subsys/xfs ]; then
        killproc xfs -USR1
    else
        rm -fr /tmp/.font-unix
#       daemon --check xfs su xfs -c \"xfs -port -1\" -s /bin/sh
        daemon --check xfs su xfs -c \"xfs -port 7100\" -s /bin/sh
        touch /var/lock/subsys/xfs
    fi
    echo
    ;;

Figure 1-3. /etc/rc.d/init.d/xfs

These two changes tell XFS, when it is started or restarted, to use TCP port :7100 to serve fonts to any X session, including those on the server and LTSP workstations.


1.1.3 /etc/X11/fs/config

This is the configuration file for XFS. By default, it is configured for security to not listen on TCP ports. However, you need to allow it to listen so that the workstations can get their fonts. Simply comment out the the no-listen = tcp line.

As well, you can set a limit to how many clients the XFS will serve (client-limit), before spawning (clone-self) a new instance of the server:

# allow a max of 10 clients to connect to this font server
client-limit = 10

# when a font server reaches its limit, start up a new one
clone-self = on

# don't listen to TCP ports by default for security reasons
#no-listen = tcp

Figure 1-4. /etc/X11/fs/config


1.1.4 /opt/ltsp/i386/etc/lts.conf

And finally, LTSP needs to now that you have XFS enabled on the server so that a proper XF86Config or XF86Config-4 file can be built for the workstations.

The script that builds the workstation's X configuration file just implements what you did in Section 1.1.1. Simply change the USE_XFS = N line to USE_NFS = Y in the [Default] section of the /opt/ltsp/i386/etc/lts.conf:

[Default]
    USE_XFS = Y

Figure 1-5. /opt/ltsp/i386/etc/lts.conf


1.2. Restart XFS

In order to implement the new configuration, restart XFS using the commands:

service xfs stop
service xfs start
or
service xfs restart
If XFS started successfully, a message will be returned saying "OK".

1.3. Restart Workstations

Restart an LTSP terminal. The terminal should now be picking up fonts from XFS. To check this, from an X terminal, either on the workstation or the server, run:

netstat -an | grep “:7100 “
You should get a response like:
tcp     0    0   0.0.0.0:7100       0.0.0.0:*            LISTEN
tcp     0    0   192.168.0.2:7100   192.168.0.3:32777    ESTABLISHED
In this case, 192.168.0.2 is the IP address of the XFS server and 192.168.0.3 is the IP address of the LTSP workstation.

Footnotes

[1] Connecting X Terminals to Linux Mini-HOWTO Chapter 4, section 5: Configuring the X Font Server