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);
        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?

Thanks so much for your help!
--Dallin

Reply via email to