Files
Precious Okwu 4fc571b87c Linux: wait for /_ping before checking restarted socket access (#1260)
After `systemctl restart kiri`, `packaging/linux/test-host.sh` only waited for `-S /run/kiri/docker.sock`. The daemon binds the socket before writing its POSIX access list and booting the engine, leaving a 2 ms race where the unprivileged `setpriv` check ran before socket access was granted and the daemon started accepting requests.

Add a bounded `wait_engine` helper polling `/run/kiri/docker.sock` until `/_ping` returns `OK` (up to 30 s) and use it after both `kiri host-access` and `systemctl restart kiri`.
2026-12-06 10:17:13 +01:00
..
2026-11-26 06:29:29 +01:00

Packaging

How Kiri reaches people on each platform, and what each piece of this directory (and installer/windows) does.

Platform Package Built by Contents
Linux (Debian, Ubuntu) kiri_<v>_amd64.deb, _arm64.deb packaging/linux/build.sh engine + docker CLI, Compose, buildx; the window on x86-64
Linux (Debian, Ubuntu) kiri-lite_<v>_amd64.deb, _arm64.deb packaging/linux/build.sh engine only
Linux (Fedora, RHEL, openSUSE) kiri-<v>-1.x86_64.rpm, .aarch64.rpm, kiri-lite-…rpm packaging/linux/build.sh same two flavours
Windows Kiri-<v>-x86_64.msi cargo xtask msi engine for WSL2, kiri-win.exe, docker CLI, Compose, buildx
Windows on Arm Kiri-<v>-arm64.msi cargo xtask msi --arch arm64 the same, arm64 throughout (docker CLI built from source)
macOS Kiri.app in Kiri-<v>-arm64.dmg (-x86_64 for Intel), Kiri-<v>-<arch>.tar.gz, Kiri Lite cargo xtask release app + CLI tools (DMG for cask, .tar.gz for Homebrew formula); Lite downloads the tools
NixOS / Linux (Nix) kiri and kiri-lite in flake.nix nix build .#kiri engine + Docker CLI, Compose, buildx (kiri), or engine only (kiri-lite), plus nixosModules.default

Two flavours everywhere, with the same meaning: Kiri brings the docker CLI, Compose and buildx so docker run works right after installing; Kiri Lite is the engine alone for people who already have a docker. The CLI versions and their SHA-256s are pinned once, in crates/kiri/src/cli_pins.rs, for all three platforms.

Linux

packaging/linux/fetch-cli.sh target/linux-cli          # docker, compose, buildx, verified against cli_pins.rs
packaging/linux/fetch-forge.sh target/linux-x86_64-musl   # kiri-forge, verified against cli_pins.rs
packaging/linux/build.sh target/linux-x86_64-musl target/packages x86_64 target/linux-cli

A release builds all eight packages (both flavours, .deb and .rpm, x86-64 and arm64) with scripts/ci/linux-build.sh on Ubuntu, zig cross-compiling the arm64 engine; then installs the x86-64 .debs under systemd and runs containers through them (packaging/linux/test-host.sh), and the .rpms the same way on Fedora. Each file goes up with SHA256SUMS-linux.

A v* tag builds Mac, Windows and Linux; each build puts its files on download.runkiri.com with its feeds staged, and the release moves every feed and updates the website once all three are up (RELEASES.md). On a Mac, scripts/ci/linux-packages.sh builds the same packages in a Linux container.

build.sh needs dpkg-deb and rpmbuild (apt install rpm on Debian; both are in WSL Ubuntu). Without the CLI directory it builds only kiri-lite. The binaries come from cargo xtask linux or scripts/windows-engine.sh (static musl, so one package runs on every distro). What the packages do:

  • /usr/bin/kiri, /usr/bin/kiri-init, kiri.service (installed, not started: installing alone runs nothing. The engine starts, and starts at boot, when someone sets Kiri up: the window's Allow access, or sudo kiri host-access $USER. An upgrade leaves a running engine as it is), the kiri group that owns /run/kiri/docker.sock. Members of the kiri group can run containers as root on this machine; treat it like the docker group. State in /var/lib/kiri-daemon (0700), images and containers in /var/lib/kiri (0710); removal keeps them, apt purge deletes them.
  • The full package adds /usr/libexec/kiri/bin/docker with Compose and buildx in /usr/libexec/kiri/cli-plugins, and offers docker on PATH through update-alternatives at priority 10, only when /usr/bin/docker is absent or already an alternatives link: a docker CLI another package owns keeps winning, as on Windows. Compose and buildx go into /usr/lib/docker/cli-plugins the same way, one alternatives link each, so the package installs beside docker-compose-plugin, docker-buildx-plugin and docker-desktop (whose plugins Kiri's docker then uses). A link is made only when Docker's own copy isn't in any of the CLI's plugin folders (/usr/lib, /usr/libexec, /usr/local/lib, /usr/local/libexec …/docker/cli-plugins), and a dpkg trigger (rpm %filetriggerin and %filetriggerpostun) checks again whenever another package changes those folders, so Docker's plugins installed or removed after Kiri still win. Its docker talks to Kiri's socket unless DOCKER_HOST, DOCKER_CONTEXT or a context of your own says otherwise.
  • The x86-64 full package also has the window: /usr/lib/kiri/kiri-window (kiri built with --features window, linking GTK 3 and WebKitGTK 4.1, so the package depends on the window binary's glibc floor and recommends GTK 3 and WebKitGTK 4.1), its launcher in the app menu and the icons. kiri ui starts it, or says which GTK and WebKitGTK packages to install when those shared libraries are absent; where the window isn't packaged (kiri-lite, and the arm64 packages, which zig cross-compiles), kiri ui says so. linux-build.sh builds the window for its own machine's architecture when libwebkit2gtk-4.1-dev is there.
  • Upgrading the package restarts a running engine on the new version, as the Mac and Windows apps do after an update: running containers stop, and those with a restart policy start again.

Tests: packaging/linux/test.sh (package listings, install/remove in privileged Ubuntu and Fedora containers on any Docker-compatible engine, Kiri included; nested, so it proves the files and scripts, not container runs) and packaging/linux/test-host.sh (on a real host or VM with systemd: install, run containers, publish a port, remove; it stops a kiri daemon already running there, so it wants KIRI_TEST_KILL=1).

Not yet: an apt/dnf repository (today the packages are release assets; a repository is what gives apt upgrade), and signing.

Arch Linux

arch/PKGBUILD builds kiri-ui, the desktop window (kiri --features window), for Arch Linux (x86_64 and aarch64, including Omarchy and Asahi). It installs /usr/lib/kiri/kiri-window where kiri ui expects it, plus the application-menu launcher and icons, without replacing an installed Kiri engine, CLI, systemd service, Docker context, or container store. See arch/README.md for build and install steps.

Nix and NixOS

flake.nix builds two packages on x86_64-linux and aarch64-linux, matching the .deb and .rpm split:

  • packages.<system>.kiri (default): kiri, kiri-init, polkit policy and NetworkManager configuration, bundled with pkgs.docker-client, pkgs.docker-compose and pkgs.docker-buildx under $out/libexec/kiri and a $out/bin/docker wrapper (nix build .#kiri).
  • packages.<system>.kiri-lite: the engine alone (nix build .#kiri-lite).
  • overlays.default: adds kiri and kiri-lite to a nixpkgs set.
  • nixosModules.default (also nixosModules.kiri): declarative NixOS service configuration.

Example flake.nix consumer on NixOS:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    kiri.url = "github:libracoder/kiri";
    kiri.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { nixpkgs, kiri, ... }: {
    nixosConfigurations.my-host = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        kiri.nixosModules.default
        {
          services.kiri = {
            enable = true;
            users = [ "alice" ];
            # package = kiri.packages.x86_64-linux.kiri-lite;
            # enableDockerCli = true; # defaults to !config.virtualisation.docker.enable
            # socketGroup = "kiri";
          };
        }
      ];
    };
  };
}

Enabling services.kiri loads the kernel modules Kiri uses (overlay, br_netfilter, nf_tables, tun, loop, veth), turns on IPv4 forwarding and polkit by default, creates services.kiri.socketGroup with services.kiri.users as members, links /libexec/docker/cli-plugins into /run/current-system/sw, configures NetworkManager to leave Kiri's bridges and veths unmanaged, puts NixOS's host tools (kmod, iproute2, util-linux, e2fsprogs, nftables, iptables, coreutils, procps) on the unit's PATH, and runs kiri.service with the same cgroup delegation, resource limits and /run/docker.sock fallback link as packaging/linux/kiri.service.

Homebrew

The official tap is libracoder/homebrew-kiri, which offers both a cask (for the desktop app in /Applications) and a formula (for headless CLI and brew services workflows):

  • Cask (Casks/kiri.rb): brew install --cask libracoder/kiri/kiri. Installs Kiri.app from Kiri-<v>-<arch>.dmg into /Applications, updates in place via Kiri's signed updater, and cleans up setup state on brew uninstall --zap --cask kiri.
  • Formula (Formula/kiri.rb): brew install libracoder/kiri/kiri. Installs the signed, notarized Kiri.app from Kiri-<v>-<arch>.tar.gz (preserving its com.apple.security.virtualization entitlement) under $(brew --prefix)/opt/kiri/libexec/Kiri.app, symlinks $(brew --prefix)/bin/kiri, and defines a brew services LaunchAgent (brew services start kiri). Persisted paths written by kiri setup use the version-independent opt/kiri/libexec/Kiri.app symlink so brew upgrade kiri never leaves stale Cellar paths behind, kiri setup coexists with homebrew.mxcl.kiri.plist without writing a duplicate LaunchAgent, and in-app self-update defers to brew upgrade kiri. Both entries conflict with one another so only one owns the engine at a time.
  • Release automation: mirroring a release to GitHub updates both Casks/kiri.rb and Formula/kiri.rb from SHA256SUMS and opens a pull request on libracoder/homebrew-kiri.