[BusyBox] How can i run my shell on normal tty, such as tty1, ttyS0.

Paul Fox pgf at brightstareng.com
Wed Jun 8 14:02:48 UTC 2005

 > wei gang wrote:
 > > This may be help you!
 > > http://www.busybox.net/FAQ.html#job_control
 > As this question comes up frequently, perhaps we could add to this 
 > explanation, since evidently people do not know how to run a shell "on a 
 > real console", and most folks are not going to hack their kernel in the 
 > manner presently suggested by the FAQ entry.
 > The normal way to lauch a shell and avoid the "can't access tty" error 
 > is to let "init" launch the shell.  Make sure that "init" is the first 
 > task that is launched in userspace.  The kernel will normally try to 
 > launch /sbin/init, unless you pass in an init=... commandline option. 
 > Check your bootloader to see what you're passing.
 > Make sure you have compiled busybox with init support (CONFIG_INIT=y). 
 > Also make sure you enable CONFIG_FEATURE_USE_INITTAB=y so that init will 
 > read from the /etc/inittab file to determine what to do at startup.  The 
 > inittab file should contain, amongst other things, the following:
 > tty1::respawn:/sbin/getty 38400 tty1
 > tty2::respawn:/sbin/getty 38400 tty2
 > This will launch two shells on tty1 and tty2 (that's ALT-F1 and ALT-F2)
 > assuming you have a screen & keyboard attached.  For embedded systems 
 > which only have a serial port, these two lines are not appropriate (and 
 > if you use them, you'll see kernel boot messages, then nothing more). 
 > Instead of the above two lines, you should use:
 > ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100

note that getty is taking care of some important housekeeping in
this case.  if you attempt to simplify your system and eliminate
the login prompt by doing something like this:


you'll end up with a shell without job control.

we addressed this with:

with that patch you can write the above line this way:


(which is currently allowed but ignored by busybox init) and the shell
will be given its own session and controlling tty.

our real application of this isn't for direct shell startup.  but
by doing this:


we can arrange for rcS to have some tty-aware pause and escape-to-shell
hooks which work correctly.

 paul fox, pgf at brightstareng.com

More information about the busybox mailing list