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

237.1. podman-6.1.2

Daemonless container engine for OCI containers

The build-state snapshot was taken from 6.1.2-2; this recipe is 6.1.2-4, so the size, time and contents below describe the earlier build.

Version 6.1.2, release 4
Shelf containers — Container runtimes, image tools, container networking and sandbox primitives
Phase 43_toolkits (Toolkits), 78 of 344 in build order
Licence Apache-2.0
Homepage https://podman.io/
Build time 2.3 SBU
Installed size 83.4 MiB in 249 files
Recipe ports/core/containers/podman/kpkgbuild

About

Podman is a container engine that needs no daemon and runs as an ordinary user. In KDOS it is what a box is: every catalogue application runs in a rootless Podman container of its own, which kdos-appbox creates (with podman create over the application’s image for a store box, podman create --rootfs for a pack), starts with podman start and enters with podman exec, and the catalogue’s images are built with podman build on the machine that installs them. A development box over somebody else’s image is made with distrobox create instead. distrobox, podman-tui and lazydocker sit on top of it. The launch path is in kdos-appbox.

The port differs from a plain upstream build in three ways, the last two because KDOS has no systemd:

Its configuration in /etc/containers belongs to containers-common, not to this package, because buildah and skopeo read it too; the settings are in Containers.

Why it is in KDOS

The comment above it in script/phases/43_toolkits/packages.d/containers.txt:

Daemonless, rootless containers for boxed applications.

Sources

Dependencies

Depends on: go, python3, containers-common, catatonit, conmon, crun, netavark, aardvark-dns, passt, fuse-overlayfs, libseccomp, gpgme, sqlite, gettext, go-md2man.

Required by (4): distrobox, kdos-appbox, lazydocker, podman-tui.

Patches

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

0001-exclude-systemd-commands-build-tag.patch adds the exclude_systemd_commands build tag. Upstream 6.1.2 has no tag or flag that leaves out any of the three systemd commands.

The patch puts a //go:build !exclude_systemd_commands constraint on cmd/podman/generate/systemd.go and on cmd/podman/auto-update.go. podman auto-update restarts each container through the systemd unit its PODMAN_SYSTEMD_UNIT label names, so on KDOS it can only fail; nothing else in package main refers to the file’s symbols. The import that registers podman quadlet moves from cmd/podman/main.go into a new cmd/podman/main_quadlet.go under the same constraint.

The description of podman generate takes its examples from a constant defined twice in package generate: generate_examples_systemd.go, under !exclude_systemd_commands, names “Kubernetes YAML or systemd units”, and generate_examples.go, under exclude_systemd_commands, names “Kubernetes YAML”.

The tag is opt-in, so a build without it is upstream’s binary unchanged. The patch’s documentation hunks are not behind the tag and change the manual pages in every build: they drop the systemd row from podman-generate(1)’s command table, and the podman-auto-update and podman-quadlet rows, the Quadlet paragraph and the two Quadlet entries under SEE ALSO from podman(1), so the installed pages do not list commands the binary lacks.

The code hunks are to be offered upstream; the documentation hunks are KDOS’s own and are not part of that offer.

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/43_toolkits/phase.env && kpkg install podman'

What kpkg does

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

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/podman
echo 'a4b2b10bd560cf9b4c50c282bd04bb74486ff6c78bebd51427f779fe985fc1bb  podman-6.1.2.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/podman
SRC=$SRC_ROOT/podman-6.1.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf podman-6.1.2.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 -Np1 -i "$PORT_SRC/0001-exclude-systemd-commands-build-tag.patch"

export BUILDTAGS="seccomp libsqlite3 exclude_graphdriver_btrfs exclude_systemd_commands"
export REMOTETAGS="remote containers_image_openpgp exclude_graphdriver_btrfs exclude_systemd_commands"

export GOFLAGS="$GOFLAGS \"-ldflags=-s -w\""
make BUILDTAGS="$BUILDTAGS" \
	REMOTETAGS="$REMOTETAGS" \
	EXTRA_LDFLAGS="-s -w" \
	PREFIX=/usr \
	ETCDIR=/etc \
	BINDIR=/usr/bin \
	LIBEXECPODMAN=/usr/lib/podman \
	GOMD2MAN=/usr/bin/go-md2man \
	binaries docs

make DESTDIR=$PKG \
	PREFIX=/usr \
	ETCDIR=/etc \
	BINDIR=/usr/bin \
	LIBEXECPODMAN=/usr/lib/podman \
	install.bin install.remote install.man install.completions install.docker

rm -rf "$PKG/usr/lib/systemd" "$PKG/usr/lib/tmpfiles.d" "$PKG/usr/share/user-tmpfiles.d" "$PKG/usr/lib/podman/quadlet"
rm -f "$PKG/etc/profile.d/podman-docker.csh" "$PKG"/usr/share/man/man5/podman-*.unit.5 "$PKG"/usr/share/man/man5/quadlet.5 "$PKG"/usr/share/man/man1/podman-generate-systemd.1 "$PKG"/usr/share/man/man1/podman-quadlet*.1 "$PKG"/usr/share/man/man7/podman-quadlet*.7 "$PKG/usr/bin/podmansh" "$PKG/usr/share/man/man1/podmansh.1" "$PKG/usr/share/man/man1/podman-auto-update.1"

install -d "$PKG/usr/bin"
cat > "$PKG/usr/bin/kdos-podman-api" <<'KDOS_SH'
#!/bin/sh
# kdos-podman-api COMMAND [ARG...] — run COMMAND against this user's Podman
# API socket, starting `podman system service` first if nothing answers on it.
case "$1" in
-h|--help)
	echo "usage: kdos-podman-api COMMAND [ARG...]"
	exit 0
	;;
''|-*)
	echo "usage: kdos-podman-api COMMAND [ARG...]" >&2
	exit 2
	;;
esac
if [ "$(id -u)" = 0 ]; then
	_dir=/run/podman
else
	_dir="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/podman"
fi
_sock="$_dir/podman.sock"
_idle=300

_answers() {
	podman --url "unix://$_sock" version >/dev/null 2>&1
}

if ! _answers; then
	mkdir -p "$_dir" || exit 1
	(
		flock 9
		if ! _answers; then
			rm -f "$_sock"
			env -u CONTAINER_HOST -u CONTAINER_CONNECTION \
				setsid podman system service --time="$_idle" \
				"unix://$_sock" </dev/null >/dev/null 2>&1 9>&- &
			_i=0
			while [ "$_i" -lt 100 ] && ! _answers; do
				sleep 0.1
				_i=$((_i + 1))
			done
		fi
	) 9>"$_dir/.kdos-api.lock"
	_answers || {
		echo "kdos-podman-api: nothing answers on $_sock" >&2
		exit 1
	}
fi

DOCKER_HOST="unix://$_sock"
export DOCKER_HOST
if [ -z "${CONTAINERS_CONF_OVERRIDE:-}" ]; then
	printf '[engine]\nactive_service = "kdos-local"\n\n[engine.service_destinations.kdos-local]\nuri = "unix://%s"\n' \
		"$_sock" > "$_dir/kdos-api.conf.$$"
	mv -f "$_dir/kdos-api.conf.$$" "$_dir/kdos-api.conf"
	CONTAINERS_CONF_OVERRIDE="$_dir/kdos-api.conf"
	export CONTAINERS_CONF_OVERRIDE
fi
exec "$@"
KDOS_SH
chmod 755 "$PKG/usr/bin/kdos-podman-api"

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/podman, 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 podman-6.1.2-4.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/podman, and runs the triggers its paths call for.

Contents

Installed programs: docker, kdos-podman-api, podman, podman-remote, podmansh.

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

Short descriptions

podman Simple management tool for pods, containers and images
podman-remote A remote CLI for Podman: A Simple management tool for pods, containers and images.
podmansh Execute login shell within the Podman podmansh container

Notes

The install targets write files for systemd whatever the directory variables say, and the recipe deletes them afterwards, since nothing in KDOS reads them:

Some pages that mention Quadlet stay: podman-rootless.7, podman-troubleshooting.7 with its section Cannot enable a quadlet unit as upstream wrote it, and the passing mentions in podman-pod-create.1 and podman-system-migrate.1. Pages other than podman.1 that stay, podman-run.1 and podman-create.1 among them, still name the deleted pages under SEE ALSO, and man reports those as missing.

There is no socket activation without systemd, so the recipe also writes kdos-podman-api, a small script installed to /usr/bin. The Containers menu entries, podman-tui and lazydocker, run their tool through it: it starts podman system service with a five-minute idle timeout when nothing answers on this user’s socket (/run/podman/podman.sock for root), exports DOCKER_HOST, and gives podman-tui a default connection through CONTAINERS_CONF_OVERRIDE unless the caller set one. The service is started under a lock taken on a descriptor that is closed for the service itself: the service inherits every open descriptor, and one that held the lock would block every later launch until it exited.

Rootless Podman puts a container’s cgroup beside the session’s, and a --memory or --cpus limit does nothing without a delegated subtree; how KDOS provides one is in Principles.