From 0581af6dcff0486d8a25c1a4088302b3fab5a4e7 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Mon, 9 Nov 2026 19:49:39 +0100 Subject: [PATCH] Document running chroot tools through imgutil exec A plain chroot, as used by ansible's chroot connection, has no DNS or /dev in a built image. Describe what imgutil exec mounts, show ansible running through it, and fix the exec example, which needs -- before command options. --- confluent_client/doc/man/imgutil.ronn | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/confluent_client/doc/man/imgutil.ronn b/confluent_client/doc/man/imgutil.ronn index ff014ec1..b3a82da7 100644 --- a/confluent_client/doc/man/imgutil.ronn +++ b/confluent_client/doc/man/imgutil.ronn @@ -26,6 +26,10 @@ * `exec`: Start the specified scratch directory as a container and optionally run a command inside it. + While it runs, `/proc`, `/sys`, `/dev`, an empty `/run` and the build + system's `/etc/resolv.conf` are mounted, without changing the scratch + directory. A plain `chroot` lacks them (no DNS, no `/dev/null`), so run + chroot based tools through `imgutil exec`, see EXAMPLES. * `unpack`: Unpack a diskless image profile to a scratch directory for modification. @@ -142,7 +146,8 @@ Directory of an unpacked diskless root. * : - Optional command to run (defaults to a shell). + Optional command to run (defaults to a shell). Put `--` before a + command that has options. ## UNPACK OPTIONS @@ -223,7 +228,19 @@ Execute a shell in an unpacked image: Execute a specific command in an image: - imgutil exec /tmp/myimage /bin/rpm -qa + imgutil exec /tmp/myimage -- rpm -qa + +Run an ansible playbook in an image through `imgutil exec` (chroot +connection of community.general): + + cat > /usr/local/sbin/imgutil-chroot << 'EOF' + #!/bin/sh + exec /opt/confluent/bin/imgutil exec -- "$@" + EOF + chmod 755 /usr/local/sbin/imgutil-chroot + ansible-playbook -c community.general.chroot \ + -e ansible_chroot_exe=/usr/local/sbin/imgutil-chroot \ + -i /tmp/myimage, site.yml Unpack an existing profile for modification: