From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1191 Path: news.gmane.org!not-for-mail From: Charlie Brady Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: Runit on tty1 Date: Wed, 5 Jul 2006 11:08:02 -0400 (EDT) Message-ID: References: <449C4064.6050504@langside.org.uk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: sea.gmane.org 1152112106 4700 80.91.229.2 (5 Jul 2006 15:08:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 5 Jul 2006 15:08:26 +0000 (UTC) Cc: supervision@list.skarnet.org Original-X-From: supervision-return-1427-gcsg-supervision=m.gmane.org@list.skarnet.org Wed Jul 05 17:08:24 2006 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1Fy8z0-0000I2-Bg for gcsg-supervision@gmane.org; Wed, 05 Jul 2006 17:08:08 +0200 Original-Received: (qmail 3476 invoked by uid 76); 5 Jul 2006 15:08:26 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 3470 invoked from network); 5 Jul 2006 15:08:26 -0000 X-X-Sender: charlieb@e-smith.charlieb.ott.istop.com Original-To: Richard A Downing FBCS CITP In-Reply-To: <449C4064.6050504@langside.org.uk> Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1191 Archived-At: On Fri, 23 Jun 2006, Richard A Downing FBCS CITP wrote: > I have just built a new system (glibc-2.4, gcc04.1.1, linux-2.6.17.1) > with runit-1.5.1. > This seems to be quite stable except that tty1 does not accept ctrl-c - > indeed if /etc/runit/ctrlaltdel exists, this is run when ctrl-c is > pressed on tty1 (and causes a reboot as expected). What are you running on tty1 and how is it started? > Another effect, also only on tty1 is that a long output can be > interrupted by a replay of earlier output, this can be recovered by > switching to another tty and back - nothing is in fact list, it's just > the screen output. I'm sorry, I cannot parse that sentence and I do not know exactly what you are describing. Could you try again? > Further investigation reveals that runit, as process 1, is marked by > ps-ef as being on tty1 and the bash process started by getty-1 is marked > as ? for it's TTY. Is getty-1 a runit supervised process? If so, what is its run script? > I suspect this is the problem, as it is quite unlike > my other runit-based systems. > There are no errors in the runsvdir proctitle. I've used the following program to start a well behaved shell on tty1 under runit supervision. I wouldn't be surprised if not all the magic invocations are necessary: #include #include #include #include main(argc, argv) int argc; char *argv[]; { int fd; ++argv; struct termios tty; if (! *argv) { exit(1); } /* Clean up */ ioctl(0, TIOCNOTTY, 0); close(0); close(1); close(2); setsid(); /* Reopen console */ if ((fd = open("/dev/tts/1", O_RDWR)) < 0) { return errno; } dup2(fd, 0); dup2(fd, 1); dup2(fd, 2); ioctl(0, TIOCSCTTY, 1); tcsetpgrp(0, getpgrp()); /* Set terminal settings to reasonable defaults */ tcgetattr(0, &tty); /* set control chars */ tty.c_cc[VINTR] = 3; /* C-c */ tty.c_cc[VQUIT] = 28; /* C-\ */ tty.c_cc[VERASE] = 127; /* C-? */ tty.c_cc[VKILL] = 21; /* C-u */ tty.c_cc[VEOF] = 4; /* C-d */ tty.c_cc[VSTART] = 17; /* C-q */ tty.c_cc[VSTOP] = 19; /* C-s */ tty.c_cc[VSUSP] = 26; /* C-z */ /* use line dicipline 0 */ tty.c_line = 0; /* Make it be sane */ tty.c_cflag &= CBAUD|CBAUDEX|CSIZE|CSTOPB|PARENB|PARODD; tty.c_cflag |= CREAD|HUPCL|CLOCAL; /* input modes */ tty.c_iflag = ICRNL | IXON | IXOFF; /* output modes */ tty.c_oflag = OPOST | ONLCR; /* local modes */ tty.c_lflag = ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE | IEXTEN; tcsetattr(0, TCSANOW, &tty); execvp(*argv, argv); exit(3); }