Text-Terminals on Linux - 14.1 Getty (used in /etc/inittab)

106 5
< Continued from page 2
parity. The garbled prompt will deter visitors, etc. from trying to login. That could be just what you want.
There is sometimes a problem with auto detection of parity. This happens because after you first type your login name, agetty starts the login program to finish logging you in. Unfortunately, the login program can't detect parity so if the getty program failed to determine the parity then login will not be able to determine it either.

If the first login attempt fails, login will let you try again, etc. (all with the parity set wrong). Eventually, after a number of failed attempts to login (or after a timeout) agetty will start up again and start the login sequences all over again. Once getty is running again, it may be able to detect the parity on the second try so everything may then work OK.

With wrong parity, the login program can't correctly read what you type and you can't log in. If your terminal supports received parity, you will continue to see a garbled screen. If getty fails to detect parity an /etc/issue file is usually dumped to the screen just before the before the prompt, so more garbled words may appear on the screen.

Why can't agetty detect parity by the first letter typed? Here's an example: Suppose it detects an 8-bit byte with its parity bit 0 (high-order bit) and with an odd number of 1-bits. What parity is it? Well, the odd number of 1 bits implies that it's odd parity. But it could also just be an 8-bit character with no parity.

There's no way so far to determine which. But so far we have eliminated the possibility of even parity. The detection of parity thus proceeds by a process of elimination.

If the next byte typed is similar to the first one and also only eliminates the possibility of even parity, it's still impossible to determine parity. This situation can continue indefinitely and in rare cases login will fail until you change your login-name. If agetty finds a parity bit of 1 it will assume that this is a parity bit and not a high-order bit of an 8-bit character. It thus assumes that you don't use meta-characters (high bit set) in your user name (i.e that your name is in ASCII).

One may get into a "login loop" in various ways. Suppose you only type a single letter or two for your login name and then hit return. If these letters are not sufficient for parity detection, then login runs before parity has been detected. Sometimes this problem happens if you don't have the terminal on and/or connected when agetty first starts up.

If you get stuck in this "login loop" a way out of it is to hit the return key several times until you get the getty login prompt. Another way is to just wait a minute or so for a timeout. Then the getty login prompt will be put on the screen by the getty program and you may try again to log in.

8-bit data bytes (plus parity)


Unfortunately, agetty can't detect this parity. As of late 1999 it has no option for disabling the auto-detection of parity and thus will detect incorrect parity. The result is that the login process will be garbled and parity will be set wrong. Thus it doesn't seem feasible to try to use 8-bit data bytes with parity.

getty (part of getty_ps)


(Most of this is from the old Serial-HOWTO by Greg Hankins)
For this getty one needs to both put entries in a configuration file and add an entry in /etc/inittab. Here are some example entries to use for your terminal that you put into the configuration file /etc/gettydefs.


# 38400 bps Dumb Terminal entry DT38400# B38400 CS8 CLOCAL # B38400 SANE -ISTRIP CLOCAL #@S @L login: #DT38400# 19200 bps Dumb Terminal entry DT19200# B19200 CS8 CLOCAL # B19200 SANE -ISTRIP CLOCAL #@S @L login: #DT19200# 9600 bps Dumb Terminal entry DT9600# B9600 CS8 CLOCAL # B9600 SANE -ISTRIP CLOCAL #@S @L login: #DT9600

Note that the DT38400, DT19200, etc. are just labels and must be the same that you use in /etc/inittab.

If you want, you can make getty print interesting things in the login banner. In my examples, I have the system name and the serial line printed. You can add other things: [blockquote
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.