# Updates

*Settings > Updates* shows the running version, checks GitHub for a newer release, shows its
notes and installs it. By default qKVM asks GitHub once a day and shows an **Update**
button in the top bar when there is something new; installing is always your click, and asks
for your password again.

- **What a check sends:** one request to GitHub's public API for the newest release. Nothing
  about your KVMs. Turn the daily check off in the same place if you'd rather not. Its answer
  is waited for a minute at the most, and the package checked against this copy two more.
- **How an install works:** the release is downloaded, its signature and checksum are
  checked, and it is unpacked into `updates/<version>/` in the data folder, next to the running version,
  with the libraries it brings (below). A throwaway process of the same Python then loads it, and only
  then is it named the version to start. qKVM then restarts itself on it. One install at a time; a
  page closed meanwhile leaves it running, and one cut off by a stop says so in the activity log.
- **Only signed releases are installed.** The public half of the publisher's release key is
  built into the program, and a release that does not carry a valid signature is refused. A
  copy built without a release key tells you about new versions and leaves installing them
  to you, unless it is started with `--allow-unsigned-updates`, which accepts a release
  checked by its checksum alone.
- **If the new version won't start,** qKVM goes back to the previous one by itself.
  `qkvm --roll-back` does the same by hand. (The move from 0.1.x to 0.2.0 is made with pip or a
  new image instead: see below.)
- **It brings the libraries it needs** (since 0.3.0's updater). Each release lists, in a file its
  signature covers (`qkvm-<version>-libraries.json`), the exact wheels of every library it was tested
  with, for Python 3.11 to 3.14 on Linux x86-64 and ARM64 (glibc) and on Windows x86-64. A version
  installed in place runs exactly that set: a library your Python already has at that version is
  used from there, one the running version brought is copied from its folder, and every other one
  is downloaded from PyPI's file host (files.pythonhosted.org) by the address the signed list
  gives, held to its checksum, and unpacked into `updates/<version>/lib`. No pip, no package
  index and no build is run, and your Python's own libraries are never changed. *Settings >
  Updates* says what an update brings and how much it downloads before you install it.
- **Where an update cannot be installed in place,** qKVM offers no install and shows the pip
  command for your installation instead (`/opt/qkvm/bin/python -m pip install --upgrade qkvm`,
  say): a computer the release has no build for (macOS, Alpine, 32-bit systems, a free-threaded
  Python, a Python outside 3.11 to 3.14), a release that lists no libraries (one made before 0.3.0,
  or a fork's) and needs newer ones than this computer has, or a version that does not load in
  that trial. pip works at any other time as well; qKVM runs whichever of the two is newer. An
  installed update checks its requirements again before opening the data folder, and a version
  whose libraries were brought for another Python (one upgraded under it) goes back to the
  version before it by itself.
- **Disk space:** a version with its libraries takes up to about 150 MB in the data folder (Linux;
  about 100 MB on Windows), and two versions are kept, the running one and the one to go back to.
  An install needs twice what it unpacks, plus 100 MB, free, and says so before it downloads
  anything. **Backups may leave `updates/` out:** it holds only program files and libraries that
  can be downloaded again, no settings (without it qKVM starts the version pip installed).
- **A container is updated by replacing its image**, not from inside: the app tells you when
  there is a new one.
- **Each release lists what it brings in** (0.4.0 on), in `qkvm-<version>-sbom.cdx.json` beside
  its other files on GitHub: an SBOM in CycloneDX 1.5 of every library that installing the
  version brings in, for each Python and system it is built for (the libraries its signed list
  names), with each one's version, licence where its metadata says it, a package URL
  (`pkg:pypi/...`) and the SHA-256 of its wheels. `SHA256SUMS` lists it, and `SHA256SUMS.sig`
  signs that list. To check a copy you downloaded, put `SHA256SUMS` and `SHA256SUMS.sig` beside
  it and run, where qKVM is installed,
  `python -m qkvm.release verify --signed SHA256SUMS qkvm-<version>-sbom.cdx.json`: it checks the
  signature with the publisher's key built into qKVM, and the file's checksum. (The container
  image carries an SBOM of its own; see [Security](https://github.com/qkvm/qkvm/blob/main/SECURITY.md#checking-what-you-install).)

### Which versions get fixes

- **Before 1.0, only the newest release gets fixes**, security fixes too: they come as the next
  release (0.4.1, 0.4.2, or 0.5.0), and nothing is carried back to an older line, so that the
  program can move fast. An older release gets none: update (it is made to be easy, below).
- **Long-term support starts with 1.0**: from then on some minor versions are kept with
  security fixes for a stated time while newer ones come out, as large projects keep their
  long-term-support releases. Which ones, and for how long, is said here when 1.0 comes.
- **A security fix is announced** by a GitHub security advisory on
  [qkvm/qkvm](https://github.com/qkvm/qkvm/security/advisories) (with a CVE where one is
  given), a *Security* part in its version's chapter of CHANGELOG.md, and the release itself,
  which every wall that checks for updates shows with its **Update** button. Watch the
  repository's releases or advisories on GitHub to hear of them without a wall.
- **An update works from every release of the minor version before it** and of its own: in
  place, with pip or by a new image (to 0.4.x: from 0.3.0 on). From an older release, go to the
  newest release of each minor version between first (from 0.2.2: to 0.3.2, then on). What
  those releases saved (settings, the vault, exports) is carried over by the program itself,
  and a test opens a data folder made by the newest release of the minor version before.
- **Going back to the release an update came from** (by itself, where the new version does not
  start, or with `qkvm --roll-back`) finds what that release saved. What only the newer version
  has (a second alert destination, say) it does not see.

There is no promise of a response time; see [Security](https://qkvm.com/docs/security-policy) for how to report a problem.

### From 0.1.x to 0.2.0, and back

0.2.0 keeps the whole settings file encrypted with a **server storage key** that lives outside
the data folder (see [Security](https://github.com/qkvm/qkvm/blob/main/SECURITY.md#migrating-an-existing-data-folder)). A data folder
of 0.1.x is converted once, with qKVM stopped, by `--migrate-vault`: 0.2.0 does not start on
it before that, and says so. No password is asked for and no device is contacted. Accounts
with their second step and recovery key, tokens and display links, browsers kept signed in,
the KVMs and servers with their saved passwords and groups, the saved actions, the alert
settings and the wall's settings are as they were.

**Up, installed with pip** (the data folder is `~/.qkvm`, or what `--data-dir` names):

1. Stop qKVM, and copy the data folder aside as it is, for example to `~/.qkvm-before-0.2.0`.
   That copy is the way back. Keep it private: it holds the saved passwords as 0.1.x keeps them.
2. `pip install --upgrade qkvm` (or `pipx upgrade qkvm`). Use this for the move from 0.1.x,
   not *Settings > Updates*: an update installed from inside cannot take the offline step.
   Where one was tried and qKVM did not come back, `qkvm --roll-back --data-dir <folder>`
   returns to the version before.
3. `qkvm --data-dir ~/.qkvm --vault-key-file ~/.qkvm.keys/vault.key --migrate-vault`, then the
   same with `--verify-vault`. The key must be outside the data folder; `~/.qkvm.keys/vault.key`
   is where qKVM looks for it when it is started without `--vault-key-file`. Both commands say
   where the key is, never what it is. On Windows write the folders in full, as `~` is taken
   as typed there: in cmd `--data-dir %USERPROFILE%\.qkvm --vault-key-file
   %USERPROFILE%\.qkvm.keys\vault.key`, in PowerShell `$HOME\.qkvm` and `$HOME\.qkvm.keys\vault.key`.
4. Back the key file up separately from the data folder and privately: an encrypted password
   manager entry, or an encrypted offline copy. Without it the settings cannot be opened, and
   no account password or recovery code can stand in for it.
5. Start qKVM as before. A service that names another data folder names its key too, with
   `--vault-key-file` or `QKVM_VAULT_KEY_FILE`.

**Up, in a container.** The key needs a volume of its own, `qkvm-keys` here; a new key is made
only in a folder that is a mount of its own, and qKVM refuses otherwise. The first command
copies the data volume aside as it is (any small image with `cp` does, here `alpine`); that
copy is the way back.

```
docker stop qkvm
docker run --rm -v qkvm-data:/from:ro -v qkvm-data-before-0.2.0:/to alpine cp -a /from/. /to/
docker run --rm -v qkvm-data:/data -v qkvm-keys:/keys qkvm/qkvm:0.2.0 --migrate-vault
docker run --rm -v qkvm-data:/data -v qkvm-keys:/keys qkvm/qkvm:0.2.0 --verify-vault
docker rm qkvm
```

Then run the container again as before, with `-v qkvm-keys:/keys` beside `-v qkvm-data:/data`
(the command under [Run it](https://qkvm.com/docs/run-it) has both). Back the key up as in step 4: copy
`/keys/vault.key` out of the `qkvm-keys` volume straight into the encrypted backup, and keep no
plain copy of it on the host.

**With Compose** the volumes carry the project's name, which is that of the folder the compose
file is in: `docker volume ls` shows them, `qkvm_qkvm-data` for a folder named `qkvm`. Take the
`docker-compose.yml` of 0.2.0 (it adds the `qkvm-keys` volume to the same project), then
`docker compose stop`, copy the data volume aside under its own name, for example
`docker run --rm -v qkvm_qkvm-data:/from:ro -v qkvm-data-before-0.2.0:/to alpine cp -a /from/. /to/`,
then `docker compose pull`, `docker compose run --rm qkvm --migrate-vault`, the same with
`--verify-vault`, and `docker compose up -d`.

At the first start the history (`history.sqlite`) begins. The activity log's index
(`audit.sqlite`) is made from the text files 0.1.x wrote, and the log of qKVM says so, with how
many entries: whatever those files still hold is searched from the first day. (What was written
before 0.2.0 names a machine and gives no id: it is found by the name the machine has now.)

**Back to 0.1.1** means the copy made before the conversion. 0.1.1 cannot read the converted
folder and must not be started on it: it refuses it, and its advice to move the files aside
would leave a new, empty wall that whoever reaches it first can claim. Instead:

- **With pip:** `pip install qkvm==0.1.1` (and, where 0.2.0 came by *Install*, also `qkvm
  --roll-back`), then start qKVM on the copy: `qkvm --data-dir ~/.qkvm-before-0.2.0` (on Windows
  `%USERPROFILE%\.qkvm-before-0.2.0` in cmd, `$HOME\.qkvm-before-0.2.0` in PowerShell: 0.1.1 takes `~` as
  typed, and would start a new, empty wall in a folder called `~`).
- **In a container:** run `qkvm/qkvm:0.1.1` with `-v qkvm-data-before-0.2.0:/data` instead of
  `qkvm-data`. With Compose, put the `docker-compose.yml` of 0.1.1 back and give it the copy:
  under `volumes:`, `qkvm-data: {external: true, name: qkvm-data-before-0.2.0}`.

What changed after the conversion (accounts, devices, settings, the activity of those days) is
not in that copy. Keep the converted folder and its key private until you no longer need them:
together they still open everything.

### Publishing releases

Releases come from the GitHub repository named in `DEFAULT_REPO` at the top of
`qkvm/update.py`, which is `qkvm/qkvm`. Until that repository has a release, the
app says there is nothing newer.

1. A fork that publishes its own releases sets `DEFAULT_REPO = "owner/name"`. Use only a
   repository you control: whoever can publish a release there can run code on every copy
   that installs it.
2. Make a signing key with `python -m qkvm.release keygen release-signing.key`, put the
   printed public key in `RELEASE_KEYS`, and keep the key file out of the repository (the
   `.gitignore` leaves `*.key` out). Copies built with it install a release only if it is
   signed with that key; a copy built without one does not install updates by itself. Either
   sign on your own machine (`python -m qkvm.release sign release-signing.key SHA256SUMS`)
   or let the workflow sign: store the key's contents as the secret `RELEASE_SIGNING_KEY` of
   an environment called `release` (Settings, Environments). Not as a secret
   of the repository, which any workflow on any pushed branch can read. The workflow has
   three environments, each holding what one job needs and named by that job only, so that
   no job can reach another's secret: `release` holds RELEASE_SIGNING_KEY only (the job
   `sign`); `registries` holds DOCKERHUB_USERNAME and DOCKERHUB_TOKEN only (the job `image`);
   `pypi` holds no secret, as PyPI trusts this workflow in that environment (the job `pypi`).
   Every one of the three environments, release, registries and pypi: deployment branches
   and tags set to tags matching `v*` only (no branch), and a required reviewer, the
   project's maintainer, who approves each job that names it, with "Prevent self-review" off
   on all three (the maintainer both pushes the tag and approves, and would otherwise be
   refused). Both are required, not a choice: no job reaches a secret, or publishes, unless a
   person let it in that run (GitHub may or may not ask again when a job of it runs again),
   on a version tag.
   From the state of 2026-10-26 (`release` and `pypi` made so, the Docker Hub secrets still
   in `release`), set it up once, in this order:
   1. Create the environment `registries`: deployment branches and tags "Selected branches
      and tags" with one rule of type Tag, pattern `v*`, and no branch rule; required
      reviewer pypv, with "Prevent self-review" off (pypv both pushes the tag and approves,
      and would otherwise be refused).
   2. Add the secrets DOCKERHUB_USERNAME and DOCKERHUB_TOKEN to `registries`: a token that
      may push to the image's repository, and the name it signs in with. Either a personal
      access token, with Read & Write, of an account that may push to that repository, with
      that account's name as DOCKERHUB_USERNAME: such a token reaches everything its account
      may, so make it an account kept for this alone, with write access to that repository
      only (where the repository belongs to an organization, a member of it given write access
      to that repository and to nothing else); or, where the repository belongs to an
      organization whose Docker plan has them, an organization access token that may push to
      and pull from that repository only, with the organization's name as DOCKERHUB_USERNAME.
   3. Delete DOCKERHUB_USERNAME and DOCKERHUB_TOKEN from `release`, leaving only
      RELEASE_SIGNING_KEY there.
   4. Keep no repository- or organization-level copy of any of the three secrets: those can
      be read by any workflow on any branch that is pushed.
   5. `DOCKERHUB_IMAGE` stays a repository variable (`qkvm/qkvm`); without it the image goes
      to ghcr.io only.
   6. The ghcr.io package qkvm/qkvm gives this repository write access (the package's
      settings, "Manage Actions access", role Write), unless this repository's workflow made
      the package, which then has it already.
   7. Turn on immutable releases before the first draft is published (Settings, General).
   8. Then push the tag, as step 3 below says.

   The workflow uses the key in a job of its own that installs nothing at all: the runner's
   own openssl signs (`python -m qkvm.release publish --openssl`, the very signature the cryptography library
   makes), and an openssl that does not sign as RFC 8032 says is refused. It refuses to
   publish a version that has a key built in unsigned, or signed with another key.
   To change the key later, take two releases for it: one that has both public keys in
   `RELEASE_KEYS` and is signed with the old key, and from the next one on the new key. A
   copy installs only what a key it already has signed, so a release that swaps the key in
   one step passes the workflow and is refused by every copy that is to install it.
3. To cut a release: the test run of the commit to be released is green in every job of
   `.github/workflows/tests.yml` (both systems, every Python, the page in a browser). Set
   `__version__` in `qkvm/_version.py`, write the version's chapter in `CHANGELOG.md`, commit,
   get that commit onto `main`, and push the tag `v<version>` on it (only the organisation's
   admins may make `v*` tags, and nobody may move or delete one). On the tag,
   `.github/workflows/release.yml` refuses a commit that is not on `main`, requires a
   successful Tests workflow for that exact commit, refuses a tag that does not match the
   version in the code, builds the wheel and source archive with build tools pinned by hash
   (`.github/security/build-requirements.txt`) and checksums them at once, and runs the test
   suite once more against the wheel installed by itself (on Linux, with one Python), in a job
   of its own, on a copy held to those checksums; the source archive must hold the tested
   wheel's code file for file, and the wheel nothing but `qkvm/` and its own `dist-info`. It audits the installed wheel, and builds, runs
   and scans both container architectures, before anything is signed. The container policy
   blocks every Python advisory, every fixable OS advisory, every critical advisory, and high
   OS advisories without a current, exact, reviewed exception; unfixed lower-severity OS
   findings remain visible in the retained report, and the native libraries inside the image
   that the scan cannot see are held to the minimums kept in the repository. The policy and
   temporary exceptions are described in [.github/security/README.md](https://github.com/qkvm/qkvm/blob/main/.github/security/README.md).
   It also locks the libraries (`.github/security/make-libraries.py`, with pip and packaging pinned
   by hash): for every Python and system an update is installed in place on, the exact wheels of
   every library the version runs (by the markers of that Python and system, not of the one the
   lock is made on), each held to the checksum PyPI gives, in
   `qkvm-<version>-libraries.json`. The package job and the image are installed from that lock, and
   the suite runs against it on Linux x86-64 and ARM64 and on Windows, with Python 3.11 to 3.14,
   before anything is signed; every library it names is audited.
   The same job makes the release's SBOM, `qkvm-<version>-sbom.cdx.json` (CycloneDX 1.5;
   `.github/security/make-sbom.py`, Python's own library alone): it installs each target's lock and
   the wheel as pip installs them there, from the wheels it downloaded (nothing is fetched, nothing
   of a wheel runs), and reads the metadata of what is installed; what each target holds must be
   what the lock names, library for library.
   Then it signs `SHA256SUMS` (of the wheel, the source archive, the lock, the SBOM and `qkvm-<version>-image.json`,
   the record of what each architecture's scan saw) with openssl in a job that does only that,
   checks the signature with the cryptography library (what every installed copy checks with)
   in a job with no secret, and only then makes a **draft** release of the tag
   with all of them and `SHA256SUMS.sig` attached, reads every file back from the draft and
   checks it against the signature. Nothing has gone to PyPI or a registry yet.

   If a job of the tag's run fails, use Re-run failed jobs: the jobs that failed run again
   with the jobs that wait for them, and the jobs that passed keep what they made (GitHub
   keeps a passed job's outputs and artifacts for the attempts after it). Every upload
   replaces one of its name, and the draft holds the image archives to the IDs each image job
   handed on in its latest successful run, letting an earlier attempt's be. As the signed files are
   kept one day only (a valid signature over a build nobody has published yet is no file to
   leave lying about), when `signature` or `draft` is to run again more than a day after
   `sign` ran, open the job `sign` and use Re-run this job: it signs anew, and `signature` and
   `draft` run after it (GitHub runs again the jobs that wait for the one it runs again).
   GitHub may or may not ask again for the approval of an environment when a job that names
   it runs again; where it does not, the key then signs again, in a run a person already let
   it sign in, the same bytes held to the same hashes, and the rule that no job reaches a
   secret unless a person let it holds for each run, not for each attempt of it. A draft job
   that failed after it made the draft leaves that draft: delete it before the job runs
   again, and never publish it. A run can be run again within
   30 days of the tag, which is as long as GitHub lets a run be run again; after that, only a
   new version makes a draft. Never, once the tag has a draft or a published release, use
   Re-run all jobs in the tag's run, or run `images_amd64` or `images_arm64` again, or a job
   they wait for (`tested_commit`, `build`: Re-run this job on either runs the image jobs
   again too, as it runs again every job that waits for it): the image jobs would put new
   archives in the place of those its signed record names (or beside them, where GitHub
   keeps both; a download by name then takes the newest), and the publication would refuse
   them. Done anyway while the tag has only a draft, `sign` runs again with the new archives
   and signs them: delete the draft, then use Re-run failed jobs for the `draft` job that
   stopped on it (more than a day after `sign` ran, Re-run this job on `sign`). Done once the
   release is published, the archives its signed record names are replaced (every upload
   replaces one of its name), and that version is lost: the publication refuses it, and only
   the next version can be published. Never make, change or add to a release of the tag by
   hand. The container archives the
   publication pushes are kept with that run for 90 days, so the repository's artifact and
   log retention (Settings, Actions, General) must be at least 90 days: a shorter one cuts
   them short.
4. Review the draft (its files, and its text: write what the version brings) and publish it.
   Publish only a draft whose run is green: a draft can exist although a check after its
   making failed (the run then says so, in red).
   Publish it yourself, in the browser or with your own `gh`: a release published by the
   workflow's own token starts nothing. Publish it as a final release: one ticked
   "Set as a pre-release" is refused before anything goes out, and run again it is refused
   again (the publication's run keeps what the release was when it was published); the
   release is immutable by then, so only a new version mends it. Its publication runs the second half of the workflow.
   First, with no secret, every file of the published release is checked against the signature
   (a file the signed list does not name stops it, so add none to the draft), and the container
   archives the signed image record names, kept by the tag's run, against the checksum and
   digests the scan saw; nothing goes anywhere unless all of it holds. Then the registries get
   those archives, and every tag is read back; last, PyPI gets the wheel and source archive
   taken from the published release, after each is checked against the signed `SHA256SUMS`
   (an image can be pushed again, an upload to PyPI is for good). The archives are kept for 90
   days: publish the draft before the date its text gives. The image tags `latest` and `X.Y`
   move only to the newest released version (of all, and of its line); a fix to an older line
   gets its full version and its line's tag only. That is decided right before they move, in
   one image job at a time across every version: publish two versions close together and the
   second waits for the first. GitHub keeps one waiting job there: should a third queue while
   one runs and one waits, the one that was waiting is cancelled, before it started, and the
   third waits in its place. Look for an image job cancelled that way; Re-run all jobs of
   that publication's run mends it. GitHub's own "Latest" label is yours: the
   publish page's "Set as the latest release" box decides it, and it is what every installed
   copy asks GitHub for (`releases/latest`) to find an update. Untick it when you publish a
   fix to an older line after a newer version; the workflow warns where the label is not on
   the newest version. A published release is immutable (turn on immutable releases
   in the repository's settings): no file of it is changed afterwards, by the workflow or
   anyone, and a mistake is mended by the next version. What the publishing accounts need set
   up once is written at the top of the workflow.

   If a job of the publication's run fails, mend what it says and use Re-run failed jobs in
   that run (the publication's run, not the tag's): that is safe for each of its jobs.
   `published` failed: nothing has gone anywhere; run again, it checks everything again
   (archives that expired, or a release published as a pre-release, fail again, and only a
   new version mends those). `image` failed (on a first release most likely a wrong Docker
   Hub token or a ghcr.io package without write access for this repository; `pypi` is then
   skipped): mend the setting and run it again; it holds the archives to the signed record
   again, pushes them by their digests (an image can be pushed again), names the tags anew
   and reads them back, and `pypi` runs after it. `pypi` failed: run it again; it takes the
   files from the published release and holds them to the checked list again, so it sends
   the very same bytes. PyPI never takes a second, different file under a name it has had,
   even one deleted since; the same file sent again is, as far as is known, answered as one
   it has already, not refused.
5. The project's sites (the documentation is this README, page by page) are built after the
   release, not before: their build refuses to go out while the version in `qkvm/_version.py`
   is not on PyPI and published as a GitHub release yet, so that no page says
   `pip install qkvm`, or links to a release, for a version nobody can have.
