From owner-freebsd-bugs@freebsd.org Tue Apr 28 18:12:44 2020 Return-Path: Delivered-To: freebsd-bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E1BB2C1181 for ; Tue, 28 Apr 2020 18:12:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 49BV9m103xz45BC for ; Tue, 28 Apr 2020 18:12:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 21E692C117F; Tue, 28 Apr 2020 18:12:44 +0000 (UTC) Delivered-To: bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 219FC2C117E for ; Tue, 28 Apr 2020 18:12:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BV9m09X6z45BB for ; Tue, 28 Apr 2020 18:12:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F34E2285BA for ; Tue, 28 Apr 2020 18:12:43 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 03SICh57069374 for ; Tue, 28 Apr 2020 18:12:43 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 03SICh0m069373 for bugs@FreeBSD.org; Tue, 28 Apr 2020 18:12:43 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 246005] Jail(1) -r does not run configured exec.poststop scripts as jail(1) -r Date: Tue, 28 Apr 2020 18:12:44 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 12.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: krn@krn.dk X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 18:12:44 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D246005 Bug ID: 246005 Summary: Jail(1) -r does not run configured exec.poststop scripts as jail(1) -r 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 runs the prober (expected) shut down and exec.poststop scripts, while the jail -r 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 actually runs as jail -R . 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 -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 argumemnt] # jail -r 5 5: removed [no echo from poststop script that destroy vlan14 device] # ifconfig vlan14: flags=3D8842 metric 0 mtu 1500 options=3D80103 ether 98:4b:e1:66:8e:06 vlan: 14 vlanpcp: 0 parent interface: bce1 media: Ethernet autoselect (1000baseT ) status: active nd6 options=3D29 [vlan14 is not removed] --=20 You are receiving this mail because: You are the assignee for the bug.=