Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Apr 2020 18:12:44 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 246005] Jail(1) -r <JID> does not run configured exec.poststop scripts as jail(1) -r <jail-name>
Message-ID:  <bug-246005-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D246005

            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@FreeBSD.org
          Reporter: krn@krn.dk

Hi FreeBSD bugfixers.=20

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)=20


Below my coments are shown in [ ]=20


[jail config from /etc/jail.conf file]
vrf01804 {
    host.hostname =3D"vrf01804";
    allow.nomount;
    persist;
    path =3D "/jails/serverroots/vrf01804";
    children.max =3D 0;
    mount.devfs;
    mount.fstab =3D "/jails/jail-configs/fstab/fstab.vrf01804";
    devfs_ruleset =3D 5;
    vnet =3D "new";
    vnet.interface =3D vlan14;
    exec.start =3D "/bin/sh /etc/rc";
    exec.prestart =3D "/bin/sh /jails/jail-configs/prestart/prestart.vrf018=
04";
    exec.stop =3D "/bin/sh /etc/rc.shutdown";
    exec.poststop =3D "/bin/sh /jails/jail-configs/poststop/poststop.vrf018=
04";
}


[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@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=3D8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=3D80103<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=3D29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

[vlan14 is not removed]

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-246005-227>