[MAYBE SOLVED] was Can't resolv "sh: can't access tty; job control turned of

Denis Vlasenko vda.linux at googlemail.com
Thu Jan 18 01:28:24 UTC 2007


On Wednesday 17 January 2007 23:27, Laurent B wrote:
> >
> >On Wed, Jan 17, 2007 at 09:26:10PM +0100, Laurent B wrote:
> > > rm /dev/tty
> > > ln -s /dev/pts/0 /dev/tty
> >
> >That's wrong. I hope you don't use more than one login at the same time,
> >as those will get pts/1, pts/2, etc., but /dev/tty will point to the
> >wrong one.

Here I have current svn's telnetd running in standalone mode
_without_ controlling tty (i.e. it is not run from command line,
it runs, like in your case, detached from any terminal):

# ps -AH e
  PID TTY      STAT   TIME COMMAND
....
31922 ?        S      0:00   ./busybox telnetd MANPATH=...

This is how I connect to it and get ash prompt,
without that "bad message" (strace):

02:21:24.913165 select(4, [3], [], NULL, NULL) = 1 (in [3])
02:21:27.128101 accept(3, 0, NULL)      = 4
02:21:27.131596 open("/dev/ptmx", O_RDWR|O_LARGEFILE) = 5
02:21:27.131733 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
02:21:27.131847 ioctl(5, TIOCGPTN, [5]) = 0
02:21:27.131923 stat64("/dev/pts/5", {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 5), ...}) = 0
02:21:27.132039 statfs("/dev/pts/5", {f_type="DEVPTS_SUPER_MAGIC", f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255}) = 0
02:21:27.132144 ioctl(5, TIOCSPTLCK, [0]) = 0
02:21:27.132223 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
02:21:27.132309 ioctl(5, TIOCGPTN, [5]) = 0
02:21:27.132387 stat64("/dev/pts/5", {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 5), ...}) = 0
02:21:27.132503 fcntl64(5, F_GETFL)     = 0x8002 (flags O_RDWR|O_LARGEFILE)
02:21:27.132578 fcntl64(5, F_SETFL, O_RDWR|O_NONBLOCK|O_LARGEFILE) = 0
02:21:27.132650 fcntl64(4, F_GETFL)     = 0x2 (flags O_RDWR)
02:21:27.132721 fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
02:21:27.132792 fcntl64(4, F_GETFL)     = 0x802 (flags O_RDWR|O_NONBLOCK)
02:21:27.132864 fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
02:21:27.132940 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xf7e23908) = 32050

(hmmm do you need output of strace -f so that you see what child's doing?)

02:21:27.134321 select(6, [3 4 5], [4], NULL, NULL) = 2 (in [5], out [4])
02:21:27.134577 write(4, "\377\375\1\377\375\37\377\375!\377\373\1\377\373\3", 15) = 15
02:21:27.134708 read(5, "\r\r\nshadow login: ", 3985) = 17
02:21:27.134800 select(6, [3 4 5], [4], NULL, NULL) = 1 (out [4])
02:21:27.135034 write(4, "\r\r\nshadow login: ", 17) = 17
02:21:27.135128 select(6, [3 4 5], [], NULL, NULL) = 1 (in [4])
02:21:27.135810 read(4, "\377\374\1\377\374\37\377\374!\377\375\1\377\375\3", 4000) = 15
02:21:27.135912 select(6, [3 4 5], [5], NULL, NULL) = 1 (out [5])
02:21:27.136143 write(5, "", 0)         = 0
02:21:27.136226 select(6, [3 4 5], [], NULL, NULL) = 1 (in [4])
02:21:32.202748 read(4, "r", 4000)      = 1
02:21:32.202855 select(6, [3 4 5], [5], NULL, NULL) = 1 (out [5])
02:21:32.203093 write(5, "r", 1)        = 1
02:21:32.203173 select(6, [3 4 5], [], NULL, NULL) = 1 (in [5])
02:21:32.203365 read(5, "r", 4000)      = 1
02:21:32.203443 select(6, [3 4 5], [4], NULL, NULL) = 1 (out [4])
02:21:32.203672 write(4, "r", 1)        = 1
02:21:32.203835 select(6, [3 4 5], [], NULL, NULL) = 1 (in [4])
02:21:32.449781 read(4, "o", 4000)      = 1
02:21:32.449886 select(6, [3 4 5], [5], NULL, NULL) = 1 (out [5])
02:21:32.450150 write(5, "o", 1)        = 1
02:21:32.450231 select(6, [3 4 5], [], NULL, NULL) = 1 (in [5])
02:21:32.450423 read(5, "o", 4000)      = 1
02:21:32.450501 select(6, [3 4 5], [4], NULL, NULL) = 1 (out [4])
02:21:32.450732 write(4, "o", 1)        = 1
02:21:32.450905 select(6, [3 4 5], [], NULL, NULL) = 1 (in [4])
02:21:32.575433 read(4, "o", 4000)      = 1
02:21:32.575538 select(6, [3 4 5], [5], NULL, NULL) = 1 (out [5])
02:21:32.575772 write(5, "o", 1)        = 1
02:21:32.575852 select(6, [3 4 5], [], NULL, NULL) = 1 (in [5])
02:21:32.576048 read(5, "o", 4000)      = 1
02:21:32.576126 select(6, [3 4 5], [4], NULL, NULL) = 1 (out [4])
02:21:32.576355 write(4, "o", 1)        = 1
02:21:32.576522 select(6, [3 4 5], [], NULL, NULL) = 1 (in [4])
02:21:32.660848 read(4, "t", 4000)      = 1
02:21:32.660951 select(6, [3 4 5], [5], NULL, NULL) = 1 (out [5])
02:21:32.661191 write(5, "t", 1)        = 1
02:21:32.661272 select(6, [3 4 5], [], NULL, NULL) = 1 (in [5])
02:21:32.661463 read(5, "t", 4000)      = 1
02:21:32.661542 select(6, [3 4 5], [4], NULL, NULL) = 1 (out [4])
02:21:32.661772 write(4, "t", 1)        = 1
02:21:32.661949 select(6, [3 4 5], [], NULL, NULL) = 1 (in [4])
02:21:33.595132 read(4, "\r\0", 4000)   = 2
02:21:33.595239 select(6, [3 4 5], [5], NULL, NULL) = 1 (out [5])
02:21:33.595475 write(5, "\r", 1)       = 1
02:21:33.596275 select(6, [3 4 5], [], NULL, NULL) = 1 (in [5])
02:21:33.596478 read(5, "\r\nPassword: ", 4000) = 12
02:21:33.596563 select(6, [3 4 5], [4], NULL, NULL) = 1 (out [4])
02:21:33.596833 write(4, "\r\nPassword: ", 12) = 12
02:21:33.597115 select(6, [3 4 5], [], NULL, NULL) = 1 (in [4])
	[password typed in]
02:21:36.309766 select(6, [3 4 5], [], NULL, NULL) = 1 (in [4])
02:21:36.534578 read(4, "\r\0", 4000)   = 2
02:21:36.534684 select(6, [3 4 5], [5], NULL, NULL) = 1 (out [5])
02:21:36.534913 write(5, "\r", 1)       = 1
02:21:36.547699 select(6, [3 4 5], [], NULL, NULL) = 1 (in [5])
02:21:36.547910 read(5, "\r\nLinux 2.6.18.1_64smp_ipv6.\r\n-a"..., 4000) = 420
02:21:36.548021 select(6, [3 4 5], [4], NULL, NULL) = 1 (out [4])
02:21:36.548255 write(4, "\r\nLinux 2.6.18.1_64smp_ipv6.\r\n-a"..., 420) = 420
02:21:36.549110 select(6, [3 4 5], [], NULL, NULL <unfinished ...>

--
vda



More information about the busybox mailing list