supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Samuel Holland <samuel@sholland.org>
To: supervision@list.skarnet.org
Subject: Re: s6 xinit replacement?
Date: Sat, 28 May 2022 14:43:22 -0500	[thread overview]
Message-ID: <842daac2-1413-3ce8-40ac-4af5c63bfa2f@sholland.org> (raw)
In-Reply-To: <24F5HUEF0UP3F.2ESV518R0KDGL@oak.localdomain>

On 5/28/22 12:15 PM, Dallin Dahl wrote:
> It turns out I had the same issue as Rio, since my login shell was still
> controlling my terminal.  If I run:
> 
> exec s6-setsid X :3 vt3
> 
> while logged into tty3, I get an X display.  However, I still can't
> seem to get it to work with s6-svscan.  If I exec into s6-svscan from
> my login shell, svscan then controls the tty.  If I exec into s6-setsid
> s6-svscan, it still seems attached to the tty.  I thought that maybe
> using the tiocnotty ioctl call would free the tty for X to pick up,
> so I wrote the following wrapper program:
> 
> #include <fcntl.h>
> #include <sys/ioctl.h>
> #include <stdio.h>
> #include <unistd.h>
> 
> int main(int argc, char **argv) {
> 	int tty = open("/dev/tty", O_RDONLY);

This doesn't close the TTY. I don't know if that makes a difference.

> 	int res = ioctl(tty, TIOCNOTTY);
> 	if(!~res) perror("tiocnotty");
> 	argv++;
> 	execvp(*argv, argv);
> 	return 0;
> }
> 
> and tried to exec into that before s6-svscan, both with and without
> s6-setsid.  Unfortunately, the process immediately exits.  I don't think
> it's my wrapper program, since I can run other programs with it without
> problems, and they do indeed show up in the output of ps aux without a
> controlling terminal.
> 
> So I guess the new question is how can I free the tty after login,
> allowing X to open it and control it?

Have you tried redirecting all three standard fds elsewhere (/dev/null or a
file) when running s6-svscan? Possibly either s6-svscan or s6-supervise is doing
some fd manipulation that steals control of the TTY before X can get it. You
could also try running s6-supervise directly to narrow this down.

Regards,
Samuel

      reply	other threads:[~2022-05-28 19:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11  3:36 dallinjdahl
2022-05-14  3:47 ` Guillermo
2022-05-14 23:45   ` dallinjdahl
2022-05-15  1:52     ` Laurent Bercot
2022-05-15 15:02       ` Guillermo
2022-05-17  4:10         ` Rio Liu
2022-05-15  2:44   ` Samuel Holland
2022-05-22 15:07     ` Guillermo
2022-05-22 16:33       ` Samuel Holland
2022-05-23 10:05       ` yianiris
2022-05-23 23:40         ` Guillermo
2022-05-27  2:04         ` Steve Litt
2022-05-28  4:07     ` Dallin Dahl
2022-05-28 17:15     ` Dallin Dahl
2022-05-28 19:43       ` Samuel Holland [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=842daac2-1413-3ce8-40ac-4af5c63bfa2f@sholland.org \
    --to=samuel@sholland.org \
    --cc=supervision@list.skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).