Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Mar 2007 11:16:45 -0400
From:      "David Robillard" <david.robillard@gmail.com>
To:        "FreeBSD Questions" <freebsd-questions@freebsd.org>
Cc:        Dan D Niles <dan@more.net>
Subject:   Re: Serial Port Problems (Solved)
Message-ID:  <226ae0c60703160816v3d90ec0eg29bac15a5676f875@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
> On Thu, 2007-03-01 at 15:27 -0600, Dan D Niles wrote:
>> If I disconnect and come back later
>> (sometimes), or if I hit return without entering a login name (always)
>> it starts spitting out junk like:
>>
>> nooo~:Woo{;>6(|uww~now~nou})|t}}t9-
>
> I found a solution, although I'm not sure why it works.
>
> When you just hit enter getty goes back to the beginning of its loop.
> This also happens if you enter a name starting with "-" or consisting of
> just spaces.  These also causes the output to become garbled.
>
> At the beginning of the loop it calls setttymode(0).  If I insert a
> sleep(1) before this call, everything works correctly.  If I insert the
> sleep after that, the output still gets garbled.
>
> Like I said, I don't know why it works, but it does.
>
> I don't think a short delay is unreasonable after entering invalid or no
> information.  I am going to submit a PR with a patch.

I have the same behavior as you do on some machines here. But I
originally thought it was caused by the (old) serial port card I used
to build a serial console server.

The card is an EasyIO PCI 8-port card from Stallion Technologies as
suggested by Gregory Bond's article "Console Server" from
http://www.freebsd.org/doc/en_US.ISO8859-1/articles/console-server/index.html
(BTW, don't buy this card today because it's driver was not ported
from FreeBSD 4.x to neither 5.x nor 6.x.)

That being said, I checked /usr/src/libexec/getty/main.c to find out
how to recreate your fix. But I'm not a huge C programmer, so I tried
other ways to solve this.

That brought me to gettytab(5) which says that the "de" field controls
the "delay secs and flush input before writing first prompt" as the
man page puts it.

So I changed a test machine's gettytab default entry from:

default:\
        :cb:ce:ck:lc:fd#1000:im=\r\n%h (%t)\r\n\r\n:sp#1200:\
        :if=/etc/issue:

To:

default:\
        :cb:ce:ck:lc:fd#1000:im=\r\n%h (%t)\r\n\r\n:sp#1200:\
        :if=/etc/issue:de=2:

And restarted (not sure if a reboot is necessary here?). I had to
fiddle a bit with the delay, but it did help.

HTH,

David
-- 
David Robillard
UNIX systems administrator & Oracle DBA
CISSP, RHCE & Sun Certified Security Administrator
Montreal: +1 514 966 0122



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?226ae0c60703160816v3d90ec0eg29bac15a5676f875>