
GETTY_PS 2.0.7d for Linux 1.0 and higher
----------------------------------------


OVERVIEW

This is my third major release of getty_ps for Linux.  It is intended
for Linux kernels at version 1.0 or higher (although it should function
correctly on 0.99.15 kernels as well).

There are many modifications to the source.  Some changes in the
serial drivers prompted this release.  vhangup() is handled correctly
now.  Also, thanks to Ted's new serial drivers, monitoring for other 
processes that have possibly messed up the line is much easier now.

The following bugs have been fixed:

	* SCHED is cleaned up and now handles timezones and
	  daylight savings time correctly
	* utmp logging should work correctly now, regardless of
	  which init program is being used
	* RINGBACK has slightly more sane default parameters

The following features have been added:

	* error and debug logging are handled with syslog by
	  default (you can still log to a file if you must)
	* users of ifmail (fidonet) should be able to run ifmail
	  without patching the getty source
	* debugging and error output is more verbose and easier
	  to understand

This release is intended as a maintenance release only.  The next
version of this package will be quite a bit different in most 
aspects.  There are some useful features coming up (such as fax-
receive and call-back).  

If you have any problems setting up the package, questions about mod-
ifications, or suggestions for additional features, feel free to mail 
me.  I am more than happy to help out.  When you mail me with problem
reports, please be sure to include full debugging output from getty
that illustrates the problem; I am pretty much helpless without it.

As always, I would love to hear any bug reports.

Kris Gleason
gleasokr@boulder.colorado.edu


CONTENTS

1.  Brief explination of serial drivers under Linux (0.99.15 and up)
2.  Compiling and installing the programs
3.  Setting up the configuration files
4.  Troubleshooting
5.  Credits, Thanks, Etc...


1.  SERIAL DRIVERS

    The serial drivers have changed again as of 0.99.15.  If you are
    not too interested in knowing how the serial ports work, you can
    probably skim over this section.

    The basic idea behind Linux serial drivers is that callin and
    callout devices should not try to use the same line at the same 
    time.  In the past, this was accomplished by juggling lockfiles.
    The new scheme takes care of the problem in the kernel.  Instead 
    of one modem device, there are now two: a callin device, named 
    /dev/ttyS# (where # is the port number), and a callout device, 
    named /dev/cua# (again, # = port number).  The callin devices are 
    used by programs like getty; the callout devices are used by 
    programs like Seyon and Kermit.  If you don't have the callout 
    devices in /dev, you create them with the mknod command.  They 
    are character devices, major number 5, minor number same as the 
    corresponding callin device.  Consult the Linux Device List for
    more information about creating the /dev entries.

    So how does it work?  Simple...

    Suppose that kermit wants to open /dev/cua1 for a callout session.
    The kernel allows the line to be open if and only if no other
    program currently has the corresponding /dev/ttyS1 line open; if
    it does, the error EBUSY is returned in errno.  

    The /dev/ttyS1 line is a bit more complicated.  By default, the device
    'blocks' on open.  This means that the program will be stopped until
    the device is clear to open.  For the device to be clear, two things
    must be true:  no process can be using the corresponding /dev/cua1
    line, and the carrier detect line of the serial port must be high.
    While the device is blocking, it is not busy, so callout devices can
    use the line.  In other words, if getty is running on /dev/ttyS1, as
    long as no incoming calls open the line (causing the carrier to go
    high), other programs are free to use the line.  Blocking can be dis-
    abled by setting the O_NDELAY flag to the open system call.  In this 
    case, carrier detect is not needed to open the line; however, if 
    /dev/ttyS1 is busy, EBUSY is still returned in errno and the open fails.
    Finally, a blocking open will return EAGAIN in errno if another process
    closes the corresponding callout device.  This allows getty to easily
    monitor the serial line, and reinitialize if another program might
    have changed serial port parameters (or modem parameters).

2.  COMPILING AND INSTALLING THE PROGRAMS

    Two binaries are the product of this package:  getty and uugetty.
    The only difference between getty and uugetty is that uugetty checks
    and creates lockfiles.  Uugetty should be used on any bidirectional
    line (modems, for example).  Getty should be used on unidirectional
    lines (virtual consoles, dumb terminals).

    Everything should be all set to compile on any 'normal' Linux box
    (whatever that is).  Just untar the sources (which I assume you've
    done if you're reading this), edit the Makefile to reflect your
    local configuration, favorite linking flags, etc...

    Also, edit the file tune.h, and change this to your liking.  Most
    everything is compiled in by default, so you probably don't need
    to tinker with this too much.  Do a make depend; make all to build 
    the programs.  I have also included binaries of getty and uugetty; 
    these files were compiled with gcc 2.5.8, and linked with 
    libc.so.4.5.21.  If your library is older, you will have to do the 
    compile yourself (or grab the new library).

    After the sources are compiled, MAKE A BACKUP COPY OF YOUR EXISTING
    WORKING GETTY PROGRAM!  I cannot stress this enough.  There is a good
    chance that you will not have things configured correctly the first
    time around, and will not be able to log into your machine.  This is
    also probably a good time to get one of those bootable rootdisks.  In
    any case, be sure you can boot your system in single user mode before
    you install anything.

    I like my getty binaries in /etc.  If you want yours in /bin or /sbin, 
    edit the Makefile.  Make install to copy the binaries into the correct 
    directories.  By default, your old getty and uugetty programs are saved 
    under getty- and uugetty-.  After everything is running smoothly, you 
    can remove these backup files.


3.  SETING UP CONFIGURATION FILES

    After you install the binaries AND BEFORE YOU LOGOUT/SHUTDOWN you must 
    edit the file /etc/inittab.  The argument format for getty_ps is:
    
      getty tty speed [terminal-type]
      uugetty tty speed [terminal-type]

    'Tty' is the line to run on (without the /dev).  Speed is the line speed
    as defined in /etc/gettydefs.  This argument must match the first field
    of one of the lines in /etc/gettydefs (see gettydefs(4) man page). The
    optional terminal-type is the expected type of terminal to be found at the
    other end.  I set this to console for vt's and vt100 for serial lines.
    Here is the relevant portion of my /etc/inittab file:

	1:123:respawn:/etc/getty tty1 VC console
	...
	s2:23:respawn:/etc/uugetty ttys2 2400 vt100

    Be sure the format of the inittab entries you create are consistent
    with the version of init you are using.  This example works with a
    SYS-V compatible init program.  If you are using simpleinit, the
    format is different.  You will want to change one of the lines to 
    use your OLD WORKING getty (named getty- if you used make install) 
    until everything is stable.

    Next, you want to create the configuration files.  The file
    /etc/gettydefs must exist for proper operation.  See the man page
    for gettydefs(5) for the format of this file.  There is an example
    under the examples directory that you can use to get started.

    You will also want to set up /etc/syslog.conf to properly log 
    getty error and debug output.  By default, getty logs to facility
    LOG_AUTH.  Errors are sent with priority LOG_ERR, and debugging
    output is sent with priority LOG_DEBUG.  If you don't like syslog,
    make the proper adjustments to tune.h.  Here are the relevant lines 
    from my /etc/syslog.conf:

	auth.warning;		/usr/adm/auth.log
	auth.debug;		/usr/adm/getty.debug.log

    Finally, you want to create configuration files for the individual
    lines.  These are kept in /etc/default.  If you are running getty on
    tty2, the configuration file is /etc/default/getty.tty2; for uugetty
    on ttyS0, /etc/default/uugetty.ttyS0.  Also, if you want the same file
    for all instances of getty or uugetty, you can make the file
    /etc/default/getty or /etc/default/uugetty.  Example configuration
    files are under the examples directory.  

    See the getty(1) manual page for more information on this file.  These 
    configuration files are optional, so your system won't crash if you 
    don't have them, and no configuration files are needed to run getty 
    on a virtual console or dumb terminal (though you can still have them 
    if you want).  The main purpose of the configuration files is to 
    configure your modem correctly.

    If you think you have everything right, reboot your system (you do have
    a _working_ bootable floppy, right?  I thought so).  If you can log into
    your system on the consoles you set to use the new getty, everything is
    working fine (at least on the consoles).  

    Next, after you have edited the configuration file for your modem's tty
    line, go over to a friend's house and try to call up.  If you have a
    14400 baud Hayes modem, the files I have included should drop right in
    and work; otherwise they might need some editing.

4.  TROUBLESHOOTING

    So, what could possibly go wrong?

    In my experience, the major source of confusion with getty_ps has
    been setting up the chat sequences correctly.  Failing chat 
    sequences will cause init to produce errors like 'respawning too 
    fast'.

    If your modem is not responding as expected to the INIT/OFF/CONNECT 
    chat sequences, getty will be continuously respawning.  Check your
    log files; if you have have lots of lines that say INIT sequence 
    failed, this is the problem.  Check your /etc/default/* files.  You 
    can turn on	debugging of the init sequence by adding the following line
    to your defaults file:

	DEBUG=010

    or, alternatly, add the -D010 flag to the entry in /etc/inittab.
	
    This will log some helpful information to syslog.  Read this for clues 
    as to what might be going wrong.

    If you get CONNECT sequence failed, then the CONNECT line is to blame.  
    Debug this line the same way.

    If you have other problems.  Turn on full debugging:
    
	DEBUG=777
	
    and read the debugging log.  If you can't make heads or tails of it,
    mail it to me and I'll see what I can do with it (after all... it 
    may be a bug).  I don't know anything about other types of modems, 
    so if you have modem specific questions, I probably can't help much.


5.  CREDITS, ETC...

Special thanks to all of these people:
	Paul Sutcliffe     ... original author
	Steve Robbins      ... former maintanier of getty_ps
	Michael Haardt     ... SYSV init support
	Theodore Tso       ... for a valuable discussion of the
	                       new serial drivers
	Shane Alderton     ... for the ringback patches
	Julian Cowley      ... for helping with the transition to the
                               0.99.15 serial drivers
	Dr. G.W. Wettstein ... for syslog patches
	Eugene Crosser     ... fidonet patches

I have included all of the original documentation from this package under
the OLD directory.  You might find it useful.  If you find that this file
is missing something, please let me know.  I've tried to be as complete as
possible without writing a book, but I have been known to screw up in the
past.

Good Luck.

Kris Gleason
gleasokr@boulder.colorado.edu
