LTSP

The Linux Terminal Server Project (website) is a collection of scripts and documentation to create a cluster of thin clients. For instance, an entire client chroot environment is built with a single command: ltsp-build-client. This article will guide you through the installation and configuration of a basic LTSP 5 system.

This guide shows you how to install and configure the Gentoo LTSP 5 port. This guide assumes some knowledge of thin client architecture and experience in manually installing Gentoo. Also, you need a server and client with the specifications listed in the LTSP manual. Concerning the client networkcard, only PXE is included in this manual.

Several resources can help you speed you on your way in time of need. Others are listed in the Resources section. For more online LTSP help, you can visit #ltsp on one of the freenode irc servers.
 * LTSP Administrator's Reference
 * LTSP upstream development page
 * LTSP mailing lists

Bugs can be reported in two locations. Check known issues before a potential duplicate.
 * Gentoo - For issues related to Gentoo
 * Upstream - For issues related to LTSP itself

Installation
Gentoo's LTSP packages are stored in the ltsp-overlay. To use the Gentoo LTSP-Overlay, get it with layman. Because ltsp resides in the git overlays, the git USE flag is needed.

In case you are using stable settings for your architecture, add the following to package.keywords.

The LTSP server package needs a tftp and dhcp server (dhcp or dnsmasq). In this tutorial atftp and dnsmasq are used. It also requires a system logger which can accept client messages over tcp. Syslog-ng is used in this tutorial. Don't forget to add a window manager, ltsp-client won't log in if no window manager is installed on the server.

Kernel
Besides the obvious drivers, the server kernel ought to have the following settings. If you're going to use NFS to serve the chroot environments, make sure to compile it in as well and reboot afterwards.

DHCP and PXE-boot
First, setup the server to provide client machines with a kernel at boottime. Install a few packages on the server. Syslinux contains pxelinux, the PXE boot loader. Dnsmasq is a simple DHCP/DNS server. Advanced TFTP is one of the TFTP server options, and the only one to support multicast TFTP.1 The chroot environments as well as the kernels served at boot time are stored in. Configure dnsmasq as a DHCP server:

Configure tftp-hpa next. This is used for the client nodes to retrieve the kernel and initrd/initramfs, before they mount their root filesystems via NFS.1

Set up the PXE boot loader next. First, link the executable into the TFTP root from where it was installed. A symlink is used so that later updates require no manual effort.1 Create the configuration directory after that and populate it with a default file. In the example configuration, the system mounts the local client disk after booting loading the kernel from the server. Make sure the kernel and initramfs are in.

You can test the work so far with a working kernel and system. The netmount configuration is given when it is installed and configured.

Start the services, now and at every boot

NFS
The NFS server providing the chroot environments can now be installed and configured. Don't forget to start the service now and at every boot.

Xinetd
Xinetd is used for ldminfod and nbd sharing. By default only the localhost is allowed access, so edit the and start the service.

Client Install
The ltsp-server package amongst others ships a command called ltsp-build-client. This command is responsible for building the entire chroot environment. And while ltsp-build-client and available plugins setup the environment, Quickstart actually builds it.

Configuration
You can invoke the build script with command line arguments or configure the config file in. Commandline options take precedence over config file options. If you encounter some problems and have to perform ltsp-build-client again, the program tells you to remove the entire chroot environment. It is recommended to first copy the downloaded stage outside the chroot and point the ltsp-build-client command to it, so it won't have to be downloaded again.

Kernel
A separate section for the client kernel is in order. A standard Genkernel kernel is created during the installation when configuration changes are made. It's advisable to take a closer look at the client's kernel config.

Building the Client
By default, the packaged quickstart profile in is used with no debug options. Another profile can be selected with command line options. The kernel config you just made can be used in the build process by adding the server vars to ltsp-build-client.conf (See in Configuration section above).

After invoking the ltsp-build-client command, the environment is preparing. For each architecture the first build takes up the most time because binary packages are created from source in the first run. These binary packages are stored in through a bind mount on your server. Any consequent builds use these packages to speed up the process.

Finishing the Install
Some things still need to be done after building the environment. First up is the kernel, which needs to be put in your tftroot. In the default setup, this is copied from the chroot in and copied to the tftproot in an ltsp subdir in,  or , if one exists. Calling ltsp-update-kernels with a different tftproot location:

Your pxelinux configuration has to be updated to reflect the changes in the setup. While you might want to use your previous kernel (if it has the necessary options), setting the nfs root is certainly needed.

Client Configuration
While some properties of the client's environment are more or less statically set in the chroot environment, others can be changed at boot time. The lts.conf file allows properties to be set for all clients or for each workstation specifically. Explaining the syntax of the file goes beyond the scope of this tutorial, but it is explained on the LTSP wiki and in the lts.conf man page. The latter is available after emerging the ltsp-docs package.

The lts.conf file is downloaded at client boot time from a preconfigured location in the tftproot, namely /ltsp/x86/lts.conf. Create your lts.conf there and change your architecture if applicable.

The script that invokes the download is. Together with it is responsible for settings like the swap configuration, sound daemon, and date among others. While ltsp-client-setup performs the environment settings, ltsp-client starts the sound daemon and the ldm login process. Some of these settings will now be discussed in detail.

System Logging
System logging is performed by sysklogd. Log files are not stored locally however, but sent to the server specified by SYSLOG_HOST in lts.conf. While executing, the ltsp-client-setup script adds the syslog-ng configuration to perform this. To allow the server to process these incoming log messages, some changes have to be made in that configuration as well. In the syslog-ng setting below, messages are logged to a file named after each client's fully qualified domain name.

LDM
If all is well, LDM will be started by ltsp-client and you can proceed to log in with a user on the server. If not, you might want to check if the LDM Info Daemon is disabled in.

When the X server cannot start it might help to add your own xorg.conf file. As many different xorg.conf files can exist for many different clients in the same chroot, make sure to name them properly.

For a user to be able to login over ssh from the thin client to the server, the client needs the server ssh-keys. These can be updated to the clients chroot with the following command:

If you want another window manager, install it on the server and put the following in the LTSP configuration file (replace Fluxbox with the window manager of your choice).

Sound
As you might have seen in the list of emerged dependencies for ltsp, both for the client and the server, PulseAudio was among them. PulseAudio allows for playing audio applications on the server, while hearing it through the client's soundcard. The application running on the server sends its audio output to the pulse server instead of the server's soundcard. The pulse client on the ltsp client receives this output and lets alsa proces it to the client's soundcard. In addition to pulseaudio, its alsa-plugin needs to be installed on both client and server with the pulseaudio use flag enabled.

The kernel alsa-driver is used, so alsa-utils doesn't need to be installed. In order for alsa to route the incoming audio data to pulse, the following needs to be added on the server.

Also, because the server's soundcard is not used, hardware detection can be turned off in. The RTP sender module does need to be loaded for obvious reasons.

Tips & Tricks
Several optional tips and tricks concerning LTSP can be found here. They are not Gentoo specific.

Local Apps
If you want apps to run on the client itself, a few changes need to be made. First of all, an extra line in your lts.conf.

Each application which has to run locally, needs to be installed in the client chroot. You can do this by chrooting into to client chroot environment and emerging the desired packages. It is also possible to combine this with your ltsp-build-client by adding the packages to the build client configuration.

When logged in on your LTSP client, you can now run an application locally by running the following command.

NBD Swap from USB
The nbdswapd allows clients to use swap space through a NBD. For this to work, the ltsp-server has to be emerged with the USE flag enabled. Also, the lts.conf needs to be updated and the nbdswapd.conf has to contain the mountpoint of your usb stick and the desired swap size (64Mb by default).

LDM Greeter
The language of the texts in LDM are controlled by the client's locale. Some of the texts come from gtk while most are derived from ldm. You can see in if ldm.po is available. If it is, the ldm messages will be translated if you set the client's language locale correctly.

If it isn't, to translate the file, download the template translation file from the LTSP upstream LDM trunk and translate it. Compile it and copy the binary to locale dir with:

The themes of the LDM greeter are stored in where the symlink default points to the chosen theme.

Move the Chroot
You might want to move the client chroot installation on the server. This can be easily done with the following command. Don't forget to change to NFS entry in and reload it on the server prior to booting the client again.

If you want to copy the installation to another computer, archive it with tar, copy the archive and unpack it on the other server. Remember to not only install NFS on the new server and copy the file, but also the network boot file used by the PXE.

Slightly faster boot
Because the client chroot uses OpenRC, some services can boot parallel, providing a slightly faster boot.

Debugging
Below some practical debug tips.

Chrooting
When chrooting into the client, you don't have a portage (and layman) tree in the client chroot by default. In the installation, the server portage tree (among others) is bind mounted in the client tree, which means the client chroot actually uses the server's copied portage tree. To chroot into a client, perform the following actions:

When I want to go in a client chroot, I perform the following actions to mimic this behaviour. Let's say the chroot is in /opt/ltsp/x86:

SSHD
Logging in to a booted client with ssh might also be useful. You need to perform three actions for this.
 * 1) Chroot into the client.
 * 2) Add sshd to the default runlevel.
 * 3) Add /etc/ssh to the copy_dirs variable in.

Log Files
On client: On server:

Commands
On client: On Server:
 * # should return tcp: :4713
 * # 'Top' like statistics of X11 client's server side resource usage
 * # To check if client's Pulse Audio daemon is listing on port 4713

Known Issues

 * If you get an emerge error for "=dev-lang/python-2.6* is not installed", with a "die "$(python_get_implementational_package) is not installed";", this means that some of your binary packages were installed against Python 2.6, Remove your binary packages to let them compile against your new python environment.


 * Several programs will fight for the virtual terminals on the clients. Comment out getty in inittab:

X11 Keyboard Layout
At the moment, X configuration is disabled. Therefore, all LTSP X settings (in lts.conf) does not work, especially XKBLAYOUT. For setting the X layout of clients do the following:

Then edit the file and add the line

To the keyboard section of the evdev.conf