Skip to content
The record
Finding2 September 20265 min read

A casper overlay layer, and a kiosk session that ships switched off

Booting an Ubuntu live audit stick straight into a kiosk by extending casper's own squashfs layer chain, and the three overlay faults - a 0700 layer root, a real /lib shadowing the symlink into /usr, and a destructive undo - that each cost boots.

systemsmethod

What was done

Two limits of the earlier fullscreen work were removed. The live session forgot every apt install at reboot, which meant no nvme-cli and therefore no secure erase on NVMe; and the kiosk had to be started by hand because casper has no autorun hook. Both were solved by extending casper's own squashfs layer chain with one more layer, read out of the stick's initrd rather than from documentation. Three overlay faults each cost boots: a staging root left at 0700 by mktemp, which overlayfs promoted to the merged / and made untraversable; a real /lib in the layer shadowing the symlink into /usr; and an undo command that reverted a setting it had nothing to do with. Arming now re-mounts the layer and refuses any build with a non-traversable directory. What shipped is a kiosk session that is off by default and whose every failure path hands over to the stock Ubuntu desktop with a message, so the layer can be built, armed and booted with no change in behaviour until someone writes one word on the stick.

LAYERFS_PATH=minimal.standard.live.station.squashfs
 
casper strips one dot-component at a time and mounts
lowest first; the longest name wins:
 
  minimal.squashfs                        (lowest)
   minimal.standard.squashfs
    minimal.standard.live.squashfs
     minimal.standard.live.station.squashfs  <- ours
 
THE TRAP: call it station.squashfs and the chain is
just "station" - a few hundred KB mounted AS the whole
root, no /sbin/init, panic. The name must extend a
chain whose every ancestor already exists.

How casper picks the layers, and the naming trap that panics the boot.


Status

Shipped, 2–4 September 2026.

Twenty-one commits, mostly on one stubborn problem.

The problem

Two things the July fullscreen work could not solve:

The live session is amnesiac. Every apt install nvme-cli is discarded at reboot — and without nvme-cli an NVMe drive cannot be secure-erased, which is most of what comes through the door.

The kiosk does not start by itself. SystemRescue ran autorun at boot; Ubuntu's casper has no such hook, so an operator had to type a command every time.

What was built: an overlay layer

boot straight into the kiosk, via a casper overlay layer.

This was read out of the stick's own initrd, not from documentation, because most of what is written about casper online is wrong for 24.04.

Layer selection is driven by one variable:

LAYERFS_PATH=minimal.standard.live.squashfs

casper builds the stack by repeatedly stripping the last dot-component off that name, and the longest name ends up highest priority. So a layer named minimal.standard.live.station.squashfs extends the chain and sits on top of everything.

The naming trap, which the script now refuses to be talked out of: the chain only walks up, by stripping components. Call the layer station.squashfs and the chain is just "station" — casper would mount a few hundred kilobytes as the entire root, find no /sbin/init, and panic. The name must extend a chain whose every ancestor already exists.

Three failures that each cost boots

the layer's root was 0700. mktemp -d creates a directory at 0700, and mksquashfs faithfully preserved that as the layer's root. Overlayfs takes a merged directory's mode from the topmost layer — ours — so / on the booted system became drwx------ root root. No non-root user could traverse it, GDM never started, and the machine stopped at a text console with nothing anywhere saying why. later extended the fix to /usr, /etc and /var for the same reason.

the text-console boots were /lib, not the autostart. Days were spent believing the autostart entry was at fault. /lib, /bin, /sbin and /lib64 are symlinks into /usr; a real directory of that name in the overlay shadows the symlink and the system cannot find its libraries. The autostart was innocent the whole time.

undo reverted a setting it had nothing to do with. The tool meant to make experiments safe was itself destructive.

How the investigation was actually made to work

separate the half that works from the half that keeps breaking. Packages (the safe half) split from autostart (the unstable half), so a build could ship the first without risking the second.

record that --with-autostart does not work, and what was ruled out. A commit whose entire content is documenting a failure and the eliminated hypotheses. later brought the header back in line once more was known.

add a boot entry that proves whether the initrd conditional is the bug. Rather than guessing at the splash behaviour, ship an entry that answers the question. then "stop guessing at the splash" and drop the conditional entirely.

** — let the mode be set without carrying the stick to another machine**, and say plainly that a reboot wipes the test.

What shipped

a kiosk session, so GNOME never draws — and it ships switched off.

The contract in station-session.sh, every line of which serves it:

  1. Off by default. No gui/kiosk.mode on the stick, or any word other than on, and it hands straight to the stock Ubuntu session. The layer can be rebuilt, armed and booted with zero change in behaviour.
  2. Every failure path ends in the stock session, with a message on screen saying why. There is no path that ends in a black screen.
  3. Only what is proven present: Xorg, xsetroot, python3, and the fullscreen-x.py already on the stick. No gnome-kiosk, no cage, no xdotool.

a kiosk mode, now that the reason for avoiding it turned out to be false. A constraint that had been treated as fixed was re-tested and was not real.

What was deliberately not built

No custom initrd. The layer extends casper's existing chain rather than replacing its logic — the one piece of this that must never be fragile.

Open questions

the package gate refused a build for a reason that did not apply (dependency upgrades that this build never downloads). That gate is also why the layer cannot be rebuilt off the audit machine, which came up again on 23 September.


The code

The session's contract: off by default, and no path that ends in a black screen.

stock() {
    # Hand over the desktop this machine has today. Used for "switched
    # off", which is silent, and for every failure, which is not.
    exec env GNOME_SHELL_SESSION_MODE=ubuntu \
         /usr/bin/gnome-session --session=ubuntu
}
fallback() {   # say why, on screen, then give them a working desktop
    command -v zenity >/dev/null 2>&1 && zenity --error --text="$1" &
    stock
}
# --- the off switch, before anything can go wrong ------------------
[ -n "$MEDIA" ] || fallback "The USB stick could not be found."
KIOSK=off
[ -r "$MEDIA/gui/kiosk.mode" ] &&
    KIOSK=$(tr -d '\r\n\t ' <"$MEDIA/gui/kiosk.mode" | tr 'A-Z' 'a-z')
[ "$KIOSK" = "on" ] || stock   # deliberate, not an error: no dialog
From tools/gui/layer/station-session.sh — an excerpt, trimmed to the technique it illustrates.

Not shown. The arm step that rewrites grub.cfg, the package list baked into the layer, and the permission-normalising pass over the staging tree. The traversability gate added after the 0700 boot is described but not quoted; one excerpt per record, and the off-by-default contract is the record's point.

A published copy. Commit references and internal identifiers have been removed and the operator is not named; the engineering, the counts and the stated limits are unchanged.