From nobody Thu Jul 10 13:31:20 2025 X-Original-To: current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bdG374tZDz6148P for ; Thu, 10 Jul 2025 13:31:47 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bdG3655B3z3pjR; Thu, 10 Jul 2025 13:31:46 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752154306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pVX83xXklV2hqZ0HRJtIpUlx4Djcs01/nqrHnznqZbw=; b=MmvyAxVfv9rjRTLiFmKAiEMy8NlsSbGwmkjZtlNj/qjEIOMUqxl6D+8SQ68N45dh89m4px 3OL28KnHzP1EcbOI3tQ6azfjW/KCNWez0ttOmfv49UYT12l6x0ilRol6bf61X/PXVmRaY1 Ll9Hr8OLZqFs5VaXGxCSV9zKfTtf+zY3Xw7zgK4HpmgtvTtVq+ZDRBxtJHKEcozT+hanVk ct3tdGgtDtXfXP2j4bXNaATWo/HD6cmFnP0p2KyFHRhAb6wmL+LYVtu2fiCpdsXICO54gs ZkghC1V6YtycB/dSPCBP8ypM8y5Qja2AwR8mhdQXMOVVGxH1CTO/6hGJMvCeYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752154306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pVX83xXklV2hqZ0HRJtIpUlx4Djcs01/nqrHnznqZbw=; b=DGq3lWrl0hNl35Nc5zgQkKFcEUrhTvh651MnuwMdJ2rUoAR6mxX584LjXqCwAkOX/zG4b+ 8Rhlu6cypexCC7U1dZzBqLgGmSu7Xvi2+IzkCCYgBMkle7zsf8DD2xpVKv/JhupuboaLuw aoME2qArNfIqGnSjCGJ76EEyYWcXMUjBliLT0GmmsR+oKAnwf7b2ocX/eWF5EvLmnpE7JD Kfm2F77yDSN3PKlvNuGtRhyQtD9AP+VRdc5F5s/EgPHBvWt+6TG2q9T2QVn8L/3Ig4+lyN SApnOB6CknYoCbkU56wziMYpN1/KV9IpCzGi7gPxJdUVkMr30JpUzMpvOA2Kvw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1752154306; a=rsa-sha256; cv=none; b=UhCfWx1hXJDUgsRiDu48tb78CdIU4/RRSF/1QC4jeyKIbgwqaNk5Bcyv9HAL8haWrK24c6 c0ZQUcC/zeUz1OzvNd2+pp54JrsZOrHr6m8gyR/wZNDcBHwstVxWBYI8q5Tb7voBvsOBws 5Tz+OXPL9XLq9cnTpkO9mHPHgKIgnZmKaCiEBHfm3JVVUSGTUMQrUxTuDCT51wuvE6o4sT F45R7YDL9i3RnXNLwyrIEkCdv4nPiMn+U158sjPrDZo8AP18m9is3sFSjAX3SDKYkCCjnO fD1oTtk2/A4o2TAa7KxDgn3j+dsH06vwGgB0ucpYXWK/n1BxhQUlraq5vMx5/g== Received: from smtpclient.apple (unknown [IPv6:2001:19f0:6001:9db:98f0:9fe0:3545:10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4bdG333tVszmgZ; Thu, 10 Jul 2025 13:31:43 +0000 (UTC) (envelope-from zlei@FreeBSD.org) From: Zhenlei Huang Message-Id: <1B1CD603-065D-436F-97D9-DDF65AB7F115@FreeBSD.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_67CE9146-BB61-4044-8616-4AABBA13B925" List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.10\)) Subject: Re: sysctl to prevent reboot? Date: Thu, 10 Jul 2025 21:31:20 +0800 In-Reply-To: Cc: FreeBSD Current , Konstantin Belousov To: "Bjoern A. Zeeb" References: X-Mailer: Apple Mail (2.3696.120.41.1.10) --Apple-Mail=_67CE9146-BB61-4044-8616-4AABBA13B925 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Jul 10, 2025, at 9:18 PM, Bjoern A. Zeeb = wrote: >=20 > Hi, >=20 > I am not sure where but I thought I saw a change fly by which would > prevent a shutdpwn -r /reboot (and possibly halt?) from being executed > while a sysctl was set. >=20 > Does anyone have a reference or have I been dreaming? >=20 > I would find that very helpful for host systems running (multiple) = bhyve > instances. Happened twice to me recently that I typed reboot in the = wrong > window and restarted my dev machine entirely rather than a guest. >=20 > /bz >=20 > --=20 > Bjoern A. Zeeb = r15:7 >=20 Hi Bjoern A, I believe Konstantin's work [1] and [2] are precisely what you need. [1] = https://cgit.freebsd.org/src/commit/?id=3D7fb88c20eccc3fd2118fda2ba58d7afe= 2b87f7e3 = shutdown(8): refuse to run if /var/run/noshutdown is = present [2] = https://cgit.freebsd.org/src/commit/?id=3D384d976725a5c29734a9227fcdb6ef08= 07485c91 = rc.d: Add precious_machine rc.conf knob to create = /var/run/noshutdown Best regards, Zhenlei --Apple-Mail=_67CE9146-BB61-4044-8616-4AABBA13B925 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

On Jul 10, 2025, at 9:18 PM, Bjoern A. Zeeb <bzeeb-lists@lists.zabbadoz.net> wrote:

Hi,
I am not sure where but I thought I saw a = change fly by which would
prevent a shutdpwn -r /reboot = (and possibly halt?) from being executed
while a sysctl = was set.

Does anyone have a reference or = have I been dreaming?

I would find that = very helpful for host systems running (multiple) bhyve
instances.  Happened twice to me recently that I typed = reboot in the wrong
window and restarted my dev machine = entirely rather than a guest.

/bz

--
Bjoern A. Zeeb =             &n= bsp;           &nbs= p;            =             &n= bsp;  r15:7


Hi Bjoern A,

I believe Konstantin's work [1] and =  [2] are precisely what you need.

[1] https://cgit.freebsd.org/src/commit/?id=3D7fb88c20eccc3fd2118fd= a2ba58d7afe2b87f7e3   shutdown(8): refuse to run if = /var/run/noshutdown is present
[2] https://cgit.freebsd.org/src/commit/?id=3D384d976725a5c29734a92= 27fcdb6ef0807485c91  rc.d: Add precious_machine rc.conf = knob to create /var/run/noshutdown

Best regards,
Zhenlei

= --Apple-Mail=_67CE9146-BB61-4044-8616-4AABBA13B925--