How To Clear A Hung tty Port at AIX 4.x


Contents

About this document
How to clear a hung tty port

About this document

This document provides information for clearing a hung tty port in AIX 4.x.


How to clear a hung tty port

For purposes of the following examples, the hung tty port is assumed to be tty0.

  1. Determine whether the tty is currently handling any processes by entering:
    	ps -ef | grep tty0 
    

    The preceding commmand would return something like the following:

    	root  12345    1   0   Aug 29     0     /path/program_name 
    

    The process ID (PID) here is "12345". To kill this process enter:

    	kill 12345 
    

    The command ps -ef | grep tty0 may be run again to determine whether the process was successfully killed.

    If the process still exists, (and it IS NOT a slattach process), try adding a -9 to the command.

    For example,

    	kill -9 12345
    

    Never use a -9 option to kill a slattach process because it may hang the AIX system.

    NOTE: If the process is 'getty', use the following command to kill the process:

    	pdisable tty0 
    

    If the offending process has been successfully killed, but the tty is still unresponsive, go to step 2.

  2. Enter:
    	fuser -k /dev/tty0
    

    This will kill any process that can be found running on the port and display the PID (process ID).

    If the tty is still unusable, continue to step 3.

  3. Detach and re-attach the cable from the hung port. AIX uses the Data Carrier Detect (DCD) signal to determine the presence of a device attached to the port. By dropping DCD, detaching and re-attaching the cable will in many cases clear hung processes.

    To determine the location of the port on which the tty is configured, enter the following command:

    	lsdev -Cl tty0
    

    The third column in the output of this command indicates the address of the tty (for example, 'S1' below indicates the tty is configured for native serial port 1).

    	tty0  Available 00-00-S1-00 Asynchronous Terminal 
    

    If the tty is still unusable, go to step 4.

  4. Flush the port by using stty-cxma:
    	/usr/lbin/tty/stty-cxma flush tty0 
    

    This command is intended for tty's configured on ports of the 128-port adapter; however, in some cases it can be successfully used to flush other tty ports.

    If the tty is still unusable, try step 5.

  5. On the keyboard of the hung terminal, press the Q key while holding down the Ctrl key. This will resume any suspended output by sending an Xon character.

    If the tty is still unusable continue to step 6.

  6. As the AIX 4.x tty subsystem is STREAMS based, one can use strreset command to reset the stream (this command does not exist on AIX 3.2.x systems).

    Retrieve the major and minor numbers of the tty by entering:

    	ls -l /dev/tty0
    

    The output should look like the following:

    	crw--w--w-   1 root     system    44,129 Aug 28 13:12 /dev/tty0 
    

    The major and minor numbers are 44 and 129 respectively. To reset this tty enter:

    	/usr/sbin/strreset -M 44 -m 129 
    

    If the tty is still unusable try step 7.

  7. A program will sometimes open a tty port, modify some attributes, and when closing the port, the program will not reset the attributes. To correct this, bring the tty down to a DEFINED state and then make it available by entering:
    	rmdev -l tty0 
    

    This command leaves the information concerning the tty in the database but makes the tty unavailable to the system.

    The following command reactivates the tty making it available to the system.

    	mkdev -1 tty0 
    

    If the tty is still unusable, consider moving the device (terminal, modem, etc.), to another port and configuring a tty at that location until the system can be rebooted. If a reboot does not clear the port, a hardware problem is indicated. Check the error report for port hardware problems by entering:

    	errpt -a | pg 
    

NOTE: Some of the preceding commands will not work and they will give a method error indicating that the device is busy. This is because of the process running on the tty. If none of the steps detailed above free the hung tty, as a last resort, reboot the AIX box and flush the kernel so that the process will go away.


[ Doc Ref: 90605225114676     Publish Date: Jun. 22, 2000     4FAX Ref: 6833 ]