This page applies to Ubuntu 16.04.


Introduction

This page describes the native LTSP method to install and maintain an Ubuntu chroot for Raspberry Pi 2 and 3 clients. There are other methods like BerryTerminal or PiNet which use LTSP as their underlying technology, but those are not supported by upstream LTSP developers.

Ubuntu only supports Raspberry Pi 2 and 3, so the resulting chroot cannot be used to boot older Pis.

Prerequisites

It's assumed that you've already installed Ubuntu/LTSP, by following e.g. the ltsp-pnp page. This means that your server will support both i386 and armhf clients (assuming that you've used the Ubuntu i386 desktop iso to install your server). If you don't want to also support i386 clients, you may omit the Generating the client image section of that page.

Creating ltsp-build-client-raspi2.conf

Using your favorite editor, create /etc/ltsp/ltsp-build-client-raspi2.conf with the following contents:

# This is a configuration file to build an LTSP chroot for Raspberry Pi 2.
MOUNT_PACKAGE_DIR="/var/cache/apt/archives"
APT_KEYS="/etc/ltsp/ts_sch_gr-ppa.key"
EXTRA_MIRROR="http://ppa.launchpad.net/ts.sch.gr/ppa/ubuntu $DIST main"
KERNEL_ARCH="raspi2"
LATE_PACKAGES="dosfstools less nano"
export FLASH_KERNEL_SKIP=true

Building a thin chroot

To create an armhf chroot, you'll first need to add the Greek schools PPA to your sources, which contains very up to date LTSP and LDM versions and a backport of the linux-image-raspi2 Ubuntu kernel, and then run ltsp-build-client:

sudo -i
add-apt-repository --yes ppa:ts.sch.gr
apt-key export 03AFA832 > /etc/ltsp/ts_sch_gr-ppa.key
apt update
apt full-upgrade
apt --yes install qemu-user-static binfmt-support
ltsp-build-client --arch armhf --config /etc/ltsp/ltsp-build-client-raspi2.conf

Converting the thin chroot to a fat chroot

Raspberry Pi 2 clients are powerful enough to use them as LTSP fat clients, meaning that they will still load their OS from the server, but user processes will be running on the clients instead of using the server CPU/RAM. And it also means that you won't need an expensive multicore server even if you have many fat clients.

To optionally convert your thin chroot to a fat one, just install the desktop package of your choice. In the following example, ubuntu-mate-desktop is used, which is a good default for clients that don't support 3D acceleration, like Pis.

sudo ltsp-chroot -ma armhf
# Prevent flash-kernel postinst script from causing installation errors:
export FLASH_KERNEL_SKIP=true

# Install the desktop environment you prefer.
# This is for Ubuntu MATE:
apt install ubuntu-mate-desktop
# This is for the lubuntu-desktop task:
#apt install --no-install-recommends lubuntu-desktop^
# This is for the gnome-flashback session:
#apt install ubuntu-desktop gnome-session-flashback

# Install any additional software that you want:
apt install ubuntu-restricted-extras

# Install language packs. Replace "-en" below with your own language(s):
apt install language-pack-en
apt install $(check-language-support)
exit

You can do the same ltsp-chroot + apt install sequence whenever you need to install new programs to your chroot.

Running ltsp-update-image

Every time you add new programs or otherwise modify your chroot, you need to run the following command in order to publish the /opt/ltsp/images/armhf.img virtual disk for your clients:

sudo ltsp-update-image armhf

Editing lts.conf

It's easier if you only have one lts.conf, so symlink the armhf one to the i386 one:

ltsp-config lts.conf
ln -sf ../i386/lts.conf /var/lib/tftpboot/ltsp/armhf/lts.conf

Then open lts.conf with your favorite editor and put the following lines at the end of the file:

# This partial MAC address means "apply this section to all PI clients".
[B8:27:EB:*]
# KERNEL_DEVICE instructs LTSP to locate and automatically update the kernel.
KERNEL_DEVICE=/dev/mmcblk0p1
X_SMART_COLOR_DEPTH=False

Preparing the folder for the client SD cards

The Raspberry PIs need an SD card in order to boot, that contains:

  • bootcode.bin, fixup*.dat, start*.elf: the firmware.

  • config.txt: the firmware configuration file.

  • cmdline.txt: the kernel command line.

  • initrd.img: the initramfs is generated inside the LTSP chroot.

  • vmlinuz: the kernel from the LTSP chroot.

To prepare the cards, you need to create a folder and gather all of those files:

sd_card="$HOME/Documents/RaspberryPi/sd_card"
mkdir -p "$sd_card"
cd "$sd_card"
sudo apt install --no-install-recommends subversion
svn export --force https://github.com/raspberrypi/firmware/branches/stable/boot .
cp /var/lib/tftpboot/ltsp/armhf/{vmlinuz,initrd.img} .
echo "# See https://www.raspberrypi.org/documentation/configuration/config-txt/README.md
# for many tuning options (e.g. monitor resolution) that you can put in this file.
kernel vmlinuz
initramfs initrd.img
# Enable audio (loads snd_bcm2835)
dtparam=audio=on" > config.txt

server_ip=$(ip route get 192.168.67.0 | awk '/src/ { print $NF }')
echo "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 elevator=deadline rootwait init=/sbin/init-ltsp root=/dev/nbd0 nbdroot=$server_ip:/opt/ltsp/armhf" > cmdline.txt

Your sd_card folder is ready. If you ever change your server IP, run the last 2 commands to update cmdline.txt, and transfer it again to the client SD cards. You may completely omit the nbdroot=xxx parameter if you're using the classic 2-NIC setup instead of the proxyDHCP mode.

Copying the boot folder to the client SD cards

You can format your client SD cards with e.g. gparted. It's necessary to have a fat32 partition in the beginning, of at least 100 MB, or even big enough to fill the whole SD card. Copy the SD card folder contents to the root directory of your SD cards and enjoy your PIs. Smile :)

See also

  • UbuntuLTSP - Community Ubuntu LTSP Documentation.

  • ltsp-pnp - An easy way to install and maintain LTSP.

  • lts.conf - Man page for lts.conf.

Comments

This page is maintained by https://launchpad.net/~alkisg, please don't edit it but send a mail with your suggested improvements to the author instead. I know this doesn't align with the usual wiki spirit, but in my experience when many people edit the same page it ends up being unmaintained. IMHO it's best if different people maintain different pages.


CategoryLtsp

UbuntuLTSP/RaspberryPi (last edited 2018-03-25 20:20:23 by alkisg)