Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

103.6. crun-1.29.1

OCI container runtime written in C, with a small memory footprint

Version 1.29.1, release 1
Shelf containers — Container runtimes, image tools, container networking and sandbox primitives
Phase 41_system (System), 306 of 1047 in build order
Licence GPL-2.0-or-later AND LGPL-2.1-or-later
Homepage https://github.com/containers/crun
Build time 0.7 SBU
Installed size 2.5 MiB in 5 files
Recipe ports/core/containers/crun/kpkgbuild

About

crun is an OCI runtime: the program that takes a container’s configuration and root filesystem and starts its processes in new namespaces and cgroups, with the capabilities, seccomp filter and mounts the configuration asks for. podman and buildah depend on it, and the shipped /etc/containers/containers.conf names it as the runtime, with cgroupfs as the cgroup manager because there is no systemd to delegate one (see Containers). A KDOS box is a rootless Podman container (see kdos-appbox), so every boxed application starts through crun.

The package is the crun program and its manual page, with libcrun.a, the static library the program is linked from. No shared libcrun is built.

Sources

Dependencies

Depends on: json-c, libcap, libseccomp, argp-standalone.

Required by (2): buildah, podman.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install crun'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/containers/crun.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/containers/crun
echo 'b6be9fd9613efe5df414c568ddfaf09857c72ec17a00999f15c132a3d9e120fd  crun-1.29.1.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/crun
SRC=$SRC_ROOT/crun-1.29.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf crun-1.29.1.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/kill-all-without-cgroup.patch"
./autogen.sh
./configure \
	--prefix=/usr \
	--disable-systemd \
	--enable-embedded-blake3 \
	--disable-criu \
	--disable-shared \
	--enable-static
make
make DESTDIR=$PKG install

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/crun, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf crun-1.29.1-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/crun, and runs the triggers its paths call for.

Contents

Installed programs: crun.

Installed libraries: libcrun.a.

Installed directories: /usr/share/licenses/crun.

Short descriptions

crun a fast and lightweight OCI runtime

Notes

crun parses its command line with argp, which glibc provides and musl does not; configure stops with argp functions not found unless a library supplies argp_parse, which is why argp-standalone is in depends.

kill-all-without-cgroup.patch makes crun kill --all, and the kill inside crun delete --force, signal the container’s own process and every process descended from it when the container has no cgroup. Without it, a container that shares the host’s process namespace cannot be stopped on KDOS.

Why such a container has no cgroup, and why it needs kill --all:

Unpatched, kill --all walks the empty cgroup path, signals nothing and reports success. Podman then waits for a process that never exits: podman stop, distrobox rm --force and distrobox stop fail with given PID did not die within timeout, and the container stays Stopping until the machine restarts.

What the patch does, when there is neither a cgroup nor a pid namespace:

A process that podman exec or distrobox enter started descends from its own conmon, not from the container’s process, so it outlives the stop, as it does on any host without a delegated cgroup.

The patch is to be offered upstream to crun.