[BusyBox] ctrl-c exits kills init:getty

Stewart Brodie stewart.brodie at pace.co.uk
Fri Apr 25 13:15:03 UTC 2003


In message <000a01c30b29$9cda9040$0200a8c0 at athlon1200>
          "Brian T." <btuch at usa.net> wrote:

> > > I recently upgraded our Embedded distro from Busybox 0.60.0 to 0.60.5.
> > > Most of the time now ctrl-c will kill getty when logged in through the
> > > console, and force users to log back in again.  I noticed that after
> > > upgrading, when the unit boots it prints out a "getty:" by itself on
> > > one line just before getting the /etc/issue login screen.  The older
> > > version of busybox didn't do this.  The unit will also print out
> > > "getty:" when ctrl-c is hit.  Has anyone else had this problem?  I
> > > ruled out that it is not Tinylogin (which is getty) since I rolled back
> > > to Tinylogin 0.80.0 and I had the same result. (running BB 0.60.0 and
> > > Tinylogin 1.4 I don't have this problem).  I am also using the 2.4.20
> > > kernel.  Anyone else seen this?
> > 
> > When you say you are running on the console, are you really running on
> > /dev/console?  What does your /etc/inittab file show?
> 
> One other thing also, ctrl-c seems not to exit ping, tail, or other
> programs that allow it.  The console (ttyS0) doesn't lock (I can still hit
> <cr> and get a line feed) but cannot get out of it.  Can still telnet to
> the box though.

telnet in again, look up the pid of tail and then cat /proc/<tailpid>/status
and check the ignored signal list.  Are bits 1 and 2 set in SigIgn?  If so,
that's why you can't CTRL-C it.

We've seen CTRL-C not working too, but I believe I've tracked down the root
cause.  It was that I was doing "utelnetd >dev/null 2>/dev/null </dev/null &"
in my startup script which ended up confusing ash, as far as I could tell,
such that SIGINT and SIGQUIT remained blocked in the telnet daemon and hence
remained blocked in the subshells.  ash noticed that the signals were blocked
when it was started and forced them into the S_HARD_IGN state (which means
that it could never unblock them again).

I fixed it by ditching utelnetd and putting the busybox telnetd in instead. 
Since this makes the call to daemon(), I don't need the silly redirections
and backgrounding in the startup script.

I have now discovered another ash bug that affects the use of trap to trap
SIGINT.  If you have command-line editing enabled such that cmdedit.c is
reading the characters and you press CTRL-C, cmdedit.c catches it (because
it's set ISIG on the terminal) and notices it, but does not notify the shell
to execute the trap handler for SIGINT.


-- 
Stewart Brodie, Senior Software Engineer, available from the end of June


More information about the busybox mailing list