[Bug 290217] "jail -r" sometimes results in jails stuck in dying

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 13 Oct 2025 20:44:34 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290217

            Bug ID: 290217
           Summary: "jail -r" sometimes results in jails stuck in dying
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: equinox@diac24.net

The script at the end of this report will, with a random chance somewhere in
the 20-40% range, result in a jail stuck in "dying" and a mount that can no
longer be umounted (if the root is a mount). It doesn't take more than a few
tries to trigger the behavior for me. System version is 15-ALPHA4, the script
doesn't seem to cause problems on 14.3.

The problem does not seem to occur if the jail exits normally after the sleep,
i.e. "jail -r" is a necessary factor.  There is no config for any jail.

This is likely the same problem as in
https://forums.freebsd.org/threads/remove-dying-jail.96919/ though I am not the
creator of that forum post.

FreeBSD test 15.0-ALPHA4 FreeBSD 15.0-ALPHA4 stable/15-n280334-d2b670b27f37
GENERIC amd64


#!/bin/sh

set -x
root="/root/base_txz"  # contents of base.txz

jail -i -c "path=$root" host.hostname=test command=/bin/sh -c "sleep 3" | {
        read jid
        sleep 1
        jail -r $jid
}

for I in $(seq 0 10); do
        jls -d | grep "$root" || break
        sleep 1
done

-- 
You are receiving this mail because:
You are the assignee for the bug.