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:
- it builds upstream’s Go makefile with a set of build tags of its own;
- it installs the makefile’s targets one by one instead of upstream’s
install, which would add systemd units, and removes what only systemd reads; - it carries a patch that lets a build tag leave the systemd-only commands out of the binary.
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
podman-6.1.2.tar.gz(20.0 MiB)
sha256a4b2b10bd560cf9b4c50c282bd04bb74486ff6c78bebd51427f779fe985fc1bb
upstream: https://github.com/podman-container-tools/podman/archive/v6.1.2.tar.gz
archive copy: sources-1/containers--podman-6.1.2.tar.gz
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.
0001-exclude-systemd-commands-build-tag.patch— cmd/podman: add the exclude_systemd_commands build tagThe tag leaves `podman generate systemd`, `podman quadlet` and `podman auto-update` out of the binary, for systems with no systemd to read the units the first two write or to restart the units the third relies on, and makes the `podman generate` description name Kubernetes YAML alone. It drops `podman quadlet` and `podman auto-update` from podman(1)'s command table and `systemd` from podman-generate(1)'s. Upstream's default binary is unchanged; the documentation hunks apply in every build.
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:
BUILDTAGS— Passed on themakecommand line, so it replaces upstream’s whole list. That list isgrpcnotrace,seccompon Linux, and whatever thehack/*_tag.shscripts print after probing the build machine:apparmor,systemd,libsubid,libsqlite3and the btrfs exclusion. Only the four tags below are set, whatever the build root holds; in particular there is nosystemdtag, as KDOS has no systemd, and noapparmororlibsubid.seccomp— Compiles in seccomp filtering through libseccomp, so each container runs under the syscall filter its profile names.libsqlite3— Links the database Podman keeps its state in against the sqlite port, instead of compiling the copy of SQLite bundled with the Go binding.exclude_graphdriver_btrfs— Leaves out the btrfs storage driver. The store uses the overlay driver through fuse-overlayfs (seestorage.conf), and the btrfs driver would compile against btrfs-progs’ headers whenever they happened to be installed.exclude_systemd_commands— Leavespodman generate systemd,podman quadletandpodman auto-updateout of the binary: the first two write or manage systemd units, which nothing on KDOS reads, and the third restarts containers through the systemd units that run them. It also makespodman generate --helpname Kubernetes YAML alone as what the command produces. The tag is not upstream’s: it comes from the patch below, and without the patch it would be accepted and do nothing.REMOTETAGS— The tag listpodman-remoteis built with, whichBUILDTAGSdoes not reach. It is upstream’s default (remote,containers_image_openpgp, the btrfs exclusion) withexclude_systemd_commandsadded, sopodman-remoteleaves out the same three commands.GOFLAGS="$GOFLAGS \"-ldflags=-s -w\""— Extends the tree’s exportedGOFLAGSwith-s -w, which drop the symbol table and DWARF, for any binary the makefile builds without an-ldflagsof its own. See go.EXTRA_LDFLAGS="-s -w"— The same two flags for the binaries the makefile does link with its own-ldflags, which aGOFLAGS-ldflagscannot reach; upstream appendsEXTRA_LDFLAGSto that string.LIBEXECPODMAN=/usr/lib/podman— Installs the helpers,rootlessportamong them, in/usr/lib/podman, which is one of the directories Podman searches for its helper programs and the one catatonit installs into. WithPREFIX=/usrupstream’s default would be/usr/libexec/podman.GOMD2MAN=/usr/bin/go-md2man— Converts the Markdown manual pages with the go-md2man port. Upstream’s default is a copy it builds itself fromtest/tools, a separate Go module.install.remote— Installspodman-remote, the client that drives a Podman service over its API socket.install.docker— Installs/usr/bin/docker, a shim that runspodman, and/etc/profile.d/podman-docker.sh, which, whenDOCKER_HOSTis unset, points it at the user’s API socket under$XDG_RUNTIME_DIR, or at/run/podman/podman.sockfor root.
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:
install.binlinksquadletintolib/systemd/system-generatorsanduser-generatorsand adds atmpfiles.dentry;install.dockeradds tmpfiles entries and a csh profile. The recipe deletesusr/lib/systemd,usr/lib/tmpfiles.d,usr/share/user-tmpfiles.dandpodman-docker.csh(no csh is installed).- The
quadlethelper in/usr/lib/podmanis a systemd generator. Nothing on KDOS runs it, and withpodman quadletnot built nothing else calls it, so the recipe deletes it. Quadlet.containerfiles therefore do nothing on KDOS. /usr/bin/podmansh, the link topodmanthatinstall.binmakes, is deleted withpodmansh.1. As a login shell it only enters apodmanshcontainer, which a Quadlet under systemd creates, so on KDOS it has nothing to enter.- The manual pages that document Quadlet and systemd units are deleted, so that
apropos systemdandapropos quadletdo not send a reader to them:podman-systemd.unit.5,quadlet.5, the sevenpodman-{build,container,image,kube,network,pod,volume}.unit.5,podman-quadlet.1with its-install,-list,-printand-rmpages,podman-generate-systemd.1,podman-auto-update.1, which documents a command that needs systemd units, and the guidepodman-quadlet-basic-usage.7.
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.