From nobody Mon Sep 12 15:02:19 2022 X-Original-To: dev-commits-src-all@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 4MR8vz0qGvz4cjLX; Mon, 12 Sep 2022 15:02:23 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MR8vy6yBNz42M8; Mon, 12 Sep 2022 15:02:22 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4002a.ext.cloudfilter.net ([10.228.9.250]) by cmsmtp with ESMTP id XhqZoejYeS8WrXkx4oBPXV; Mon, 12 Sep 2022 15:02:22 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id Xkx1oFOS9C3uhXkx2oXi8N; Mon, 12 Sep 2022 15:02:22 +0000 X-Authority-Analysis: v=2.4 cv=a6MjSGeF c=1 sm=1 tr=0 ts=631f49fe a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=xOM3xZuef0cA:10 a=gRS1eiuiAAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=13NIc8eN1vPoI-ZInuUA:9 a=VJiB-BMSWMs3bncc:21 a=CjuIK1q_8ugA:10 a=udpbrAo2yJH2O6eCpvBn:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id AA486189; Mon, 12 Sep 2022 08:02:19 -0700 (PDT) Received: by slippy.cwsent.com (Postfix, from userid 1000) id 89758282; Mon, 12 Sep 2022 08:02:19 -0700 (PDT) X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7+dev Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: freebsd@oldach.net (Helge Oldach) cc: Cy.Schubert@cschubert.com, cy@FreeBSD.org, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: Re: git: 3418c14040f2 - stable/13 - libexec/rc: Add var_run rc script In-reply-to: <202209121405.28CE5r8m053976@nuc.oldach.net> References: <202209121405.28CE5r8m053976@nuc.oldach.net> Comments: In-reply-to freebsd@oldach.net (Helge Oldach) message dated "Mon, 12 Sep 2022 16:05:53 +0200." List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 12 Sep 2022 08:02:19 -0700 Message-Id: <20220912150219.89758282@slippy.cwsent.com> X-CMAE-Envelope: MS4xfIdDQhylhxkXpeUlg6pg7+jblPVbtrzhFcfxtWW6ogzefdZKhkgnYt+1TiWbCbou79SRAJsya8A3PtpBqzs5qHPHa3AvxBXEC3QTlCYruZ3JHHQJdw9n hDlm5oKtSCsttfnybLfw3knXsZLbtn1jxod6zriyILxniAtCHQQX9e1nD2fwfKpR6wH4H7RRnFhwDeNJZq1pdNHgGc2c5MUTWqk7Lb/TKk42V4ZpxJBRH3Hh WkFjTO9IH9aKlLXbpHQ70qajG7x4CG4ZGiGwSRCiKMT8kL0pzbeOdc0Jhp8UvAnejzKGxnW+ZSU6WhUHMAMV7vE/6eOYHI3uQwfSs2aMGNME4vB9mzhBXPxV 5QqlvfyG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Rspamd-Queue-Id: 4MR8vy6yBNz42M8 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N In message <202209121405.28CE5r8m053976@nuc.oldach.net>, Helge Oldach writes: > Cy Schubert wrote on Mon, 12 Sep 2022 15:17:14 +0200 (CEST): > > In message <202209120716.28C7Gjd2091559@nuc.oldach.net>, Helge Oldach > > writes: > > > Cy Schubert wrote on Mon, 12 Sep 2022 02:41:14 +0200 (CEST): > > > > libexec/rc: Add var_run rc script > > > > > > > > Users with a tmpfs /var/run will lose the directory tree state of > > > > /var/run at reboot. This rc script will optionally (by default) > > > > capture the state of the directory structure in /var/run prior to > > > > shutdown and recreate it at system boot. > > > > > > > > Alternatively a user can save the state of the /var/run directories > > > > manually using service var_run save and disable the autosaving of > > > > /var/run state using the var_run_autosave variable, for those > > > > paranoid SSD users. > > > > > > I'm afraid this logic does not rhyme well with a common scenario: Firing > > > up a tmpfs based /var by simply booting with a non-writeable /var which > > > will trigger /etc/rc.d/var to create, mount and populate a tmpfs based > > > /var. This is the classic diskless scenario. > > > > > > The concern is that var_run by default saves the var_run created mtree > > > on exactly this tmpfs based /var (as /var/db/mtree/BSD.var-run.mtree) so > > > it will be gone with the next reboot. This will void the var_run logic > > > for the default case. > > > > > > I would suggest to document that tweaking var_run_mtree appropriately is > > > necessary for such scenarios. > > > > > > Furthermore, I propose to consider extending the scope of var_run from > > > /var/run to the whole of /var, which would be sensible in certain > > > diskless cases as well. > > > > Your scenario is outside of the scope of this change. This change was > > designed to support those who use a standard /var with a tmpfs /var/run, > > similar to Red Hat Linux support of /var/run. > > Indeed. I am trying to widen the scope by considering what /etc/rc.d/var > does and put /etc/rc.d/var_run in perspective. With current defaults, > var_run will not deliver as expected for the case of a volatile /var. > In an abstract sense, /etc/rc.d/var and /etc/rc.d/var_run somewhat > contradict. In the FreeBSD sense, a tmpfs /var/run does contradict the of /var/run. But in comparison to the Linux or even Solaris definition we will see if this concept is embraced by people or not. This is why var_run is designed to run _after_ var, because an optional tmpfs /var/run is layered on top of /var. To use this a person must have enough understanding that that the /var/run fstab line must follow the /var line. And the scope of this change is narrow. This is not to say that at some point in the future people may embrace a tempfs /var/run resulting in a redesign of the var and var_run rc scripts. I don't think we want to go down that path yet. This kind of change will require a paradigm shift not only in base O/S but also in ports and third party applications -- which is why the rc script was designed the way it was: to be as non-intrusive as possible while also providing a little extra flexibility to those who might want or even need it. This is a limited scope change and should remain that way until people think there should be significant changes to not only the architecture but also the FreeBSD ecosystem. Your suggestion is in fact a change not only to the architecture but the entire ecosystem which cannot be changed in a release, if ever. > > > Regarding diskless scenarios, my experience with SunOS 4.1.3 in a corporate > > > I was more thinking about embedded scenarios where the root fs is > readonly for a reason. Embedded is a totally different kettle of fish. Those who use FreeBSD in an embedded environment will likely change not only /var but make significant other changes to the architecture. Facilitating a set of flexible but difficult to maintain configuration scripts (because of the flexiblity) IMO is outside of the scope of the FreeBSD project because every embedded application is different enough that each configuration would render such scripting generally useless. Someone writing some sample scripts or better yet some ports that when installed using pkg make the necessary configuration changes for embedded applications. But even that idea is flawed because an embedded application running inside of a TV is not the same as an embedded application running in a commodity router, manufacturing control robot, a lunar lander, or a smartphone. None of these embedded applications are remotely similar to each other and therefore the designers of such applications will undoubtedly need to write their own scripts tailored to their own embedded applications. That's where spin-off projects can add value. They can create an embedded router, embedded firewall application or embedded load balancer. (Like the F5 I had here. It was a Linux O/S with an haproxy-like app and a web front end designed to run on an underpowered Pentium on a small amount of RAM with a tiny SD card for disk -- because hardware costs $$$ and inexpensive hardware improves profits.) Something like a pf based firewall or a NAS each with web front ends are excellent FreeBSD-based examples of this. Remember, creep of scope will kill any project. I've been around long enough to see more than enough of that. > > Kind regards > Helge -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org NTP: Web: https://nwtime.org e^(i*pi)+1=0