[Bug 246005] Jail(1) -r <JID> does not run configured exec.poststop scripts as jail(1) -r <jail-name>
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Apr 28 18:12:44 UTC 2020
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246005
Bug ID: 246005
Summary: Jail(1) -r <JID> does not run configured exec.poststop
scripts as jail(1) -r <jail-name>
Product: Base System
Version: 12.1-RELEASE
Hardware: amd64
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: bin
Assignee: bugs at FreeBSD.org
Reporter: krn at krn.dk
Hi FreeBSD bugfixers.
I have noticed that jail -r <jail-name> runs the prober (expected) shut down
and exec.poststop scripts, while the jail -r <jid> just stops the jail. (as in
jail -R)
The setup i am using has jails that uses vlan interfaces created by
exec.prestart and destroyed with exec.poststop scripts in the /etc/jail.conf
file. The example below shows that jail -r <jid> actually runs as jail -R
<jid>.
from jail(8) manpage:
-r Remove the jail specified by jid or name. All jailed processes
are killed, and all jails that are children of this jail are also
removed.
-R A variation of the -r option that removes an existing jail
without using the configuration file. No removal-related
parameters for this jail will be used -- the jail will simply be
removed.
My system version is: (output from uname -a)
FreeBSD mplsnat1 12.1-RELEASE FreeBSD 12.1-RELEASE r354233 GENERIC amd64
(Genereic kernel with recent patches)
Below my coments are shown in [ ]
[jail config from /etc/jail.conf file]
vrf01804 {
host.hostname ="vrf01804";
allow.nomount;
persist;
path = "/jails/serverroots/vrf01804";
children.max = 0;
mount.devfs;
mount.fstab = "/jails/jail-configs/fstab/fstab.vrf01804";
devfs_ruleset = 5;
vnet = "new";
vnet.interface = vlan14;
exec.start = "/bin/sh /etc/rc";
exec.prestart = "/bin/sh /jails/jail-configs/prestart/prestart.vrf01804";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.poststop = "/bin/sh /jails/jail-configs/poststop/poststop.vrf01804";
}
[Two (identical) jails exists.]
# jls
JID IP Address Hostname Path
3 vrf01802 /jails/serverroots/vrf01802 (vlan12)
5 vrf01804 /jails/serverroots/vrf01804 (vlan14)
[Removing jail with -r <jail-name>]
# jail -r vrf01802
Stopping inetd.
Waiting for PIDS: 2430.
Stopping sshd.
Waiting for PIDS: 2409, 2409.
.
Terminated
vrf01802: removed
Runing poststop for vrf01802. [Echoed from the poststop script]
[Everything seems working fine]
root at mplsnat1:/jails/jail-configs # jls
JID IP Address Hostname Path
5 vrf01804 /jails/serverroots/vrf01804
[removing jail with -r <jid> argumemnt]
# jail -r 5
5: removed
[no echo from poststop script that destroy vlan14 device]
# ifconfig
vlan14: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=80103<RXCSUM,TXCSUM,TSO4,LINKSTATE>
ether 98:4b:e1:66:8e:06
vlan: 14 vlanpcp: 0 parent interface: bce1
media: Ethernet autoselect (1000baseT <full-duplex,master>)
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
[vlan14 is not removed]
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list