serial console and log-in
Denis Vlasenko
vda.linux at googlemail.com
Tue Mar 6 15:32:44 PST 2007
On Tuesday 06 March 2007 14:00, Natanael Copa wrote:
> > How about writing small hack which analyzes stdin (fd #0)
> > and closes fd #0,1,2 + reopens/dups /dev/ttyN or /dev/ttySn:
...
> > Use it like this:
> >
> > ::respawn:/somewhere/cttyhack /sbin/getty - 9600 vt100
> >
> > Care to try? ;)
>
> I tried this. This works. Does the job.
Yes, I also tried it for bug hunting session. If more people
will find it useful, maybe we should have it then.
> However, its is hackish as you
> said:
>
> ~ $ who
> USER TTY IDLE TIME HOST
> root - ? Mar 6 12:39
> root tty2 . Mar 6 12:48
>
> Note that TTY ends up as -
> Are there any drawback with this? Can this make other programs behave
> strange?
Our who searches for TTY in utmp, and our getty, if run with '-',
places '-' in utmp as login console name.
IOW: it is mostly cosmetic and shouldn't affect anything.
> Another hackish way to solve it would be to have a 'is_serial_tty'
> binary in the initramfs:
>
> /* is_serial_tty.c */
> int main() {
> return (ioctl(0, TIOCGSERIAL, &sr) != 0);
> }
>
> and then copy a second inittab to new root, before running switchroot.
>
> This is also hackish and I don't know whats worst.
It will not work if console is somehow placed on ttyS1 - your
"serial" inittab will probably expect ttyS0.
> I'm seriously thinking of writing a new init, based on the upstart
> ideas. (unlike runinit, it will reuse sysv init.d scripts)
<subliminal message>
http://busybox.net/~vda/example_fs/README
</subliminal message>
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cttyhack.c
Type: text/x-csrc
Size: 1909 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20070307/d70cbd3a/attachment.c
More information about the busybox
mailing list