# Processes This page goes through every process that devvm runs on this machine for a VM, one section each: what it holds, such as secrets and keys, the input a VM controls that it reads, what it writes and how far that can grow, how it's confined, and who starts it and waits for it. Then it lists every listener on this machine whose bytes a VM controls, and why devvm is written in Go. The pages each section links to have the details, and the [security model](security.md) has what these processes protect. Every process here runs as you. devvm runs its own long-running processes as itself, `devvm` with a hidden command, so their code is the binary you installed, and the other long-running programs it runs are OpenSSH's `ssh` and `ssh-agent`, Lima and, on Linux, QEMU. | Process | Started by | Ends | Confinement | | --- | --- | --- | --- | | [devvm itself](#devvm-itself) | you | when its command ends | none | | [A VM's proxy](#a-vms-proxy): its broker, `devvm _proxy` | each start of the VM | with the VM's hostagent, its child, or `devvm stop` | none | | [A VM's proxy](#a-vms-proxy): its child, `devvm _proxy-child` | the broker | with its broker | a Seatbelt profile on macOS, and Landlock and a seccomp filter on Linux ([the child's sandbox](network.md#the-childs-sandbox)) | | [A build's proxy](#a-builds-proxy), `devvm _proxy` and its child | a build behind a company proxy | with the build | its child's, as a VM's proxy's child's | | [The port forwarder](#the-port-forwarder), `devvm _ports` | each start of a project VM, and each change of its ports | with the VM's hostagent, or `devvm stop` | none | | [The link session](#the-link-session), `devvm _links` | a start or a change of links, for a client with links | when the client stops or has no links, or `devvm stop` | none | | [ssh masters and relays](#ssh-masters-and-relays) | the forwarder, the link session and devvm | with the process that started them | none | | [The QEMU wrapper](#the-qemu-wrapper-and-its-keeper), `devvm _qemu` | Lima, on Linux hosts | with QEMU | QEMU's restricted network, and a user namespace for a VM with `.git` pins | | [The daily tools check](#the-daily-tools-check), `devvm _refresh-tools` | a launch of an existing VM, once a day | when the check is done | none | | [The desktop relay](#the-desktop-relay) | `devvm desktop` | with `devvm desktop` | none | | [The SSH agents](#the-ssh-agents) | you, or `devvm` for devvm's own | devvm's own: at logout or a reboot | none | | [Lima's hostagent](#limas-hostagent) | `limactl start` | when the VM stops | a Seatbelt profile on macOS, for a confined VM or a build | ## How devvm starts them devvm starts the proxy, the port forwarder, the link session and the daily tools check detached, in a session of their own, so they outlive the run that started them and the terminal it ran in ([the packages](../contributing/structure.md#the-packages)). Each gets no input and devvm's environment without `SSH_AUTH_SOCK`, so none of them uses your SSH agent of its own accord, and its output goes to its own log or nowhere. The one exception is a VM's proxy, which relays the agent that the VM's start forwards, named in its config ([the SSH agents](#the-ssh-agents)). devvm marks every file it was given past standard input, output and error close-on-exec as it starts, so a terminal or a pipe that devvm inherited never stays open in them ([things learned](../contributing/design.md#things-learned)). devvm finds such a process again by its pid file and its arguments, and it signals a process only while both still say it's that process, so a pid that the system gave another program since is never signalled. A stop sends `SIGTERM`, waits two seconds, and sends `SIGKILL` only to a process whose arguments are still the ones devvm started. Each signal goes to the process's group, which its own session makes it the leader of, so what it started ends with it, such as the forwarder's and the link session's ssh masters and relays, even when it's killed and can't stop them itself. A forwarder or a link session that gets `SIGTERM` from anything else, such as `kill`, stops its ssh before it exits, waiting up to two seconds for that, as devvm does for its cleanups. A process that devvm waits for, such as the proxy, says it's ready in a status file of its own, which holds its pid and its address, so a file that another process left never counts ([how long a proxy runs](network.md#how-long-a-proxy-runs)). The run that starts a process reaps it if it ends first, and once that run ends, nothing on this machine waits for it. Instead, each one ends on its own. The proxy and the forwarder follow the VM's hostagent through its pid file, `ha.pid`, which is the VM's lifeline, and the link session asks the VM's backend every 5 seconds whether the VM still runs the start it was made for. `devvm stop`, `devvm rm` and `devvm gc --orphans` stop a VM's proxy, forwarder and link session while they still run. ## devvm itself - **Holds:** everything you keep with devvm. It reads secrets from the macOS Keychain with the `security` command or from files only you can read, and it writes each VM's proxy password and the company proxy's credentials into files only you can read, never into a process's arguments ([where secrets are saved](network.md#where-secrets-are-saved)). - **Reads from a VM:** the output of the commands it runs there, such as a VM's host keys, its settings to save and a history export, and the files a VM can write or swap, such as the project folder's `devcontainer.json`. It reads such a file without following a link out of the folder, and with a cap on its size, and each kind of output has a cap of its own, such as 128 MiB for a VM's settings and 2 GiB for a history export ([coding agents](agents.md#saving-a-vms-settings)). - **Writes:** its run log, `~/.local/share/devvm/logs/runs/-