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.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10651 invoked from network); 17 May 2022 04:10:29 -0000 Received: from alyss.skarnet.org (95.142.172.232) by inbox.vuxu.org with ESMTPUTF8; 17 May 2022 04:10:29 -0000 Received: (qmail 15713 invoked by uid 89); 17 May 2022 04:10:52 -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 15706 invoked from network); 17 May 2022 04:10:52 -0000 Date: Tue, 17 May 2022 04:10:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=r26.me; s=protonmail3; t=1652760624; x=1653019824; bh=vdvCiDRrnktoiSDqwPPvtbjT02jzbCLe9qRWoWJ5HZ4=; h=Date:To:From:Reply-To:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=NTIkowuZ0ETlh3GGOYIJ8gu6Xudm+67g9d1M8WmP0/Ax8sYJx4mAovG3Fu93db5bn ODVWueKZwiKz6a1PbTHIbOL9RDVyfmlejP/ULATsWdPpl6YDkrE+PbhWkzPKjzdnD/ vt5qZ/SGb0qeP/dSBFMn7ArEiylpCPNjv3Wm6MEI8Olsv3Rg0BR7uYFslsCJ/+HC9N VrnYHMsaOTqOghsY/0q+Ro/RuIcCkq+qKojxtzguYadWrU4J2RaIFFWmdd4by0W1Dz /izwwHL+IhlVlGWF+hkxipp02CIeVXOafALj0k7maP+YdqLXSBE94zPqp1lLLPmxmA Cl7assqRi21pw== To: Supervision From: Rio Liu Reply-To: Rio Liu Subject: Re: s6 xinit replacement? Message-ID: In-Reply-To: References: <3VJC4G8PXTKVS.3RQFDLXYQABMW@oak.localdomain> <3GMPPUYHIEJBK.3F20HQJFLEHMP@oak.localdomain> Feedback-ID: 28580590:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable This thread has inspired me to move my desktop setup under s6 this weekend.= Here's what I got: General flow: boot to tty1 -> login -> bash starts bashrc -> bashrc sets DI= SPLAY and TTY env vars then exec into s6-svscan -> s6-svscan starts xserver= , window manager, and other desktop services. Reading Samuel's reply, I find the easiest way to get around the controllin= g terminal issue is to give Xorg capability: `setcap cap_sys_tty_config=3D+= eip /usr/lib/Xorg`. (Considering Chromium has cap_sys_admin, letting Xorg c= ontrol ttys doesn't seem that bad). Setting the owner of tty doesn't quite = work in my case because of the login shell is attached to tty1 already. In my bashrc, I have some logic to check whether X should be started. Event= ually, it runs this code: exec execlineb /dev/stdin << EOF s6-setsid -q piperw 4 3 background { fdclose 3 fdmove 0 4 foreground { redirfd -w 1 /dev/null cat } foreground { s6-rc-init -l "$S6/live" -c "$S6/compiled" "$S6/service" } s6-rc -l "$S6/live" -up change "$1" } fdclose 4 s6-svscan -d 3 "$S6/service" EOF And I have $HOME/.service/xserver-srv/run that replaces startx/sx: #!/usr/bin/execlineb -P fdmove -c 2 1 importas DISPLAY DISPLAY importas TTY TTY if { test -r /dev/dri/card0 } if { test -n "${DISPLAY}" } backtick -E cookie { xxd -l 16 -ps /dev/urandom } foreground { xauth add "${DISPLAY}" MIT-MAGIC-COOKIE-1 "${cookie}" } Xorg "${DISPLAY}" -displayfd 3 "vt${TTY}" With a finish file: #!/usr/bin/execlineb -P if { test -n "$DISPLAY" } xauth remove "$DISPLAY" The window manager, pulseaudio server, and a few other services are started= together as well, using s6-rc to depend on xserver. This is what I ended up with: s6-supervise agetty-tty1 \_ login -- rio \_ s6-svscan -d 3 /tmp/rio/s6/1/service \_ s6-supervise xss-lock | \_ xss-lock -- s6-svc -1 /run/service/locker \_ s6-supervise xserver-srv | \_ /usr/lib/Xorg :1 -displayfd 3 vt1 \_ s6-supervise xserver-log | \_ s6-log -- n4 T /tmp/rio/s6/1/log/xserver \_ s6-supervise xbanish | \_ xbanish -i mod1 -i mod4 -i control \_ s6-supervise syndaemon | \_ syndaemon -tki 0.2 \_ s6-supervise pulseaudio-srv | \_ pulseaudio --exit-idle-time=3D-1 --daemonize=3Dno | \_ /usr/lib/pulse/gsettings-helper \_ s6-supervise pulseaudio-log | \_ s6-log -- -system_bus_socket T /tmp/rio/s6/1/log/pulseaudio \_ s6-supervise gcin | \_ gcin \_ s6-supervise awesome | \_ awesome --no-argb \_ s6-supervise s6rc-fdholder | \_ s6-fdholderd -1 -i data/rules \_ s6-supervise s6rc-oneshot-runner Now there are probably issues here and there, as I just got it running. Sug= gestions welcome. Rio