On Friday 18 May 2007 00:29, Hamish Moffatt wrote: > On Thu, May 17, 2007 at 11:28:06AM -0500, Dallas Clement wrote: > > I'm getting the infamous "Can't access tty; job control turned off" > > message when I try to invoke the ash shell during my initial bootup. > > > > I'm using busybox 1.5.0. I also understand that ash requires a > > controlling tty rather than the console. Though, I don't understand all > > the reasons. > > I saw this too when I upgraded from 1.4.2 from 1.5.0, so I switched > back. The same /dev entries work perfectly in 1.4.2. I did not have > time/need to debug it.
I think there is nothing to "debug", as this is not a bug. /dev/console CANNOT be a controlling tty, and code which was trying to "fix" this was removed from init.c The diff is a bit big: http://busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/init/init.c?rev=17937&r1=17917&r2=17937 but the core of change is here: static void console_init(void) { - int fd; - int tried = 0; - struct vt_stat vt; struct serial_struct sr; char *s; - if ((s = getenv("CONSOLE")) != NULL || (s = getenv("console")) != NULL) { - safe_strncpy(console_name, s, sizeof(console_name)); - } else { - /* 2.2 kernels: identify the real console backend and try to use it */ - if (ioctl(0, TIOCGSERIAL, &sr) == 0) { - /* this is a serial console */ - snprintf(console_name, sizeof(console_name) - 1, SC_FORMAT, sr.line); - } else if (ioctl(0, VT_GETSTATE, &vt) == 0) { - /* this is linux virtual tty */ - snprintf(console_name, sizeof(console_name) - 1, VC_FORMAT, vt.v_active); - } else { - strcpy(console_name, DEV_CONSOLE); - tried++; - } + s = getenv("CONSOLE"); + if (!s) s = getenv("console"); + if (s) { + int fd = open(s, O_RDWR | O_NONBLOCK | O_NOCTTY); + if (fd >= 0) { + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); + while (fd > 2) close(fd--); + } + messageD(L_LOG, "console='%s'", s); } - while ((fd = open(console_name, O_RDONLY | O_NONBLOCK)) < 0 && tried < 2) { - /* Can't open selected console -- try - logical system console and VT_MASTER */ - strcpy(console_name, (tried == 0 ? DEV_CONSOLE : CURRENT_VC)); - tried++; - } - if (fd < 0) { - /* Perhaps we should panic here? */ See those now-removed ioctls and then 'while ((fd = open(console_name...' ? This is the code which tried to close '/dev/console' and open '/dev/ttyN' or '/dev/ttyS0' instead. This is just WRONG. init should not do it. It should just use file descriptors 0, 1, and 2 which were given to it by kernel. -- vda _______________________________________________ busybox mailing list [email protected] http://busybox.net/cgi-bin/mailman/listinfo/busybox
