Skip to content

Commit 231511f

Browse files
committed
docs: add warning about orphaned child processes with --pid host
Add documentation and warning about a limitation of --pid host mode: orphaned child processes may remain after container stop/rm. This is a known podman limitation (containers/podman#11888), not something introduced by our workaround. The workaround only kills the init process; child processes that daemonized or backgrounded will persist. Changes: - Add warning in distrobox-create for rootless podman without --unshare-process - Document the limitation in distrobox-stop and distrobox-rm comments - Recommend --unshare-process for full process cleanup Signed-off-by: xz-dev <xiangzhedev@gmail.com>
1 parent 1a7f77f commit 231511f

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

distrobox-create

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,17 @@ generate_create_command()
692692
if [ "${unshare_process}" -eq 0 ]; then
693693
result_command="${result_command}
694694
--pid host"
695+
# Warn about --pid host limitation in rootless podman mode.
696+
# See: https://github.com/containers/podman/issues/11888
697+
if [ "${rootful}" -eq 0 ]; then
698+
case "${container_manager}" in
699+
*podman*)
700+
printf >&2 "Warning: using --pid host with rootless podman.\n"
701+
printf >&2 "Warning: orphaned child processes may remain after container stop.\n"
702+
printf >&2 "Warning: consider using --unshare-process for full process cleanup.\n"
703+
;;
704+
esac
705+
fi
695706
fi
696707
# Mount useful stuff inside the container.
697708
# We also mount host's root filesystem to /run/host, to be able to syphon

distrobox-rm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,10 @@ delete_container()
401401
# This sends the signal directly to the container's init process PID, bypassing
402402
# the cgroup lookup issue.
403403
#
404-
# Note: distrobox-rm does not call distrobox-stop (by design, it relies on
405-
# "podman rm --force" to handle stopping). A similar fix exists in distrobox-stop
406-
# for the "distrobox stop" command.
404+
# Note: This only kills the init process, not any orphaned child processes - this is
405+
# a limitation of --pid host mode (see https://github.com/containers/podman/issues/11888).
406+
# To ensure all processes are cleaned up, use --unshare-process when creating the container.
407+
# distrobox-rm does not call distrobox-stop by design; a similar fix exists there.
407408
if [ "${container_status}" = "running" ] && [ "${rootful}" -eq 0 ]; then
408409
case "${container_manager}" in
409410
*podman*)

distrobox-stop

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,11 @@ case "${response}" in
295295
# In rootless mode, podman stop uses "crun kill --all" which fails when
296296
# cgroup-path is empty (which happens with --pid host, the distrobox default).
297297
# Using "kill" first (which uses "crun kill" without --all) ensures the
298-
# container is terminated.
298+
# container's init process is terminated.
299+
#
300+
# Note: This only kills the init process, not any orphaned child processes - this is
301+
# a limitation of --pid host mode (see https://github.com/containers/podman/issues/11888).
302+
# To ensure all processes are cleaned up, use --unshare-process when creating the container.
299303
if [ "${rootful}" -eq 0 ]; then
300304
case "${container_manager}" in
301305
*podman*)

0 commit comments

Comments
 (0)