From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 21737 invoked from network); 15 May 2022 01:52:15 -0000 Received: from alyss.skarnet.org (95.142.172.232) by inbox.vuxu.org with ESMTPUTF8; 15 May 2022 01:52:15 -0000 Received: (qmail 27776 invoked by uid 89); 15 May 2022 01:52:39 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Received: (qmail 27769 invoked from network); 15 May 2022 01:52:39 -0000 From: "Laurent Bercot" To: supervision@list.skarnet.org Subject: Re: s6 xinit replacement? Date: Sun, 15 May 2022 01:52:11 +0000 Message-Id: In-Reply-To: <3GMPPUYHIEJBK.3F20HQJFLEHMP@oak.localdomain> References: <3VJC4G8PXTKVS.3RQFDLXYQABMW@oak.localdomain> <3GMPPUYHIEJBK.3F20HQJFLEHMP@oak.localdomain> Reply-To: "Laurent Bercot" User-Agent: eM_Client/9.0.1708.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable >Is the purpose of executing setsid() in s6-supervise to allow for the >services to continue beyond the termination of the supervision tree? It's actually the opposite: it's to protect the supervision tree against misbehaved services. :) setsid() makes sure the service is isolated, and a killpg() or equivalent won't affect anything outside of it. Of course, it also protects *other* services running under the same supervision tree. >If that's the case, could there possibly be a flag to disable that, >with the understanding that something like nohup or even s6-setsid would >be necessary to replicate that behavior? That would enable a non-root >Xorg to be managed by s6. The direction s6 has taken is really the opposite: there was such a flag in earlier versions, but it was causing a lot of special cases and problems I definitely did not want to deal with. The real issue is that a supervision tree should not be run with a controlling terminal. It's not meant to be run from a logged-in user process, but as a background infrastructure that's always there. The whole point of s6 is to make your services *more reliable*; and there are few things less reliable than a whole tree of processes that can die on an accidental ^C. Because users insisted a lot, there are still accommodations for killing a whole supervision tree with ^C when s6-svscan has been=20 launched in a terminal. It is a nice feature to have (and although it was by=20 design that services persisted beyond the ^C, it was unintuitive to most users, so from a pure UI standpoint, killing the entire tree in one go was better). However, I'm not going back on the "each service runs in its own=20 session" thing, because if there's a case for allowing the user who controls s6-svscan to kill the whole tree at once, there is just no case for allowing a service running under the tree to impact other services and the tree itself. Despite this, you're right that the pattern of xinit is similar to what s6 does, and it *is* possible to run Xorg under s6; several users are doing so, and I hope they will post their setup. (You may have more luck by asking in the IRC channel, but it would be nice for the setup to be documented on the mailing-list.) It does not involve running s6-svscan from your own VT; it involves having a supervision tree already running (as your user), and starting the Xorg service, e.g. with a s6-svc -u command, on a given VT, possibly passed to the run script via a file that your xinit emulation script would fill in with the output of `tty`. If you insist on doing hacky things, you could even probably get away with something that looks like: xinit emulation: #!/bin/sh tty | sed s:/dev/tty:: > /home/me/.screen-number s6-supervise /home/me/Xorg & # small race here that disappears when s6-supervise has already run once s6-svwait -U /home/me/Xorg your-X-client s6-svc -dx /home/me/Xorg /home/me/Xorg/notification-fd: 3 /home/me/Xorg/run: #!/bin/execlineb -P backtick -E screen { cat /home/me/.screen-number } export DISPLAY :$screen X -displayfd 3 :$screen vt$screen -displayfd is used as a notification mechanism, unblocking s6-svwait when the X server is ready. Hope this helps (and I hope users who actually have done something similar will share their experience), -- Laurent