Lab Kiosk OS & Edge SaaS

Building the ISO

The client OS is produced by Debian live-build, driven either from a container (any host) or natively on a Debian/Ubuntu machine.

Output: distro-builder/out/labkiosk-debian13-<arch>.iso and its .sha256, for the architecture of the machine that builds it: amd64 (Intel and AMD) or arm64. Building for another architecture, or adding one: Building for Your Platform.


Method 1 — Docker (cross-platform)

Run both commands from the repository root:

# 1. Build the builder image. The Dockerfile COPYs the source into the image.
docker build -t ghcr.io/akbhoi/labkiosk-iso-builder distro-builder

# 2. Run live-build in a privileged container, mounting only the output directory.
docker run --privileged --rm \
  -v "$PWD/distro-builder/out:/build/out" \
  ghcr.io/akbhoi/labkiosk-iso-builder

The engine must be rootful

live-build runs debootstrap, which creates device nodes with mknod. A rootless user namespace forbids that even under --privileged, and the build dies partway through the chroot stage.

Docker Desktop is rootful by default. If your docker command is served by a podman machine, switch it once:

podman machine stop && podman machine set --rootful && podman machine start

Verify before starting a long build:

docker run --rm --privileged debian:trixie-slim sh -c 'mknod /tmp/n b 7 99 && echo ok'

Rootful and rootless keep separate image stores, so images pulled before the switch will not be listed afterwards. Reverse with podman machine set --rootful=false.

Step 1 is not optional when you have changed anything

The builder image contains the source — its Dockerfile does COPY . /build/ rather than bind-mounting, because Windows 9P/drvfs mounts enforce nodev/noexec and would break mknod. Only out/ is bind-mounted.

GoalWhat to run
Build the ISO from your working treedocker build … first, every time you change distro-builder/
Reproduce the published ISO exactly as CI builds it from maindocker pull ghcr.io/akbhoi/labkiosk-iso-builder:latest, then run it

Running a stale or pulled image silently builds an ISO from the source baked into it, and the result looks exactly like your change had no effect.

The .dockerignore matters

Without it the build context carries chroot/, cache/, and every previously built ISO — over a gigabyte — and, worse, a stale lb config-generated config/binary whose LB_BOOTAPPEND_LIVE still contained the quiet loglevel=3 that caused the black-screen boot deadlock.


Method 2 — Native Debian / Ubuntu / WSL2

On Debian 13 (Trixie), amd64 or arm64. The live-build of older releases, and of Ubuntu, may not know trixie: use the container there.

cd distro-builder
sudo bash build-iso.sh

build-iso.sh installs live-build and this architecture's boot loader tools itself.


What goes into the image

Package manifest

config/package-lists/kiosk.list.chroot holds what every architecture installs, and config/arch/<arch>/packages.list.chroot what only one does (its kernel, boot loaders, microcode, and on amd64 the Intel audio and video drivers and Hyper-V daemons); auto/config adds the second to the first. Both are deliberately minimal:

GroupPackages
Kernel & live bootlinux-image-amd64 or linux-image-arm64 (per architecture), live-boot, live-config, live-config-systemd, live-tools, eject, overlayroot, systemd-sysv
Boot & partitioningamd64: grub-efi-amd64-bin, grub-pc-bin, shim-signed, grub-efi-amd64-signed; arm64: grub-efi-arm64-bin, shim-signed, grub-efi-arm64-signed; both: grub-common, grub2-common, efibootmgr, parted, dosfstools, e2fsprogs, rsync, sudo, xz-utils
Virtualisationhyperv-daemons (amd64)
Firmwareamd64: intel-microcode, amd64-microcode, firmware-sof-signed, firmware-intel-sound; both: firmware-linux-free, firmware-misc-nonfree (includes Intel Arc and NVIDIA nouveau), firmware-realtek, firmware-iwlwifi, firmware-amd-graphics, firmware-atheros, firmware-ath9k-htc, firmware-brcm80211, firmware-libertas, firmware-ti-connectivity, firmware-zd1211, firmware-bnx2, firmware-bnx2x
X11 & desktopxserver-xorg-core, xserver-xorg-legacy, xserver-xorg-video-{all,fbdev,vesa}, xserver-xorg-input-all, mesa-va-drivers; amd64 also xserver-xorg-video-{intel,qxl}, intel-media-va-driver-non-free, i965-va-driver (hardware video decoding: Intel, Arc included, AMD/Radeon and nouveau), xinit, libpam-systemd (the kiosk session's logind registration, which lets X run without root), openbox, xdotool, scrot, unclutter, alsa-utils
Browser & fontschromium, chromium-sandbox, fonts-dejavu, fonts-liberation, fonts-noto-core, fonts-noto-color-emoji, fonts-noto-cjk (Chinese, Japanese and Korean)
Remote & networkx11vnc, network-manager, wpasupplicant, wireless-regdb, rfkill, systemd-timesyncd, locales, iproute2, libnss-systemd, curl, python3, python3-websocket, ca-certificates
Memory & recoverysystemd-zram-generator (compressed RAM as the first swap), cryptsetup-bin (the installed disk's swap partition, encrypted with a key for one boot, and the data partition, encrypted with the TPM), libtss2-esys-3.0.2-0t64, libtss2-mu-4.0.1-0t64, libtss2-rc0t64, libtss2-tcti-device0t64 (what systemd needs to reach the TPM; trixie's names after the 64-bit time_t transition)
Security & healthnftables (the firewall, and the LAN update sharing rule), apparmor (profiles for the agent and x11vnc), smartmontools (labkiosk-health's disk checks; its own daemon is masked), gpgv (verifies downloaded system images)
Printingcups-daemon, cups-client, cups-filters-core-drivers: driverless IPP Everywhere printing to the organization's network printers, masked until an administrator turns printing on (see below)

Keeping the image small

auto/config builds with --apt-recommends false and --firmware-chroot false, so only what the list names is installed. Before this, live-build's defaults added every package in non-free-firmware (~875 MB installed: server NICs, GPU-compute, Raspberry Pi) and every Recommends (printer tools, Samba, Avahi, ModemManager, Perl web modules), which took the ISO past 1.1 GB. Consequences:

  • A package the kiosk needs that some other package only recommends must be listed by name (that is why systemd-timesyncd, the signed shim/GRUB and the extra Xorg drivers are there).
  • live-tools is in that list for a concrete reason: it prints "Please remove the live-medium ... press ENTER" when a live session reboots. Without it, a workstation that has just been installed reboots straight back into the installer.
  • New Wi-Fi or GPU hardware needs its firmware-* package added explicitly. The list covers desktop and laptop GPUs, audio DSPs, Wi-Fi and Ethernet (about 95 MB of the ISO); server and datacenter NIC firmware (firmware-qlogic, firmware-myricom, firmware-netxen, firmware-cavium, firmware-netronome) is left out on purpose.
  • The image has no noVNC, websockify or cloudflared: Remote Control goes from loopback x11vnc through the agent to the console's relay, and the console serves the viewer. The simulator's noVNC is not Debian's novnc package (which depends on Node.js): its Dockerfile installs the release pinned in docker-test/novnc.pin with docker-test/install-novnc.sh, verifying its SHA-256.
  • The initramfs is xz-compressed via etc/initramfs-tools/conf.d/labkiosk-compress; live-build 20230502's --initramfs-compression does not accept xz.
  • scrot stays: Openbox already needs imlib2, which is what pulls in its large image loaders, so replacing scrot would add packages rather than remove them.

Printing packages. Printing is off on every workstation until an administrator turns it on in Settings → Printing, so the three packages are there but nothing of them runs: 01-lockdown.hook.chroot disables and masks cups.service, cups.socket and cups.path, and only labkiosk-printing unmasks the first two. They are the least that prints a page from Chromium to a network printer with no driver:

  • cups-daemon: the scheduler and its ipp/ipps backends.
  • cups-client: lpadmin and lpstat, which labkiosk-printing runs.
  • cups-filters-core-drivers: pdftopdf and pdftoraster, which turn Chromium's PDF into what an IPP Everywhere queue sends. It brings in poppler-utils and qpdf's library, and pulls cups-common, cups-server-common and cups-ipp-utils with the others.

Left out on purpose: cups (the metapackage, with every driver), cups-filters (adds ghostscript), cups-browsed and avahi-daemon (printer discovery; printers are listed by address), ipp-usb (USB printers), colord, and every printer-driver-*. All but the last are only recommended, so --apt-recommends false keeps them out. A printer that does not speak IPP Everywhere (driverless printing, often sold as AirPrint or Mopria) cannot be used.

Size: Debian's archive could not be reached when this was added, so these figures are from the closest Ubuntu release (22.04, with CUPS 2.4.1 and cups-filters 1.28.15, against bookworm's 2.4.2 and 1.28.17). About 17 MB installed and 3.7 MB of packages, counting what the image does not already have (libcups2, openssl, libcairo2 and liblcms2 come with Chromium and ca-certificates): cups-common 4.2 MB, libpoppler 3.4 MB, cups-server-common 2.4 MB, libqpdf 2.1 MB, cups-ipp-utils 1.0 MB, cups-daemon 0.9 MB, poppler-utils 0.7 MB, cups-filters-core-drivers 0.6 MB, cups-client 0.5 MB and smaller libraries. Check the real figures in the build log.

scrot supplies thumbnails, xdotool drives the browser, alsa-utils implements the mute command, and chromium-sandbox is present because the image keeps Chromium's sandbox enabled. The simulator does too; it passes --no-sandbox only when started as root.

Build hooks

HookDoes
config/hooks/live/01-lockdown.hook.chrootCreates the kiosk user (not in the tty group), enables labkiosk-session.service as the default graphical.target's session and writes its PAM stack and Xwrapper.config (needs_root_rights=auto), masks every getty, writes the Xorg lockdown snippet, the polkit rules (power, network, updates, and 99-labkiosk-deny.rules for everything else), the sudoers rules, enables nftables.service (refusing to build if /etc/nftables.conf is not Lab Kiosk's), labkiosk-apparmor.service, NetworkManager-dispatcher.service and labkiosk-health.timer, masks smartmontools.service, the units that mount LABKIOSK_DATA on an installed disk, enables labkiosk-boot-ok.service, pre-seeds live-config's sudo and policykit components away, ships an empty /etc/machine-id, and generates the Chromium policy from its base
config/hooks/live/02-security.hook.chrootsysctl hardening, disables core dumps, sets GRUB timeout and consoleblank=0, disables recovery mode, applies --unrestricted and any pinned boot password

Rootfs overlay

config/includes.chroot/ is injected verbatim into the image: the agent, the extension, the wizard, the installer, labkiosk-boot-slots and labkiosk-boot-ok.service, the installed disk's boot menu (usr/share/labkiosk/boot/grub.cfg), the image's version (usr/share/labkiosk/version), the labkiosk-data-generator systemd generator, labkiosk-session.service, the firewall (etc/nftables.conf), the AppArmor profiles (etc/apparmor.d/labkiosk-agent, labkiosk-x11vnc) and labkiosk-apparmor.service, which loads them, the DHCP time-server dispatcher script (etc/NetworkManager/dispatcher.d/50-labkiosk-ntp), labkiosk-health with its service and timer, overlayroot.conf, and the Openbox config.

Line endings. .gitattributes pins every script, hook, and config in this tree to eol=lf, because the repository builds a Linux image. A CRLF hook dies with $'\r': command not found. Never write these files with a tool that translates newlines — Python's Path.write_text does, on Windows.


Bootloaders

FirmwareConfigNotes
Legacy BIOSconfig/bootloaders/isolinux/, syslinux/ALLOWOPTIONS 0 + NOESCAPE 1 in stdmenu.cfg means syslinux discards any kernel argument typed at the prompt — no password needed
UEFIconfig/bootloaders/grub-pc/Password applied from LABKIOSK_GRUB_PBKDF2 or grub.pin when present. The only firmware on arm64

Which of them an image carries is config/arch/<arch>/bootloaders: grub-efi,syslinux on amd64, grub-efi on arm64.

The menu offers a default entry, a Load into RAM (toram) entry, an Install to Hard Disk entry, and a failsafe entry.


Build pins

config/includes.chroot/usr/share/labkiosk/grub.pin          PBKDF2 boot-menu hash
config/includes.chroot/usr/share/labkiosk/update-keys/      release-signing public keys (current + next)
PinUnsetWrong
grub.pinBuilds with a loud warning; live menu stays editableBuild fails
update-keys/*.gpgBuild fails — the image could never verify an updateBuild fails (not a binary public key)

Never invent a value to make a build go green. → Kiosk Hardening


Pre-flight checks

Run these before packaging — CI runs them too:

PYTHONPYCACHEPREFIX=/tmp/labkiosk-pyc python3 -m py_compile \
  distro-builder/config/includes.chroot/opt/labkiosk/agent/agent.py \
  distro-builder/config/includes.chroot/usr/local/bin/labkiosk-install \
  distro-builder/config/includes.chroot/usr/local/sbin/labkiosk-localization \
  distro-builder/config/includes.chroot/usr/local/sbin/labkiosk-boot-slots \
  distro-builder/config/includes.chroot/usr/local/sbin/labkiosk-update \
  distro-builder/config/includes.chroot/usr/local/sbin/labkiosk-share \
  distro-builder/config/includes.chroot/usr/local/sbin/labkiosk-logs

node --check distro-builder/config/includes.chroot/opt/labkiosk/extension/content.js
node --check distro-builder/config/includes.chroot/opt/labkiosk/extension/background.js

python3 distro-builder/tools/generate-chromium-policy.py --check

shellcheck -S warning \
  distro-builder/config/includes.chroot/etc/openbox/autostart \
  distro-builder/docker-build.sh \
  distro-builder/config/includes.chroot/usr/local/sbin/labkiosk-swap \
  docker-test/entrypoint.sh

PYTHONPYCACHEPREFIX is not optional: without it py_compile writes __pycache__ directories inside config/includes.chroot, and live-build copies whatever is on disk straight into the ISO.


CI

.github/workflows/build-iso.yml builds one ISO per architecture, each on a runner of its own (ubuntu-latest for amd64, ubuntu-24.04-arm for arm64), on version tags (v*) and on manual dispatch. The arm64 ISO gets distro-builder/tests/vm/live-smoke-test.sh, which boots its kernel in QEMU and waits for the agent and Chromium; the amd64 ISO gets the full boot test below. For each, it frees disk space on the runner only when it is short, warns when a release build has no GRUB password pinned, verifies the checksum, and uploads the artifact. It then boot-tests the ISO before any release: distro-builder/tests/vm/boot-test.sh installs it onto a virtual disk with the real installer and boots that disk in QEMU (UEFI, KVM) to prove the one-try boot, the promotion of a new image and both kinds of rollback. It then downloads a release signed with a throwaway key onto that disk with the image's own labkiosk-update: a download killed halfway is never booted and resumes, a tampered manifest and a signed downgrade are refused, and the finished download installs and is promoted. The boot test runs as parallel jobs, each on its own runner from the same ISO artifact. A failing scenario uploads VM screenshots, and no GitHub Release is created. On a tag, the release is then signed and uploaded to R2 as an over-the-air update (distro-builder README). → Testing Guide

On pushes and pull requests that touch them, .github/workflows/client.yml runs the client checks above and .github/workflows/images.yml builds and scans both Docker images (no push). → Testing Guide


Flashing to USB

Minimum 2 GB.

  • Windows: Rufus, in DD Image mode when prompted.
  • macOS / Linux: balenaEtcher, or:
sudo dd if=distro-builder/out/labkiosk-debian13-amd64.iso of=/dev/sdX \
  bs=4M status=progress conv=fsync

Verify /dev/sdX carefully. dd will not ask twice.

→ Installation Guide · Disk Installer · Kiosk Hardening

This page is wiki/Building-the-ISO.md in the repository.