[Bug 2133876] [NEW] chroot can not be killed when invoked as coproc
Dominik Viererbe
2133876 at bugs.launchpad.net
Thu Dec 4 14:19:44 UTC 2025
Public bug reported:
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.
** Affects: rust-coreutils (Ubuntu)
Importance: Undecided
Status: New
** Affects: rust-coreutils (Ubuntu Questing)
Importance: Undecided
Status: New
** Affects: rust-coreutils (Ubuntu Resolute)
Importance: Undecided
Status: New
** Also affects: rust-coreutils (Ubuntu Resolute)
Importance: Undecided
Status: New
** Also affects: rust-coreutils (Ubuntu Questing)
Importance: Undecided
Status: New
** Description changed:
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 with the rust-coreutils and this
- behaviour starts with questing I suspect that this is a bug in the rust
- implementation.
+ 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.
--
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:
New
Status in rust-coreutils source package in Questing:
New
Status in rust-coreutils source package in Resolute:
New
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