On Mon, Mar 29, 2010 at 4:26 PM, Paul Smith <[email protected]> wrote: > Hi all. I have an embedded system with a serial line hooked up to > either ttyS0 or ttyS1, depending on the kind of hardware. I want to put > a login session on it so that it doesn't just give a shell prompt when > people attach to it. > > So, I had this in my inittab: > > # Allow login on the console > tty0::askfirst:/bin/login > ttyS0::askfirst:/bin/login > ttyS1::askfirst:/bin/login > > This worked OK, with one problem: the /bin/login spawned on the serial > line that did NOT exist, failed: /bin/login exits because it cannot open > the tty. Then init sees that /bin/login fails and respawns it (I want > this to happen so that you can log in more than one time!) > Then /bin/login fails, then is respawned, etc. many times per second,
This is strange. Which version is it? There is an one-second sleep to prevent such behavior: /* Don't consume all CPU time -- sleep a bit */ sleep(1); and it was added eight years ago... > which puts a noticeable load on the system. The login on the serial > line that does exist, though, works perfectly. > > So, to solve this I decided to try to configure the serial line after > the boot, once I figured out what kind of system I was on so I would > know which serial line to use. That's what getty is for. examples/inittab has these: # /sbin/getty invocations for selected ttys tty4::respawn:/sbin/getty 38400 tty5 tty5::respawn:/sbin/getty 38400 tty6 # Example of how to put a getty on a serial line (for a terminal) #::respawn:/sbin/getty -L ttyS0 9600 vt100 #::respawn:/sbin/getty -L ttyS1 9600 vt100 # # Example how to put a getty on a modem line. #::respawn:/sbin/getty 57600 ttyS2 > So, during the initial boot sequence in > rcS I figure this out, then echo 'ttyS0::askfirst:/bin/login' >>> /etc/inittab (or ttyS1 as appropriate). Then I "kill -HUP 1" to get > init to reload and start /bin/login. > > This does work, BUT the line discipline or something is all messed up on > the tty. I enter the "root" username and it's printed again after I hit > return. Then it asks for a password and my password is displayed as I > type it, so noecho is not working. Then once I get a shell prompt none > of the editing works, either in the (ash) shell or in (busybox) vi, > etc.: in both environments the control command I type (tab, ^P, j, k, > etc.) are all printed to the screen and the operation they perform is > not shown (the cursor doesn't move, etc.) However, the commands DO take > effect; if I tab-complete and press RETURN the filename was completed > and the command runs. It's just the terminal display that's wrong. > > > I'm interested in any solution that moves me forward: either a way to > keep /bin/login from respawning on terminals that don't exist, or a way > to reset the terminal after modifying inittab, or anything else. Try using getty, and let me know what do you see with it. -- vda _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
