Skip to content
These docs are for the next devvm, which isn’t released yet. The docs for the current release are at devvm.dev.
Installing and updating

Installing and updating

This page explains what devvm’s install script downloads and checks, what devvm doctor checks and what devvm doctor --json reports, where devvm keeps its own files, what happens to older versions when you upgrade, and how devvm upgrade checks and installs a release. Installing and Upgrading and uninstalling cover the commands you run.

The install script

The script installs the release it comes with, or the one that --version names, which may be a prerelease, such as 0.2.0-rc.1. Without either, it installs the latest release, never a prerelease. Before it downloads anything, it checks whether Homebrew installed devvm, which it does when brew is on PATH. The check never runs brew, because Homebrew can download its own Ruby when it runs. Instead, the script looks for a version folder in Cellar/devvm or Cellar/devvm-rc, the kegs of Homebrew’s two formulas, in each place Homebrew keeps its Cellar: the folder next to the brew it found on PATH (<brew's folder>/../Cellar), HOMEBREW_CELLAR and HOMEBREW_PREFIX/Cellar when they’re set, and the Cellar in /opt/homebrew, /usr/local and /home/linuxbrew/.linuxbrew. When Homebrew has devvm, the script stops with an error that says to run brew upgrade devvm, or brew uninstall devvm first, each naming devvm-rc for its keg, and exits with status 1, in a terminal or without one. --force skips this check. Then it installs in four steps:

  1. It downloads the archive for this machine and the release’s SHA256SUMS, over HTTPS only. The archive is devvm-<version>-<os>-<arch>.tar.gz, where the OS is darwin or linux and the processor is arm64 or amd64. On Apple silicon, the script picks arm64 even when it runs under Rosetta.
  2. It checks the signatures of SHA256SUMS, then the archive’s checksum, as the signature describes. When either check fails, it installs nothing.
  3. It puts devvm, which is one binary with its README, changelog and license, in ~/.local/lib/devvm/<version>, and links ~/.local/bin/devvm to it. When ~/.local/bin isn’t on PATH, the script says how to add it.
  4. Unless you pass --no-deps, it runs devvm doctor --json and offers the fixes that devvm reports, asking before each one. Then it runs devvm doctor, which shows doctor’s warnings too, even when nothing is missing.

At the end, when ~/.local/bin is on PATH, the script looks up which devvm PATH finds first with command -v devvm. It resolves that path’s links and those of ~/.local/bin/devvm with readlink -f, and when they differ it warns, naming the other copy’s path and saying to remove it or to put ~/.local/bin first. It only looks the other copy up and never runs it. When ~/.local/bin isn’t on PATH, the script prints only how to add it, so you don’t get both.

devvm doctor makes the same check. It looks up devvm on PATH, resolves its links and those of the running binary, and when they differ it prints a warning naming both. It skips the check when no devvm is on PATH. The warning doesn’t change its exit status, and --json lists it among the warnings rather than the problems, so the install script doesn’t offer it as a fix.

The signature and what it trusts

curl … | bash trusts everything in the release, and Homebrew checks the same archive against a checksum kept outside it. Both install the release’s own binary, the one SHA256SUMS lists and its signature covers, and Homebrew installs only the binary from it:

How each install checks the releaseIn the GitHub release, install.sh, with the public key, checks the signature on SHA256SUMS, signed in .minisig, and SHA256SUMS checks the archive for this machine. Homebrew's formula, in a repository of its own, checks the same archive against its own checksum.the GitHub releasechecks the signaturechecks the checksumchecks its checksuminstall.sh, withthe public keySHA256SUMS,signed in .minisigthe archivefor this machineHomebrew's formula,in a repository of its own

The release’s SHA256SUMS lists the checksums of its archives and of its install.sh, and minisign signatures beside it say who made it. devvm has room for three release keys, CI’s, the co-signer’s and a recovery key, and a script that holds them accepts SHA256SUMS when any two of them signed it, each in its own file, SHA256SUMS.ci.minisig, SHA256SUMS.cosign.minisig or SHA256SUMS.recovery.minisig. Each signature must check out with its own file’s key, two different keys must have made them, and each one’s trusted comment, which minisign’s global signature covers, must be devvm-release <version> for the version being installed, so a SHA256SUMS signed for another release is refused. The script also accepts the signature of the old release key, the maintainer’s minisign key, which has signed every release so far, in SHA256SUMS.minisig, with the trusted comment devvm <version>. While releases bridge from that key to the three, that signature alone is enough, so the script can install a release from before the three keys, and the devvm upgrade of a devvm from before them can check a release from after, because each release is signed by the old key too.

The release keys aren’t made yet, so the script holds none, and it checks the old key’s signature alone, never downloading the release keys’ signatures. Once they’re made, their public halves are in the script, and the old key’s is in the script that comes with a release. Without minisign (brew install minisign), the script says that only the checksum is checked, which can’t tell who made the release, prints the commands to check the signatures by hand, and checks only the checksum. A script that isn’t from a release has no old key, so for a release without the release keys’ signatures it also checks only the checksum, and until the release keys are made it has none of those either, so it checks only the checksum of every release.

The signature catches an archive or a SHA256SUMS that someone replaced, which the checksum alone can’t. It can’t catch a release that was replaced whole, because curl … | bash runs the install.sh from that same release, key included, so the one-liner trusts GitHub’s release files. Homebrew doesn’t trust them, because the formula’s checksum lives in a repository of its own, and a replaced GitHub release wouldn’t match it. You can also download install.sh, read it and check it with the key from these docs before you run it, which catches a replaced release too, because that key doesn’t come from the release.

Checking the install script

The release key’s public half is:

RWSjzFsn7ETaijKJ2y7F4DtZobXmyv+LmdclJwZP/KmAkLUwOCzWF/2b

devvm’s README and security policy show the same key. To check the install script with it, you need minisign (brew install minisign). Download the script, SHA256SUMS and its signature from the release:

base=https://github.com/devvmhq/devvm/releases/latest/download
curl -fsSL -O "$base/install.sh" -O "$base/SHA256SUMS" -O "$base/SHA256SUMS.minisig"

Then check that the release key signed SHA256SUMS, check the script against it, and run the script once both checks pass:

minisign -Vm SHA256SUMS -P RWSjzFsn7ETaijKJ2y7F4DtZobXmyv+LmdclJwZP/KmAkLUwOCzWF/2b
shasum -a 256 -c --ignore-missing SHA256SUMS
bash install.sh

minisign prints Signature and comment signature verified and a trusted comment that names the release, as in Trusted comment: devvm 0.1.0, and shasum prints install.sh: OK. On Linux without shasum, sha256sum -c --ignore-missing SHA256SUMS does the same. When either check fails, don’t run the script. The script takes the same options as curl … | bash -s --, as in bash install.sh --yes, and it still checks the signature and the archive’s checksum itself, as the install script describes.

What devvm doctor checks

devvm doctor checks what Lima, devvm’s backend, needs. It lists everything that’s missing, each with what to do, which is the command that installs it when there’s one to run. It then lists what Lima can do, which it calls Lima’s features, each as native, emulated, unreviewed for an emulation that devvm refuses until it’s reviewed, or none. It also says whether Docker is installed, which only --from with an image only Docker has needs. When HTTPS_PROXY is set and ~/.config/devvm/ca has no CA certificates, it says that a proxy that inspects TLS needs its CA there (a company’s CA).

It warns in these cases:

  • another devvm comes first on your PATH (one devvm),
  • the disk that devvm’s images and VMs go on has less free space than building base needs (free space),
  • this machine has less than the 8 GiB of memory or the 4 CPUs that devvm recommends (requirements),
  • a line of your policy files isn’t a rule, which VMs’ proxies skip (rules),
  • a VM’s state, its vm.json, can’t be read, or has a section that the package which owns that section can’t read, as every command also checks for the VM it finds for a folder. doctor names the VM, or its folder when the file can’t be read, and gives the reason, which names the file, and it leaves the file as it is. It doesn’t check a value that reads but that a launch refuses, such as a size that isn’t a number (a file devvm can’t read),
  • a running VM’s proxy runs without its sandbox, or with only part of it, such as on a Linux kernel whose Landlock is older than ABI 6. The proxy writes how it’s confined in the VM’s run/proxy.confined once it starts, and doctor names what that file says. doctor also names a proxy with no such file that another devvm binary started, which it tells by the devvm_sha256 in the proxy’s config, because that’s an older devvm’s single process, which has no sandbox. A proxy that this devvm started and that hasn’t written the file yet is still starting, so it gets no warning (the proxy runs without a sandbox).

It also gives a tip, which isn’t a warning, when safe.bareRepository isn’t explicit in your global or system git config, or in the files that GIT_CONFIG_GLOBAL and GIT_CONFIG_SYSTEM name: git then takes any folder shaped like a git folder for a bare repo, so a VM can make one that git run below it uses (bare repos). doctor only reads the setting.

Then it says devvm has everything it needs, or it fails. The warnings and tips never make it fail, so a small machine with everything installed passes.

devvm doctor –json

devvm doctor --json prints what doctor finds as one JSON object, for scripts such as the install script, as output for scripts describes. It prints nothing else, because its problems and warnings are in the JSON, and it succeeds whatever is missing. A failure that stops the check, such as a data folder devvm can’t read, still goes to standard error and makes it fail.

  • backend is the backend that doctor checked, lima, which every new VM gets.
  • problems has what that backend is missing, each with its key, the fix command, and the message that devvm doctor prints for it. The fix is a command whose words are separated by spaces, without shell syntax, or null when there’s none to run, for example when virtualization is turned off in the firmware.
  • warnings has the messages of doctor’s warnings, which have no keys, because there’s nothing for a script to fix. They’re about another devvm on PATH, low free space, a machine with less than 8 GiB of memory or fewer than 4 CPUs, each line of ~/.config/devvm/policy, ~/.config/devvm/layers/*.policy and ~/.local/share/devvm/vms/*/policy that isn’t a rule (policy_not_rule), and each running VM whose proxy runs without its sandbox (proxy_unconfined and the proxy_unconfined_* messages, one for each reason).
  • tips has the messages of doctor’s tips, which aren’t problems: git’s safe.bareRepository (doctor_git_bare).
  • docker says whether Docker is installed, which only --from with an image that only Docker has needs.
  • features has, for each backend, how it has each feature, as native, emulated, unreviewed or none. The example below shows two of Lima’s features.
{
  "version": 1,
  "backend": "lima",
  "problems": [
    {
      "key": "lima",
      "fix": "brew install lima",
      "message": "Lima isn't installed. Run brew install lima to install it."
    }
  ],
  "warnings": [],
  "tips": [],
  "docker": true,
  "features": {
    "lima": {
      "agent-forwarding": "native",
      "disk": "native"
    }
  }
}

These are the keys:

KeyMissingFix
os, archa host the backend runs onnone
macosmacOS at the backend’s minimumnone
limaLima at its minimum, workingbrew install lima (upgrade, reinstall) with Homebrew, otherwise none
qemuQEMU, on Linuxyour package manager’s install (apt, dnf, pacman or zypper), otherwise none
kvm/dev/kvm, on Linuxnone: turn on virtualization
kvm-accessaccess to /dev/kvmsudo usermod -aG kvm USER, then log in again
lima-configno Lima global configs in devvm’s Lima home (details)none: move them out

The install script reads problems with awk, so it needs no JSON tool on this machine. It relies on the layout that devvm writes, with one field on each line, and it reads a problem’s key, fix and message from their lines, with their escapes undone. It offers to fix three of these keys, asking first, and prints the message for the others:

  • For lima, it runs the fix when there is one, which is Homebrew’s. Without Homebrew, it offers Lima’s latest release instead, which it checks against that release’s SHA256SUMS and installs into ~/.local.
  • For qemu and kvm-access, it runs the fix when there is one, and the fix uses sudo. After you join the kvm group, the script doesn’t run devvm doctor, because the group applies only to new logins, and it tells you to log out and back in first.

With --yes, the script answers yes to every question. Without a terminal and without --yes, it installs none of the fixes and says so.

devvm’s own files

devvm is one binary. Its own files are built into it, so a copy of it runs anywhere. They are base.yaml, base’s scripts and policy, the features, the shared tools’ config and build script, what devvm sends into VMs, and --from’s conversion. The binary is the only copy, and devvm never writes them to a folder of its own that outlives a run. Lima gets base.yaml on limactl create’s standard input, VMs’ proxies read devvm’s built-in policies from the binary, and --from’s build writes the conversion’s scripts into its own temporary folder, which it deletes when the build ends. So editing a file on disk can’t change devvm’s built-in rules or what goes into an image.

Upgrading

When the script installs a new version, it removes the older versions in ~/.local/lib/devvm, except a version that a running VM’s proxy, or QEMU on Linux, still runs. A later install removes that version once nothing runs it. A VM’s proxy moves to the new version at the VM’s next launch (devvm in its folder), and QEMU moves when the VM next starts.

devvm upgrade

devvm upgrade installs a release in Go, with the same files and checks as the install script, and it never runs the script. It reads the newest release’s version from where GitHub’s releases/latest redirects, releases/tag/v<version>, as the script does, so it needs no API and has no rate limit. Every request goes over HTTPS, and a redirect to anything else is refused.

GitHub’s releases/latest skips the releases marked as prereleases, which are the versions with a suffix, such as 0.2.0-rc.1. devvm upgrade, the daily release check and the install script also refuse a prerelease there, so none of them installs or announces one as the newest release, and a prerelease is installed only when --to or the script’s --version names it. A record of the daily check that names a prerelease as the newest release counts as no record, and the next check replaces it. Versions compare as semver orders them: the numbers as numbers, a prerelease before its release, and a prerelease’s suffix part by part, a number below a word and numbers as numbers, so 0.2.0-rc.9 comes before 0.2.0-rc.10.

Homebrew’s devvm-rc formula is the one exception, because it follows prereleases. For a devvm that devvm-rc installed, devvm upgrade and the daily check read the repository’s releases feed, releases.atom, which lists the newest releases, prereleases among them, and needs no API either. The newest version in it, a prerelease or a release, is the newest release for that devvm. The daily check records it as newest in its record, beside latest, the newest release in the feed that isn’t a prerelease, which stays as it was when the feed lists only prereleases.

How it tells how devvm was installed

It follows the links of the running binary’s path, and it reads only that path, never running anything:

  • It’s the install script’s when the binary is devvm in <prefix>/lib/devvm/<version>, with a release’s version as the folder’s name, and <prefix>/bin/devvm is a link that resolves to that same binary. The prefix comes from the binary’s own path, so DEVVM_PREFIX needs no setting.
  • It’s Homebrew’s when the path has Cellar/devvm/ in it, a keg of Homebrew’s devvm formula, or Cellar/devvm-rc/, a keg of its devvm-rc formula, which follows prereleases.
  • Anything else is another way. A devvm whose version isn’t a release’s, such as a checkout’s pseudo-version or (devel), was built from the source. One with a release’s version that wasn’t set when it was built, as go install gives, was installed with go install. One that has a release’s version is a copy of a release somewhere else.

The release keys and the signatures

The public halves of the three release keys, CI’s, the co-signer’s and the recovery key’s, are built into devvm from packaging/keys, the same keys the script holds, once they’re made. Until then devvm has none of them, and checks each release with the old release key alone, so a release that only the release keys signed is refused. The old release key’s public half is built in too, from packaging/minisign.pub, the file the script that comes with a release gets its key from. So devvm upgrade trusts the keys in the devvm you have, never ones that come with the release. A key that devvm can’t read is no key, and so is a set of release keys with a key missing or with one key in two roles, and devvm upgrade refuses to install a release without a key it can read.

devvm checks minisign’s signatures itself. Each signature file holds a signature and a trusted comment, each signed with the file’s key. devvm accepts only minisign’s default, prehashed signature, marked ED, which is Ed25519 over the BLAKE2b-512 hash of SHA256SUMS, and refuses the legacy one, marked Ed, over the file itself. The signature’s key ID must be its key’s, and the global signature, Ed25519 over the signature followed by the trusted comment, must verify too. devvm accepts SHA256SUMS in either of two ways:

  • Two of the three release keys, in a devvm that has them: it downloads SHA256SUMS.ci.minisig, SHA256SUMS.cosign.minisig and SHA256SUMS.recovery.minisig, and checks each against its own role’s key, never another’s. Two of them must check out, with the trusted comment devvm-release <version> exactly, and two different keys must have made them, as each role’s key is a different key with a different key ID.
  • The old release key, while releases bridge from it: when two of the release keys’ signatures don’t check out, it downloads SHA256SUMS.minisig and checks it against the old key, with the trusted comment devvm <version>, as the release script writes it. Every release so far is signed this way, and so is each release while the bridge lasts, so the devvm upgrade of 0.1 and 0.2, which knows only this key, can check it. While the bridge lasts, a release that only the old key signed is still accepted.

Either way, a SHA256SUMS signed for one release can’t stand in for another’s, and a signature of one form can’t stand in for the other’s, because their trusted comments differ. When neither way checks out, devvm upgrade installs nothing, and it says the signatures couldn’t be downloaded when none of them could. Then the archive for this machine, devvm-<version>-<os>-<arch>.tar.gz for the binary’s own OS and processor, must match its line in SHA256SUMS.

The archive is unpacked into <prefix>/lib/devvm/.<version>.new.<pid>, beside the version that runs. Only its one top-level folder and the regular files in it are unpacked, at most 512 MiB in all, and an archive with a link, a folder inside that one, or a path out of it is refused. devvm is unpacked with mode 755 and the other files with mode 644.

Rollbacks

A server, or someone in the way of one, can offer an older release that’s still properly signed. devvm upgrade refuses a newest release older than the running devvm, whatever the flags, and installs an older one only when --to names it, after a question that says it’s older. When the running devvm is a prerelease, an older newest release is what’s expected before the prerelease’s own release is out, so devvm upgrade says so and installs nothing, without failing. It can’t tell a server that keeps offering the release you already have from one with nothing newer, which is a limit of reading the newest release from the server.

Switching the link

  1. The unpacked folder’s devvm runs with --version, which must print the release’s version.
  2. The folder is renamed to <prefix>/lib/devvm/<version>. A folder of that version from before is set aside first, and it’s put back if a later step fails.
  3. The link switches in one step: a new link to the new devvm is made beside <prefix>/bin/devvm and renamed over it, so the link is never missing or half made.
  4. The new devvm runs again, through the link. When it fails, the link is switched back to the devvm that ran devvm upgrade, and the new folder goes.

Then devvm upgrade removes the other versions in <prefix>/lib/devvm, as the script does: it keeps the new version, the one that ran devvm upgrade, and any version that a running process’s command line names, such as a VM’s proxy, which it lists with ps. When ps fails, it keeps them all. An interrupted upgrade leaves a .<version>.new.<pid> folder at most. The next upgrade removes it once no process has that pid, so it never takes the folder of an upgrade that’s still running, and the script’s next install removes it too.

With Homebrew, devvm upgrade runs brew upgrade devvm, or brew upgrade devvm-rc for a devvm-rc keg, into the run log, after asking, and checks nothing of its own, because Homebrew checks the source against the formula’s checksum.

The release check

When you run devvm in a terminal, it checks at most once a day for a newer release (the release check). The check reads only where GitHub’s latest devvm release is, over HTTPS, and sends nothing about you or your machine. The latest release is never a prerelease, so the check never announces one. The exception is a devvm that Homebrew’s devvm-rc formula installed, which follows prereleases: its check reads GitHub’s list of devvm’s newest releases instead, as devvm upgrade describes, and it announces a newer prerelease or release, whichever is newest.

The check runs beside the launch, so it never makes devvm wait, and when you’re offline it says nothing and tries again the next day. The line comes from what the last check found, so a release that came out since then shows up at the launch after the next check. devvm keeps what the check found in ~/.local/share/devvm/cache/release.json, and devvm doctor shows it.

Last updated on