Skip to content

Support runs in toolbox - #1

Merged
abbra merged 7 commits into
freeipa:mainfrom
abbra:support-runs-in-toolbox
Nov 13, 2026
Merged

abbra merged 7 commits into
freeipa:mainfrom
abbra:support-runs-in-toolbox

Conversation

@abbra

@abbra abbra commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Handle VM deployments initiated inside toolbx environment.

Toolbx runs podman containers with $HOME mounted in. When podman tool runs inside this environment, it damages host's /run/user/... podman configuration to the point that the host's podman stops recognizing running containers. Detect this situation and avoid running podman inside toolbx.

Also, support different mechanism for communicating between VMs if multicast is not available.

Assisted-by: GLM-5.3

A control node that is itself a container (toolbox, distrobox, a dev
container) cannot run nested containers: any podman command would talk
to the outer environment's store, and there is no root for dnf install
of the host tools the qemu backend needs (qemu-img, an ISO tool).

freeipa_env.container detects that situation (containerenv/dockerenv
markers, $container, PID 1 environment) and offers the two helpers the
later commits build on: prepare_tools(), which fetches missing Fedora
RPMs with 'dnf download' (rootless), extracts them with
rpm2archive|tar into a cache directory and exposes wrapper scripts
setting LD_LIBRARY_PATH on PATH; and scratch_dir(), which keeps large
temporary files (image pulls) off tmpfs /tmp.

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
The private NIC between a run's VMs is a qemu UDP multicast socket on
230.0.0.1. On a containerized control node (and on hosts that route
multicast out a real interface without local delivery) no packet ever
reaches the peer qemu: the VMs sit on 192.168.100.0/24 with ARP
INCOMPLETE, and every multi-VM environment fails far from the cause.

Probe local multicast delivery once at import (IP_MULTICAST_LOOP on a
socketpair in the group); when it does not work, build the same L2
segment as a chain of TCP socket netdevs on loopback: one listening
netdev per VM, each later VM connecting to the previous one. Same
semantics, no multicast, no privileges needed.

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
_check_host refuses to start VMs when qemu-img or an ISO tool is not on
PATH. Inside a container there is no root to install them, but
freeipa_env.container can fetch the Fedora RPMs rootlessly and wrap
them. Ask it before the tool check so the check passes on a container
control node.

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Inside a container podman must not run (it would use the outer
environment's container store), so a containerdisk: image was
unresolvable there. Pull the same image with skopeo into a temporary
OCI directory instead and take /disk/disk.qcow2 out of its single
gzipped layer.

The cache file name stays the image id (the config digest, the same
value podman reports), so a cache filled by either path is reused by
the other. An unreadable outer /run/containers/<uid>/auth.json is
worked around by pointing REGISTRY_AUTH_FILE at an empty file in the
scratch dir: the public registries hosting containerdisks need no
credentials. containers-storage: and oci-archive: refs keep using
podman: only it can reach those stores.

Also seed the fetched qemu-img wrapper when in a container, so the
qcow2 validation step finds it.

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Running podman on a control node that is itself a container would talk
to (or try to create) a store belonging to the outer environment and
can break it. Refuse the podman provider there with a message pointing
at the nested qemu backend; FREEIPA_CI_ALLOW_PODMAN=1 opts back in when
a podman socket is deliberately forwarded into the container.

main() also calls container.prepare_tools() so every subcommand finds
the fetched qemu-img/ISO wrappers on PATH.

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
The needs_podman skip only checked that a podman binary is on PATH, but
inside a container the binary exists and cannot run (its store belongs
to the outer environment): the tests failed in podman build instead of
skipping. Probe podman info when in a container and skip on failure,
with a reason pointing at freeipa_env.container.

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Marker-based detection (containerenv file, $container, PID 1
environment), the rootless RPM fetch that produces a working and
idempotent qemu-img wrapper, and the skopeo containerdisk resolution
that must not run podman at all when the control node is a container,
including the cache-hit and the bad-layer rejection.

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
@abbra
abbra merged commit effdc9a into freeipa:main Nov 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant