Appendices · reference

Files and directories

9 min read · 2026-09-02 · vmlab 0.9

This chapter lists every host path vmlab reads or writes, and the environment variables that move them. vmlab follows the XDG base directory convention: data, state, configuration and runtime files live under four roots, each overridable by its XDG variable. Everything a lab materialises lives beside the lab file in .vmlab/, which How vmlab runs a lab explains and vmlab destroy removes.

The four roots

RootDefaultOverrideHolds
Data~/.local/share/vmlabXDG_DATA_HOMEThe template store, the container-image cache, guest assets, build caches.
State~/.local/state/vmlabXDG_STATE_HOMEDaemon logs, per-lab logs and event history, the lab registry.
Config~/.config/vmlabXDG_CONFIG_HOMEThe host configuration file, registry namespaces, profile overrides.
Runtime$XDG_RUNTIME_DIR/vmlabXDG_RUNTIME_DIREvery control socket. Falls back to /tmp/vmlab-<uid> when the variable is unset, as on some WSL setups.

An XDG variable that is set but empty is treated as unset. HOME unset resolves to /. The runtime root is created private to the user, mode 0700, and vmlab refuses to put sockets into one owned by somebody else, because a client that can connect to a control socket can run scripts in the lab and read and write guest files. The data, state and config roots are not tightened, since they hold no control interface and are legitimately shared in some deployments.

Data

PathHolds
templates/The template store, laid out as <arch>/<name>/<version>/ with disk.qcow2 and template.wcl in each. See Templates and the store.
templates/.lockThe advisory lock every store mutation holds.
templates/.oci-pull/Staging for a registry pull in progress.
oci/The digest-addressed container-image cache: blobs/sha256/, images/sha256/<manifest>/ with manifest.json, config.json and rootfs.sqfs, and refs/<host>/<repo>/<tag> recording the last digest a tag resolved to. See Lab containers.
guest/<arch>/The container micro-VM kernel and initramfs, guest/agent/<os>-<arch>/ the guest agent binaries, and guest/firmware/<arch>/ the UEFI firmware vmlab boots its VMs with, when installed here rather than under /usr/share/vmlab/guest.
cache/artefacts/Content-addressed downloads a template build's source {} fetched.
cache/builds/Working directories of template builds.
cache/oci-push/Working directory of a registry push.
~/.local/share/config-weave/binWhere the playbook engine's guest binaries are looked for, unless VMLAB_CONFIG_WEAVE_DIR says otherwise. See Playbooks.

State

PathHolds
vmlabd.logThe supervisor's log.
labd-<lab>.logOne lab daemon's log.
labs.jsonThe supervisor's lab registry.
labs/<lab>/events.jsonlThe lab's event history, one JSON object per line. See Events.
labs/<lab>/lab.logProvision and script output.
labs/<lab>/vms/<vm>/serial.log, qemu.log and swtpm.log for one VM.
labs/<lab>/containers/<name>/console.logThe micro-VM kernel log with the container's stdout and stderr.

events.jsonl and lab.log roll over at 16 MiB, keeping one previous generation as <name>.1. vmlab logs reads these files directly; there is no daemon call for logs.

Configuration

PathHolds
config.wclThe host configuration file. See Host configuration file.
registries.jsonThe searchable OCI namespaces vmlab template registry manages. See Distributing templates over registries.
profiles/User overrides of the shipped guest OS profiles. See Guest OS profiles.
~/.docker/config.jsonRegistry credentials, read and written Docker-style so an existing login works. DOCKER_CONFIG names a different directory. Credential helpers named there are invoked.

Runtime sockets

PathHolds
vmlabd.sockThe supervisor's control socket.
labs/<lab>/control.sockOne lab daemon's control socket.
labs/<lab>/vms/<vm>/qmp.sock, agent.sock, vnc.sock, tpm.sock, one nic<i>.sock per NIC, one vfs<i>.sock per virtiofs share, and a term-<id>.sock per open terminal.
labs/<lab>/containers/<name>/qmp.sock, ctl.sock, agent.sock, nic<i>.sock, vfs<i>.sock and term-<id>.sock.
smb/<hash>/One lab's bundled smbd: its private, lock and pid directories, where it binds msg.sock/<pid> and ncalrpc/. Named by a hash of the lab's path so a socket path stays short however deep the lab sits, and removed when the smbd stops.
global/<segment>.sockThe trunk socket a lab daemon bridges to for a global segment. See Networking.

The lab directory

A lab is any directory holding a vmlab.wcl. Every lab-scoped verb finds it by walking up from the current directory. Beside it, vmlab keeps .vmlab/, which should be in the lab's .gitignore.

Path under .vmlab/Holds
state.jsonPersisted lab state: snapshot records, pinned artefacts, agent repairs.
vms/<vm>/disk0.qcow2, the linked clone; OVMF_VARS.fd; tpm-state/; firstboot.done once the first-boot provision has run.
containers/<name>/scratch.qcow2, the writable overlay, and container.json.
media/ISO and floppy images built from media {} folders, content-addressed. See Lab file: vm and its children.
volumes/Named container volumes.
smb/The bundled smbd's configuration, passdb, log and persistent state; its sockets live under the runtime root's smb/<hash>/. See Shared folders.
workspace/<machine>.jsonThe workspace syncer's ledger for one dev machine. See Dev machines and the workspace syncer.
screenshots/Where Machine.screenshot writes when given no path.

VMLAB_WORK_DIR relocates the whole directory: with it set, the lab's working data lives at $VMLAB_WORK_DIR/<lab-dir-name>-<hash>/, where the hash is twelve hex characters of the lab root's canonical path, so several labs can share one base without colliding. The lab file itself stays where it is. This keeps disk clones off a slow filesystem such as a bind mount. Because the hash is of the root, a lab whose directory moves finds no working data at its new path; vmlab lab move carries it across (see vmlab lab).

Environment variables

VariableEffect
XDG_DATA_HOME, XDG_STATE_HOME, XDG_CONFIG_HOME, XDG_RUNTIME_DIRMove the four roots above.
HOMEThe base of every default root.
VMLAB_WORK_DIRRelocates every lab's .vmlab/ under one base, as described above.
VMLAB_GUEST_ASSET_DIRSearched first for the micro-VM kernel and initramfs (<arch>/), the agent binaries (agent/<os>-<arch>/) and the bundled UEFI firmware (firmware/<arch>/), before /usr/share/vmlab/guest and the data root's guest/.
VMLAB_CONFIG_WEAVE_DIRWhere the playbook engine's guest binaries are, instead of ~/.local/share/config-weave/bin.
VMLAB_VIRTIOFSDThe virtiofsd binary to use, before searching PATH.
VMLAB_FASTPATHOverrides the host config's fastpath: auto, off, sockmap or afxdp. A malformed value is ignored with a warning. See Host configuration and WSL 2.
VMLAB_DEV_MACHINEWhich dev machine vmlab dev verbs mean, second on the selection ladder after an explicit argument. See vmlab dev.
DOCKER_CONFIGThe directory holding config.json with registry credentials.
PATHSearched for the emulator, qemu-img, swtpm and virtiofsd.