* Johannes Schauer Marin Rodrigues <jo...@debian.org> [2023-11-24 20:57]:
this is is only invoked for --chrooted-*-hooks but CLONE_NEWNS is also what mmdebstrap unshares by default here:
Ah, I only tested with your: --chroot-setup-commands='ischroot && echo "is chroot" || echo "is not chroot" Example.
This is already done here: https://sources.debian.org/src/sbuild/0.85.4/lib/Sbuild/ChrootUnshare.pm/#L279 What made you think that CLONE_NEWNS was responsible? It should be unshared for both sbuild and mmdebstrap hooks.
I think it is due to mmdebstrap having extra process and maybe doing the CLONE_NEWNS in a different process?
Since the problem does not happen with mmdebstrap, I think this might just be a bug in sbuild. I also suspect that your thoughts about PID 1 go into the right direction because sbuild and mmdebstrap set up the unshared processes slightly differently. Look at the complex dance of processes that mmdebstrap does: https://sources.debian.org/src/mmdebstrap/1.4.0-1/mmdebstrap/#L486
I think that is part of why it works with mmdebstrap. Compare: $ sbuild -d unstable --starting-build-commands='ps auxf' --add-depends=procps hello USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 4536 2816 ? S+ 20:17 0:00 /sbin/runuser -u root -- sh -c cd "$1" && shift && "$@" -- /build/package /bin/sh -c ps auxf root 41 0.0 0.0 2580 1408 ? S+ 20:17 0:00 sh -c cd "$1" && shift && "$@" -- /build/package /bin/sh -c ps auxf root 42 0.0 0.0 2580 1408 ? S+ 20:17 0:00 \_ /bin/sh -c ps auxf root 43 0.0 0.0 8116 4096 ? R+ 20:17 0:00 \_ ps auxf and: $ mmdebstrap --chrooted-customize-hook='ps auxf' --variant=essential --include=procps unstable /dev/null USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.5 0.1 32616 25252 ? S+ 20:15 0:00 /usr/bin/perl /usr/bin/mmdebstrap --chrooted-customize-hook=ps auxf --variant=essential --include=procps unstable /dev/null root 1716 0.0 0.1 32616 23956 ? S+ 20:15 0:00 /usr/bin/perl /usr/bin/mmdebstrap --chrooted-customize-hook=ps auxf --variant=essential --include=procps unstable /dev/null root 1717 0.0 0.0 2580 1536 ? S+ 20:15 0:00 \_ sh -c ps auxf root 1718 0.0 0.0 8116 3968 ? R+ 20:15 0:00 \_ ps auxfAnd note that for mmdebstrap PID 1 has a different mountinfo as PID 1716 and below.
Cheers Jochen
signature.asc
Description: PGP signature