Skip to content
Soylor edited this page Feb 2, 2023 · 14 revisions


The primary LTSP developer recommends admins use raw VM disk images instead of using chroots as the basis for creating LTSP images because there are known issues with installing certain packages when apt and dpkg are run in a chroot.

The older LTSP 5 had a tool called ltsp-build-client that administrators could use to create chroots, and another tool called ltsp-chroot to manage them.

The new LTSP doesn't provide them anymore, as nowadays numerous alternatives to manage chroots exist.

Here's a quick tutorial to create a minimal chroot. Replace focal, which is the name of Ubuntu 20.04, with whatever version you prefer.

cd /srv/ltsp
debootstrap focal focal
chroot focal
apt install --no-install-recommends linux-generic initramfs-tools
echo focal > /etc/hostname

Install ltsp packages and a windows manager (XFCE4 in my case) in the chroot section

chroot focal
apt install software-properties-common
add-apt-repository ppa:ltsp
add-apt-repository universe
apt update
apt install --install-recommends ltsp
apt install xfce4

Then put the following line in /etc/exports.d/local.exports:

/srv/ltsp/focal	*(rw,async,crossmnt,no_subtree_check,no_root_squash,insecure)

You might want to restrict "*" there to the server IP so that only KVM has read-write access to that chroot. Then run exportfs -ra to export it via NFS.

Booting the chroot with KVM

At that point you should be able to boot the chroot with KVM and maintain it without caring about chroot restrictions like bind-mounting directories, prohibiting services from starting etc. If your server is headless, run:

kvm -m 1024 -nographic -serial mon:stdio -kernel /srv/ltsp/focal/boot/vmlinuz -initrd /srv/ltsp/focal/boot/initrd.img -append "rw root=/dev/nfs nfsroot= console=ttyS0"

While if your server has a normal GUI, run:

kvm -m 1024 -kernel /srv/ltsp/focal/boot/vmlinuz -initrd /srv/ltsp/focal/boot/initrd.img -append "rw root=/dev/nfs nfsroot="

Then login as root and install whatever packages you need, for example apt install ubuntu-desktop.

Booting the chroot with a client

An alternative way is to boot the chroot in NFS read-write mode from a client. This has the advantage that it can work with different architectures, e.g. armhf chroots and x86 server, or with a GUI client and a headless server. To do that, you'd need to add the following to /srv/tftp/ltsp/ltsp.ipxe.

Below "Other options:"

item --key n nfs-rw               nfs-rw

And then below "goto ${img}":

set img focal
set cmdline rw root=/dev/nfs nfsroot=${srv}:/srv/ltsp/${img},tcp,timeo=600,rsize=4096,wsize=4096
kernel /ltsp/${img}/vmlinuz initrd=initrd.img ${cmdline}
initrd /ltsp/${img}/initrd.img
boot || goto failed

Booting LTSP image with sshfs support

For ltsp sshfs working properly, you shoud install sshfs package:

sudo apt install sshfs