434. Boxes
This page is for anyone who installs applications from the KDOS catalogue or wants a separate working environment on their machine.
A box is a rootless Podman container (one your own account runs, with no root daemon) that one graphical application, or one working environment, runs in. Applications KDOS does not compile itself are listed in a catalogue, and each one runs in a box of its own, named after it. A boxed application still looks native: it has a launcher in the menu, a command on the PATH, and files open in it.
This page covers installing and removing a catalogue application, launching it, managing its box, changing what a box may share with the host, taking and restoring snapshots, and making a box of your own to work in. Carrying applications to another machine is Packs; using Podman and distrobox directly is Containers.
Installation
- kdos-appbox installs
/usr/local/bin/kdos-appboxand, as links to it,kdos-boxandxdg-open, and the catalogue,/usr/share/kdos/appstore/catalogue. It depends on podman, distrobox, xdg-dbus-proxy, kdos-boxsock, kdos-boxinit, shared-mime-info and xdg-utils. kdos app, the everyday command, is in kdos-tools; every verb of it that builds, removes, exports or imports runskdos-appbox.- kdos-boxinit is process 1 (the init) inside a box made from packs, and kdos-boxsock holds each box’s own Wayland socket, tagged so that KWin knows which box a window comes from.
- kdos-packd, the service
packd, mounts and composes the packs a pack box is made of; see Packs. - At login, the session wrapper (
/usr/local/lib/kdos/session-common.sh) starts the boxes behind your favourite launchers in advance, so their first launch is fast. Every ten minutes the user servicetimersstops any box that has run past its profile’sautostoptime with no window open. - kcm-kdos-boxes is the Boxes page of System Settings, and kdos-discover lists and installs boxed applications in Discover.
The KDOS image carries the catalogue but no boxed application: each one is built on the machine that asks for it, which needs the network. A box built from a container image needs no system service; a box made from packs needs packd.
Configuration
The catalogue
/usr/share/kdos/appstore/catalogue lists every application KDOS knows how to build. Each application is a row that names its parent row (the runtime it is built on) and the Debian packages it adds. kdos app, Discover’s KDOS backend and the installer all read this one file. Its snapshot line pins the Debian archive date the packages come from:
# `snapshot` pins the Debian archive the packages come from. `auto` takes the
# date from the base image's own sources file, so what is installed on top
# cannot disagree with the rootfs under it. A literal 20260824T000000Z pins
# explicitly; `off` reads the live archive and gives up reproducibility.
snapshot = auto
src/system/kdos-appbox/catalogue, lines 34–38
An application row and its description, as an example:
app app.hugin rt-gtk hugin luminance-hdr entangle
src/system/kdos-appbox/catalogue, lines 337–337
meta app.hugin Hugin|Graphics|949478400|Panorama stitching, with Luminance HDR and Entangle for tethered capture
src/system/kdos-appbox/catalogue, lines 562–562
The format of every line kind is in The catalogue file. KDOS_CATALOGUE names another catalogue to read instead.
Box profiles
A box’s settings, its profile, are in ~/.config/kdos/boxes/<name>.conf, as flat key = value lines. KDOS ships none: kdos-box create and kdos-box profile <name> key=value write one with every key spelled out, and a box with no file behaves as one with the defaults. The main keys say:
- what the box shares with the host:
home,network,ipc,devices,processes; - what it may reach:
wayland,x11,audio,gpu,render,grant; - what it may use:
memory,cpus,pids; - how it runs and is presented:
persistence,init,export,accent,autostop.
Every key, its default and what enforces it are in Box profiles and the box profile file. KWin reads the same file for the box’s grant line.
What the session starts
The session wrapper’s kdos_session_boxes function, in /usr/local/lib/kdos/session-common.sh, starts the warmup (pre-starting your favourite boxes) in the background, once at every login:
kdos_session_boxes() {
command -v kdos-appbox >/dev/null 2>&1 || return 0
(nice -n 10 kdos-appbox warmup >/dev/null 2>&1 &)
}
fs/usr/local/lib/kdos/session-common.sh, lines 149–152
The idle sweep is a row of the per-user timers, /etc/kdos/user-services/timers.d/40-box-gc.timer, run by the user service timers from your first login to your last logout:
# Rows here run for EVERY user, as that user, under the `timers` user service
# (/etc/kdos/user-services/30_timers.sh), beside the user's own
# ~/.config/kdos/timers.d. The shape is /etc/kdos/timers.d's:
#
# NAME TIMESPEC... -- COMMAND...
#
# GIVING IDLE BOXES BACK. `kdos-box gc` stops a box that has run past its
# profile's `autostop` with no window on the screen; nothing else calls it.
# Every ten minutes, from the user's own services rather than from a root
# service, because the boxes are the user's and so is the question asked about
# their windows before any is stopped — a gc that cannot ask leaves every box
# running. nice 10, so a gc that lands during a login does not take the CPU
# from the desktop coming up.
box-gc -H * -M /10 -- nice -n 10 kdos-box gc
fs/etc/kdos/user-services/timers.d/40-box-gc.timer
At the end of each Plasma session, Plasma runs the scripts under /usr/share/kdos/xdg/plasma-workspace/shutdown/ in name order. Two of them concern boxes, and run in this order:
kdos-boxes.shrecords the running boxes and the boxed applications that were open, before the sweep below stops any box, so that when Plasma is set to restore the previous session, the next login starts them again.kdos.shruns the sweep once more askdos-box gc --session-end, stopping every box past itsautostoptime.
Every container of yours stops at your last logout, together with your user services, unless your account lingers (loginctl enable-linger).
The warmup starts up to eight boxes, the ones behind the entries of ~/.config/kdos/favorites, in the order listed. Its skeleton, fs/etc/skel/.config/kdos/favorites, describes the format:
# One DESKTOP-ENTRY ID per line — the file name under
# ~/.local/share/applications or /usr/share/applications, without the
# `.desktop` — or a box's name. Anything after the first word is a note,
# except a `code=XX` word: those two letters, typed alone in KRunner, open
# the entry (the KDOS runner reads this file too).
#
# At every login, before Plasma starts, `kdos-appbox warmup` starts the box
# behind each line, with its bus proxy, so the first launch of the session
# finds it running instead of paying for a cold start. A boxed application's
# launcher id (`app.<id>`, or `app.<id>.<launcher>` for a pack with several)
fs/etc/skel/.config/kdos/favorites, lines 11–20
Other files
| Path | What |
|---|---|
~/.local/share/kdos/boxes/<name>/ |
A pack box’s writable layer (upper), its snapshots, and a private home |
~/.local/share/kdos/alien-apps ($XDG_DATA_HOME/kdos/alien-apps when that is set), /usr/share/kdos/alien-apps |
The tables that map an application’s command to its box |
~/.local/share/applications/ |
The launchers the regeneration writes, each marked X-KDOS-Alien=true |
~/.config/kdos/a11y |
When it exists, boxes are started with accessibility on |
$XDG_RUNTIME_DIR/kdos-appbox.trace |
How long each stage of the last launches took |
The rest are in Files and variables.
Usage
Finding an application
kdos app list --all # the whole catalogue
kdos app search panorama # by id, name, category or tagline
kdos app info app.hugin # one entry, its state and its size estimate
kdos app groups # the named groups install takes in place of an id
kdos app list # what is installed
kdos app groups names the catalogue’s groups of boxed applications. The groups of ports KDOS compiles, some with the same ids, are a separate list, kdos update groups; see Installing software.
kdos app list --all prints a table of id, category, state, estimated size and tagline, one row per application and data pack. kdos app info app.hugin names the runtime row the application is built on (here rt-gtk, the GTK runtime). On a fresh machine kdos app list answers nothing installed — `kdos app list --all`.
Installing an application
Preview what would be built. This prints the
Containerfile(the image recipe) of each image in the stack, under--- kdos/base,--- kdos/rt-gtkand--- kdos/app.hugin, and builds nothing:kdos app install app.hugin --dry-runWith the catalogue’s
snapshot = auto, the Debian archive date is read by runningdebian:trixie-slim, which is pulled first when it is not in your image store. When that run fails (no network, or podman cannot start a container), or the image’s sources file carries no snapshot line, the dry run and the install both warncould not read the snapshot date out of debian:trixie-slim — building against the live archive, which is not reproducibleand build unpinned.Install it, by id or by group. This builds a stack of images on this machine, one per catalogue row:
kdos/base, then the runtime, then the application. An image already built is skipped:kdos app install app.huginRead the result. Progress is one line per step (
==> building kdos/app.hugin); the exit status is the number of applications that failed.
Once the images are built, the install creates the box with kdos-box create <id> base=image:kdos/<id>, using the image already in your store without asking a registry, and then writes the application’s launchers.
If creating the box fails, the install prints <id>: the image built and the box did not, makes no launcher, and keeps the images. Running kdos app install <id> again skips those images and tries the box again; kdos-box remove <id> deletes the profile the failed attempt left. See install and uninstall.
An installed application can also be turned into packs: kdos app export packs built images into a set, and importing that set, as Packs shows, creates a box on the packs.
Launching
Every installed application is a launcher in the menu and a command:
hugin shots.pto # the shim on the PATH
kdos app launch app.hugin # installs first if it must
kdos-appbox run hugin shots.pto # the launch path itself
kdos-appbox open report.pdf # whatever handles the file, boxed or native
A launch starts the box if it is stopped; for a pack box it first assembles the box’s root filesystem from its packs.
Managing boxes
kdos-box list # every box: base, state, persistence, disk use, accent
kdos-box enter app.hugin # a shell inside it, in a new terminal window
kdos-box enter app.hugin ls /usr/bin # one command, in place
kdos-box stop app.hugin # hang up its shells, SIGTERM to it and its apps, 10 seconds, then SIGKILL
kdos-box start app.hugin
kdos-box remove app.hugin # the profile and ~/.local/share/kdos/boxes/<name> stay
kdos-box list prints one row per box under BOX BASE STATE PERSIST DISK ACCENT. A box whose profile exists but whose container does not is shown as not created; a box with no accent shows none.
Stopping a box
kdos-box stop does not use podman stop. A store box shares the host’s process table and has no control group of its own, so podman stop would signal only the box’s init and leave its applications running. kdos-box stop instead:
- hangs up the box’s shells (a
kdos-box enterordistrobox enter), so they end at once; - sends SIGTERM to the applications the box’s launches started, to every launch still waiting for the box, and to the box’s init;
- sends SIGKILL to anything still running after ten seconds, including whatever a dead init left behind.
It returns once nothing of the box holds its storage, so the box can be started again at once. See kdos-box.
Removing a box
kdos-box remove <name> runs podman rm without -f, so it refuses a running box: stop the box first. What it prints tells you what happened:
| Situation | Output | Exit status |
|---|---|---|
| Removed | <name> removed — its profile is kept in ~/.config/kdos/boxes/<name>.conf, then and its writable layer, snapshots and home in ~/.local/share/kdos/boxes/<name> when that directory exists |
0 |
| Podman refused, such as a running box | <name> was not removed: <podman's reason>, with any container id replaced by the box’s name, and, without --force, a reminder that a running box needs kdos-box stop first; nothing is changed |
podman’s |
| No container, profile kept by an earlier remove | <name> has no container; its profile is kept in …; `kdos-box remove <name> --purge` deletes it |
0 |
No container, profile never kept (such as after a failed create) |
<name> had no container — its profile is removed |
0 |
| No container and no profile | there is no box named <name> |
1 |
Only a pack box has a directory under ~/.local/share/kdos/boxes/; a store box’s writes were inside its container and go with it. Once the container is gone, a remove also deletes the menu entries kdos-box export made for the box and releases any packs composed for it.
Two options change what it does:
--force(kdos-box remove app.hugin --force) runs the stop sequence first and adds-ftopodman rm, so a running box is removed too.--purgedeletes the profile as well, and runspodman rmion animage:base that no other box’s profile names, saying whether the image was released or why it was kept.
Entering a box
How kdos-box enter <box> with no command behaves depends on where you run it:
- typed at a shell in a terminal, it opens a new Konsole window in the box’s accent colours;
- run as a terminal’s own program (
konsole -e kdos-box enter <box>), it runs in that terminal and titles its tab<box> — KDOS box; - with
KDOS_BOX_NOTERMset to anything, it runs in the current terminal.
The window opens at once, and the shell in it waits for the box to finish starting, for up to 120 seconds (KDOS_BOX_SETUP_WAIT=<seconds> changes this). A box that was set up before, including after a reboot, is ready in about half a second. If the box is still not ready after 3 seconds, one line says why:
kdos-box: setting up <box> for its first use; this can take a minutefor a box starting for the first time;kdos-box: waiting for <box> to startfor one that has started before.
If the wait runs out, the message names podman logs <box>, and the box’s own window waits for Enter before it closes. A kdos-box stop <box> during the wait ends it with kdos-box: <box> was stopped before it was ready and exit status 1; the kdos-box enter you typed prints the same line and exits 1 once the window closes. The box counts as ready when its log since its last start holds container_setup_done; the details are in the launch path, step 8.
Inside a box, the variable KDOS_BOX holds the box’s name.
Changing what a box may share
Print the profile. Each key is shown beside the mechanism that enforces it, and a
!line marks a setting it cannot deliver:kdos-box profile app.huginSet keys. For a box that has a container it answers
<name>: written, reminds you that namespaces and volumes apply at create time, and prints the profile again; for one with no container yet it says the profile applies when the box is created.autostop=30mis stored asautostop=1800s. A value its key does not take, such asnetwork=maybe, is refused with one line endingnothing was written, and none of the keys on that command line is written:kdos-box profile app.hugin home=private network=privateNamespaces and shared directories are set when a box is created. For those keys, stop and remove the box, then launch the application again: the launch creates the box from the kept profile, a pack box over its packs and a store box, the kind
kdos app installmakes, over its local imagekdos/<id>, with an empty writable layer.kdos app installis needed only when that image is gone; it skips the images still built and creates the box over them.kdos-box stop app.hugin kdos-box remove app.hugin
Both kinds of box take the same keys. A store box is created by distrobox create, which passes memory, cpus and pids to podman as --memory, --cpus and --pids-limit, and network=none as --network none, a namespace with no interface; a memory or cpus value made of anything but letters, digits and dots is refused with a warning and not applied. On either kind the limits are passed to podman, and on KDOS the kernel enforces none of them: a cgroup limit needs the box in the delegated subtree elogind gives each login, and no box can be placed there (see Host applications and boxes reach the portals unidentified). See Box profiles and memory and grants.
Granting a box more of the desktop
A box’s programs reach KWin, the compositor, through a socket tagged with the box’s security context. KWin refuses them anything that would let them watch or control the rest of the desktop (the window list, typing into other windows, screen capture, clipboard managers, panels and overlays, screen configuration and power, and the Plasma shell surface) unless the profile grants it by name:
kdos-box profile app.hugin grant=screencast
| Grant | What the box may then do |
|---|---|
window-list |
List and act on every window |
fake-input |
Type and click into other windows |
screencast |
Record the screen without asking |
data-control |
Read and set the clipboard at any time |
layer-shell |
Draw panels and overlays |
output-management |
Change the screens’ modes and layout |
dpms |
Switch the screens off and on |
plasma-shell |
Place its windows as the Plasma shell does |
input-method |
Accepted, but opens nothing: KWin keeps the input-method interfaces for the input method it starts |
secrets |
Reach the password store (org.freedesktop.secrets) on the box’s bus |
Several grants are separated by commas or spaces. KWin reads a box’s profile once per program that connects, so a change reaches the box’s next program, and one already running keeps what it had. secrets is enforced by the box’s D-Bus proxy instead, which reads it when it starts, at the box’s first launch, so a change to it reaches the box after its next stop and start. A screen capture through the desktop portal needs no grant: the portal asks you. See Granting a box past the allowlist.
Snapshots, clones and rollback
Snapshots let you save a box’s state before a risky change and go back to it. They work on a pack box’s writable layer, under ~/.local/share/kdos/boxes/<name>/; the example below is a box imported from a set, which is named after its pack.
- A box built from a container image, such as a store box, keeps its writes inside Podman’s own store, which snapshots cannot reach:
snapshotrefuses, andclonemakes the new box on the same image without copying any work. - A pack box on the live medium keeps its writes on a temporary filesystem, and
snapshotrefuses there too.
kdos-box snapshot app.scribus before-plugin # a full copy of the writable layer, tagged
kdos-box snapshots app.scribus # list them, with sizes
kdos-box stop app.scribus
kdos-box rollback app.scribus before-plugin # refused while the box runs
kdos-box clone app.scribus scribus-test # a new box on the same base, the work copied
A snapshot takes as much disk space as the box has written. Without a tag it is named by the UTC time.
A box of your own
A box made from a container image can be a general working environment, not tied to one application, for example a different distribution to build or test software in:
Create it. An
image:base not yet in your image store is pulled from a registry over the network, with a line saying the content is unsigned; one already stored is used as it is:kdos-box create scratch base=image:docker.io/library/alpine:latestdistrobox reports
Distrobox 'scratch' successfully created., and the command ends withscratch createdand the new profile.kdos-box listthen shows the boxcreated.Enter it. With a command it runs in place, which is also how to check it:
kdos-box enter scratch kdos-box enter scratch cat /etc/alpine-releasePut one of its graphical programs in the menu, as
<app> (scratch):kdos-box apps scratch kdos-box export scratch <desktop-id>kdos-box appslists the desktop ids (the names of the menu entries) in the box’s/usr/share/applications. It prints nothing for an image, such as Alpine’s, that has none.exportstarts the box and reads the entry’sExec,Name,IconandStartupWMClass, so an id that is not itself a program name, such asorg.gnome.TextEditor, runs the program its entry names. A word that names no entry is taken as a command: it is refused when the box has no such command, and otherwise exported as a terminal launcher with the terminal’s icon.The export writes two files:
~/.local/share/applications/<desktop-id>.scratch.desktop, the menu entry, whose command iskdos-box run scratchfollowed by the entry’s command;~/.local/bin/<command>@scratch, a command you can type, which runs the same thing with its own arguments appended.
kdos-box unexport scratch <desktop-id>removes both.
Two other bases are available:
base=pack:<id>makes a box on an installed pack. It needs no network, and the pack was verified when it was installed.base=box:<name>makes a box on another box’s base, read from that box’s profile and saved in the new one, with an empty writable layer.kdos-box clonecopies the other box’s work as well.
Stopping idle boxes
A box started at login keeps running past Log Out until your last login session ends, unless its profile sets autostop:
kdos-box profile app.hugin autostop=30m
kdos-box gc --dry-run # what the next sweep would stop
With nothing past its time, gc --dry-run prints nothing to stop.
The user service timers runs kdos-box gc every ten minutes, from your first login to your last logout. It stops a box that has run longer than its autostop time, counted from when it started, and only once the desktop confirms that the box has no window open. When the desktop cannot be asked, it stops nothing.
Removing an application
kdos app remove app.hugin
This removes the box, the application’s image, and each runtime image above the base that no remaining box is built on, then regenerates the launchers. The base image is never removed, and neither is the box’s profile. When you remove the last box built on the base, including a box made from Debian packages (a deb: base), the command says the base was kept, names the image it is built on and their size, and gives the podman rmi kdos/base debian:trixie-slim that frees the space.
The box is removed with kdos-box remove, which refuses a running box. In that case the command prints kdos-appbox: app.hugin was not uninstalled and touches no image; stop the box first with kdos-box stop app.hugin.
Updating an application
There is no update verb. kdos app remove and then kdos app install rebuild the application’s image and create its box again, as Installing an application says; see Updating.
On the live medium and on an installed system
On the live medium the home directory is on the boot overlay, and the kernel will not stack a box’s writable layer on it. A pack box’s writes then go to a tmpfs (a filesystem in memory) under /run/user/<uid>/kdos/boxes/ and end with the session; kdos-appbox status marks the box ephemeral, and kdos doctor warns. Podman’s own store uses fuse-overlayfs there; on an installed system the first run switches your store to the kernel’s overlay driver (see Containers). Everything built on the live medium is in RAM unless the medium has a persistence store.
Tips
renderchooses who draws:autouses the card when a/dev/dri/renderD*node opens for you,softwareforcesLIBGL_ALWAYS_SOFTWARE=1. Under QEMU without virgl,autoresolves to software.touch ~/.config/kdos/a11yturns accessibility on in every box;KDOS_A11Y=1does it for one launch.- A store install that fails part-way keeps what it built: of six applications where the fourth fails, the other five are installed.
- A box shares your whole home directory by default.
home=privategives a box one of its own, at~/.local/share/kdos/boxes/<name>.
Troubleshooting
Start with:
kdos doctor
kdos-appbox status
kdos doctor’s Boxes section checks EROFS, the pack daemon, that you are uid 1000, and whether your home can hold a box’s writable layer; its Containers and Desktop sections check /etc/subuid, /etc/subgid and the setuid bits on newuidmap and newgidmap.
<id>: the image built and the box did not-
The box create after the images failed, with podman’s own message above this line; the images stay built.
kdos app install <id>tries the box again without rebuilding them, andkdos-box remove <id>deletes the profile the failed create left. See Installing an application. <id>: <row> did not build-
The lines above it are the end of the build’s log,
~/.cache/kdos-appbox/build-<row>.log, which holds both of podman’s output streams; the reason is there, such as a package with no installation candidate,no space left on device, or for VSCodiumno release asset ends in amd64.deb, which is GitHub refusing the release query (60 an hour from one address) or no network.kdos-appbox -v install <id>shows the build as it runs. <id>: not enough room-
The images still to build need about twice what the catalogue says they add, and that is more than is free where podman keeps them. On a live session with no persistence store that is the memory overlay, which a large application overruns: VSCodium’s first install needs about 2.7G there and a 2 GB overlay refuses it. Install it on an installed system, on a live session with a persistence store (
kdos persist), or on a machine with more memory. See install and uninstall. - A launch does nothing
-
Run it from a terminal with the engine’s messages shown:
kdos-appbox -v run <app>. The stage timings of recent launches are in$XDG_RUNTIME_DIR/kdos-appbox.trace. could not start <name>-
kdos-box enterprints this when the box will not start, without the engine’s message, andkdos-box startprints nothing at all. Look at the container withpodman ps -aandpodman logs <name>, or in the Containers terminal program,podman-tui. - No box starts, and the engine exits 125
-
newuidmapornewgidmaphas lost its setuid bit.kdos doctornames it; the fix issudo chmod 4755 /usr/bin/newuidmap /usr/bin/newgidmap. mkdir /var/lib/containers/storage: permission deniedon every box command-
The engine is using root’s store:
/etc/containers/storage.conf, or your own, names agraphrootorrunroot. See Containers. - A box’s work is gone after a reboot
-
It ran on the live medium, or
kdos-appbox statusmarks itephemeral; see A live session cannot create a persistent box. could not create box '<name>'on a launch-
The box does not exist and the launch could not make it. A pack box is made over its packs, and the line above names the cause, such as
kdos-packd is not running. A store box is made over its local imagekdos/<id>, with podman’s message above; when that image is gone,kdos app install <id>builds it and creates the box again. - A profile change has no effect
-
Namespace and directory keys apply at creation: stop and remove the box, then launch the application again, which creates either kind of box over its kept profile. A
memoryorcpusvalue that is not a plain size or number is refused at creation with a warning; see Changing what a box may share. Agrantchange reaches the box’s next client, not a running one. kdos-box snapshotsays<name> has nothing written to snapshot-
The box was built from a container image, and its writes are in the engine’s store, or it is a pack box on the live medium, whose writes are on a temporary filesystem under
/run/user/<uid>/kdos/boxes/.
Known gaps
A box can be granted only the nine named groups of Wayland globals
A boxed application is given your location without being asked
A catalogue change reaches an installed application only when it is rebuilt
A running GTK 4 or libadwaita program takes a new accent only at its next start ### See also {#16-wiki-boxes–see-also}
Applications: the user guide’s chapter, the store and the everyday commands
kdos-appbox: every command, the launch path and the profile keys
Packs and boxes: the two lanes, composition and the box
Containers in the security model: what a box shares and what that means