[Bug 2133876] Re: chroot can not be killed when invoked as coproc
Julian Andres Klode
2133876 at bugs.launchpad.net
Tue Dec 9 13:48:50 UTC 2025
** Changed in: rust-coreutils (Ubuntu Questing)
Status: New => Won't Fix
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to rust-coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/2133876
Title:
chroot can not be killed when invoked as coproc
Status in rust-coreutils package in Ubuntu:
Triaged
Status in rust-coreutils source package in Questing:
Won't Fix
Status in rust-coreutils source package in Resolute:
Triaged
Bug description:
In questing and resolute I am unable to kill a bash coprocesses that
has been invoked with chroot. See details below.
Because questing replaced chroot from coreutils with chroot from rust-
coreutils and this behaviour starts with questing I suspect that this
is a bug in the rust implementation.
# Steps to reproduce
$ lxc launch ubuntu-daily:resolute resolute
$ lxc shell resolute
$ chroot / /usr/bin/bash -c 'while true; do echo "Hello"; sleep 10; done' &
[1] 794
$ ps --forest
PID TTY TIME CMD
758 pts/1 00:00:00 su
782 pts/1 00:00:00 \_ bash
794 pts/1 00:00:00 \_ chroot
795 pts/1 00:00:00 | \_ bash
796 pts/1 00:00:00 | \_ sleep
797 pts/1 00:00:00 \_ ps
$ kill 794
$ ps --forest
PID TTY TIME CMD
795 pts/1 00:00:00 bash
804 pts/1 00:00:00 \_ sleep
758 pts/1 00:00:00 su
782 pts/1 00:00:00 \_ bash
805 pts/1 00:00:00 \_ ps
Note that the subprocess invoked by chroot with pid 795 is still
running. You can also see this because every 10 seconds "Hello" gets
printed to stdout by the process that is still running.
You can see the same behaviour on questing.
# Expected Output
Let's compare this to the behaviour on noble:
$ lxc launch ubuntu:noble noble
$ lxc shell noble
$ chroot / /usr/bin/bash -c 'while true; do echo "Hello"; sleep 10; done' &
[1] 1384
$ ps --forest
PID TTY TIME CMD
559 pts/1 00:00:00 su
574 pts/1 00:00:00 \_ bash
1384 pts/1 00:00:00 \_ bash
1387 pts/1 00:00:00 | \_ sleep
1389 pts/1 00:00:00 \_ ps
$ kill 1384
$ ps --forest
PID TTY TIME CMD
559 pts/1 00:00:00 su
574 pts/1 00:00:00 \_ bash
1396 pts/1 00:00:00 \_ ps
Note that the process tree after invoking chroot looks different
compared to questing/resolute and the subprocess invoked by chroot
actually gets killed.
# Workaround
`pkill -P $CHROOT_PID` seems to do what I want. It kills the entire
process tree of the chroot process.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2133876/+subscriptions
More information about the foundations-bugs
mailing list