[comp.sys.hp] Strange "getty: failed to open /dev/tty" behavior

jbh@bnrunix.UUCP (John B. Hampton) (08/23/90)

We recently saw something baffling on one of our HP 9000/360
workstations, running HP-UX 6.5.  After four days' continuous logon,
the following message appeared in the "console" window:

	getty: failed to open /dev/tty: no such device or address

The message was repeated at regular intervals as getty died and was
respawned.  This continued for two days.  We fired off a getty from
another window, and this worked normally.  We logged off and rebooted; 
of course, the condition didn't reappear, and hasn't been seen in the
week since.

My question is, if anyone else has seen this, what are the cause and
cure (other than the "Gordian" solution :-) ?

Many thanks in advance,

John Hampton
-- 
--------------------------------------------------------------------
John Hampton 		UUCP: ...mcnc!rti!bnrunix!jbh
BNR, Inc.		POB 13478  RTP, NC 27709	919-991-8146

rdg@hpfcmgw.HP.COM (Rob Gardner) (08/25/90)

> 	getty: failed to open /dev/tty: no such device or address

That message is in there to save you a few headaches. It might seem
like the message itself is a headache, but at least you have some idea
what the problem is. If /dev/tty doesn't open successfully, it means
that the getty failed to associate its process group with the terminal
specified on the command line. This means that the shell exec'd from
this getty, and all descendant processes will have no control
terminal. A more serious problem is that you won't be able to login on
this port if you try to login to an account with a password. After
entering the account name, you will see "Login incorrect" immediately,
before even being prompted for a password! This is because the
getpass() routine used by login tries to open /dev/tty to read the
password. If you manage to login to an account with no password, the
first thing you'll probably notice is that the ps command will show
"?" for the tty.  Then you'll notice that the break key doesn't work.
And of course, any command that calls getpass(), or relies of /dev/tty
in some way wll fail. AND, all this will be very mysterious, and it
will give you a serious headache.

What causes this anyway? Association of process group leader and
control terminal occurs only if the process group currently has no
control terminal, and the terminal is currently not somebody elses
control terminal. (BTW, association occurs when the tty device is
opened.)  Now, the getty is definitely a process group leader with no
control terminal. So, the problem is that the terminal you want the
getty to run on is already associated with somebody else. The ps
command shows (in the tty column) the control terminal for each
process running. I have seen this happen when some backround script 
decides to open /dev/console or something to print a message. It may
also happen because some process that was associated with the device
in question is still hanging around waiting for somebody to send it
a SIGNUKE.

Rob

rjn@hpfcso.HP.COM (Bob Niland) (08/25/90)

re: > We recently saw something baffling on one of our HP 9000/360
    > workstations, running HP-UX 6.5.  After four days' continuous logon,
    > the following message appeared in the "console" window:

    >	getty: failed to open /dev/tty: no such device or address

I suspect the major clue is "4 days".  I'll bet a shell timed out beneath
some other command/application child, but the now-orphaned children weren't
killed or refused to die.  They still had the console open, so getty
couldn't reopen it.

Regards,                                              Hewlett-Packard
Bob Niland      Internet: rjn@hpfcrjn.FC.HP.COM       3404 East Harmony Road
                UUCP: [hplabs|hpfcse]!hpfcrjn!rjn     Ft Collins CO 80525-9599