Ubuntu LTSP server for booting thin clients over network using PXE

LTSP diagramNot so long ago I've discovered few bad sectors on one of my machines hard disk. The failing component warranty hasn't expired but I was reluctant to take it back to my hardware dealer because that would make this machine unusable until the whole process is finished. Hard disk device in question is currently in my hardware dealers hands an I'm waiting for replacement but that hasn't stopped me from writing this article using diskless machine in question. In this article I'll show you how to install LTSP (Linux Terminal Server Project) on your Ubuntu PC and how to configure this system for booting thin clients over network using PXE (Preboot Execution Environment).

Introduction and requirements

For this procedure you need at least one network interface configured with static IP address. To to configure this interface you can use Network Manager GUI or old school way of modifying /etc/network/interfaces file. Whatever you choose you need to configure interface with static IP address 192.168.0.1 and netmask 255.255.255.0, everything else can be left blank if you use Network Manager or omitted if you use /etc/network/interfaces file.

Second important thing is that you need to disable all DHCP servers on your local networks except the one we will configure on our LTSP server. This includes your ADSL router DHCP feature as well as "Shared to other computers" feature from Network Manager. This is necessary because we pass additional data to thin clients besides IP address and that's something most ADSL routers as well as dnsmasq DHCP server when configured by Network Manager do not support.

Configure static IP

I will edit /etc/network/interfaces file to set up static IP on my eth0 network interface. I recommend disabling Network Manager (untick "Enable Networking" checkbox) when configuring /etc/network/interfaces file at least until you get your LTSP server running. First open /etc/network/interfaces as administrative user using your favorite editor (as an example I'll use nano but you can use gedit if you aren't terminal savvy user):

sudo nano /etc/network/interfaces

You will add something like following at the end of interfaces file:

auto eth0
iface eth0 inet static
    address 192.168.0.1
    network 192.168.0.0
    netmask 255.255.255.0

Now you can bring this interface up using:

sudo ifup eth0

Install required packages

First step is to install required packages:

sudo apt-get install ltsp-server-standalone openssh-server

This should also install dhcp3-server package, we will configure it in the next step.

Configure dhcp3-server

Now we will configure DHCP server. We need to tell dhcp3-server what interface it should use by editing /etc/default/dhcp3-server file.

sudo nano /etc/default/dhcp3-server

We should add our eth0 interface to INTERFACES variable so that it all looks like this:

INTERFACES="eth0"

We also need to configure dhcp3-server for our LTSP server use case scenario. Luckily LTSP project includes dhcp3-server configuration file /etc/ltsp/dhcpd.conf we just need to include it at the end of "/etc/ltsp/dhcpd.conf" configuration file:

echo "include \"/etc/ltsp/dhcpd.conf\";" | sudo tee -a /etc/dhcp3/dhcpd.conf

Now we should be able to successfully start our dhcp3-server like this:

sudo service dhcp3-server start

If it happens that it doesn't start then check syslog for more info.

Create thin client user account

We will create user account that will be used to log into our LTSP server from thin client terminal.I will name this user "clientone" but you can choose what ever you like, but you should remember this name as well as password you have provided for this user account:

sudo adduser clientone

If you want to give "clientone" user admin powers you should also add it to admin group after you have created it:

sudo adduser clientone admin

If you have multiple thin client it is advisable to create multiple user accounts.

Update SSH keys and create image

Since version 5 LTSP is using SSH to secure server-client connection. Because of that you need to update SSH keys initially and every time you change server parameters like IP address:

sudo ltsp-update-sshkeys

Last thing to do is to create image that will be used to boot thin clients. Keep in mind that for this step you need working internet connection so you could download basic packages to create chroot environment necessary for booting your thin clients.

sudo ltsp-update-image

After this step is finished you should configure your thin clients BIOS for PXE boot over network. Then you should be able to boot your diskless clients from your LTSP server over network. To log into your LTSP server from thin clients you should use user accounts you have created in previous step.

Known issues

If you have Nvidia proprietary drivers installed on your LTSP server, under some circumstances your clients image might get mirrored. As a workaround to this issue (tested on pre Unity Ubuntu versions) you can disable Compiz on your server machine, for example on per user basis for user "clientone":

sudo -u clientone gconftool-2 --type string --set /desktop/gnome/session/required_components/windowmanager metacity

Also you can disable Compiz for all existing an future users on your server machine using something like this:

sudo gconftool-2 --direct \
  --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory \
  --type string --set /desktop/gnome/session/required_components/windowmanager metacity

Keeping your LTSP image up to date

Over time your LTSP chroot environment will get old and miss out on important security updated. That's why you should update your chroot environment from time to time. Before doing this please make sure that all thin clients are powered down.

By default LTSP chroot environment doesn't contain update repositories for your Ubuntu version so before first update you must copy your server's APT sources.list into you chroot environment APT:

sudo cp /etc/apt/sources.list /opt/ltsp/i386/etc/apt/sources.list

Now we should export LTSP_HANDLE_DAEMONS=false environment variable to prevent the server from restarting its daemons when upgrading our chroot environment.

export LTSP_HANDLE_DAEMONS=false

Now you can use following commands to chroot into LTSP server environment, update sources list, upgrade packages and exit from LTSP chroot when it's all over:

sudo chroot /opt/ltsp/i386
mount -t proc proc /proc
apt-get update && apt-get dist-upgrade
exit

After booting any clients you should also update LTSP kernels in case upgrade brought new kernel version and update LTSP image like this:

sudo ltsp-update-kernels
sudo umount /opt/ltsp/i386/proc
sudo ltsp-update-image

If you expect to do this often you can easily create BASH script for this task and even create cron job to start it periodically.

DevGenii

A quality focused Magento specialized web development agency. Get in touch!

6 thoughts on “Ubuntu LTSP server for booting thin clients over network using PXE

  1. christiain

    i have a problem on loading the client image.. it take so long for the client to load the image.. is there a way to cut the loading process
    ?

    Reply
  2. BASIL GOMEZ A

    I have successfully installed ltsp server and LAMP in the server. I can log on to the server from clients.. I can also execute php programs from the server. But I dont know to how to execute php programs from clients… please help me to configure php from ltsp clients…

    BASIL GOMEZ

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *