LTSP Part 2 – Configuration

In the previous post I had the problem:

… when I boot up, I get the Ubuntu boot screen, which shows it’s connecting to the terminal server, however it then fails with an errror saying

Error: Failed to connect to NBD server

And I get sent to a basic busybox shell.

There were two reasons for this.

PXE… booted

First of all, because I obtain the DHCP separately from the network boot, I need to treat it as if it’s a static IP. LTSP can handle static IPs, but this posed a couple of problems. I would need to specify a separate config file for each MAC address in the pxelinux.cfg/ directory. Secondly it would require each MAC address to be given the same IP each time (this was not going to happen).

So instead of getting gPXE to PXE boot, I completely bypass pxelinux.0 and use my own boot script. In this script I pass in the IP and other information. gPXE has some environment variables which can be used for this, so I wrote a script (The ‘x’s should be replaced by the terminal server’s IP address).

dhcp net0
kernel t ip=${ip}${gateway}:${netmask}:${hostname}:eth0:none
initrd t
boot vmlinuz

This script retrieves the kernel, and passes as parameters the environment variables (which were set by the dhcp) the IP, gateway, netmask and hostname. Another parameter is the nbd server location and port. The we retrieve the initial ramdisk (initrd) and boot.

More haste less speed

After that was fixed, on my test machines it still didn’t connect to the NBD server. This is because my test machines are core2duo 3ghz with 4gb RAM; they were so fast at booting up, that it didn’t get a response from the NBD server in time. I diagnosed this by adding the parameter:


To the kernel line in the script above. This stopped the boot, then it got a response from the server, and when I pressed ctrl+D (to continue the boot) it booted up fine. This is a bug in the ltsp_nbd script.

I solved this by logging into the terminal server and opening the file /opt/ltsp/i386/usr/share/initramfs-tools/scripts/ltsp_nbd, then added the line:

sleep 5

after the line:

ip link set lo up

This meant that the script paused for 5 seconds to allow the NBD server to respond.

Once edited the initramfs needs updating, as do the kernels:

chroot /opt/ltsp/i386 update-initramfs -u

I will be writing a part 3 to this sometime soon talking about some of the customisations I will be adding.

LTSP Part 1 – gPXE

Disclaimer: This is a work in progress blog post. There may be better ways of doing things, and things may have been done wrong. Although I hope you will find this helpful, please don’t take the contents of this post as gospel.

At work we have Ubuntu terminal servers which the students currently connect to using NX on ThinStation in the labs. This is not an ideal setup, especially because the ThinStation kernel is too old to run on (even relatively) modern hardware. It is designed to setup an old computer as a thin client, and allow it to access a terminal server which will do all the hard work.

The other issue which we have is that the network is not owned or managed by my department (computer science), but by the central IT department of the university. This means I do not have access to the DHCP server which is required to PXE boot the computers. On top of this, the computers need to dual boot between the thin client/terminal server and a local installation of Windows.

This is where gPXE comes to the rescue! What gPXE allows me to do is retrieve an IP address from the university DHCP server, and then create my own network boot script completely separately.

Continue reading