Friday, January 25, 2008

Unlocking Terminals on Unix/uniVerse Systems

Unlocking Terminals on Unix/uniVerse Systems

To unhang a terminal never issue a unix kill. Instead use the following commands which must be done in UV (as super user). This document assumes you have already tried CTRL-Q unsuccessfully from the hung terminal. This works very often as a first resort for networked terminals and 'PC's where there are unknown causes for hanging and you know your network isn't down. If you haven't tried CTRL-Q, do so now. You may be done. For other instances, continue.

Also, if the terminal or PC has been power-cycled (turned off and on), the following exercise may be futile and damage to data files may have already occurred (turning off a networked terminal or PC terminates a telnet session which then kills all UV processes). It is essential that power never be turned off unless the terminal is at a login prompt. This destroys the data-trail left when a terminal hangs. It is also imperative that pdisable and penable on the IBM RS/6000 not be used. This is tatamount to a kill and is meant only to be used when disabling a terminal line during maintenance (pdisable only works until the next reboot). If the client machine is an HP on unix 9.04, os patch PHNE_5603 (which superseded PHNE_4753) for the telnetd executable will be needed.

I am going to use a ficticious user's terminal (port 32, tty unknown) as our hung terminal and will refer to the example output from PORT-STATUS and LIST-READU EVERY which are included at the end of this document.

  1. Go to the UV sysadm menu and remove unused printer memory segments (the command line for performing this step is: uvlictool clean_lic -a). If you are not at the system administration menu already, then at TCL (in the uniVerse account), type LOGIN (which contains the line MOTIF SYSADM.MENU which you could type at TCL, too) which will take you to the UV sysadm menu. Once there, type ONLY M (you won't need to press Enter), then R, then Y, then ENTER or C. If you read the options as you do them, you will see that you are removing unused printer memory segments. This is a major cause of not being able to log back in, OR the message that the uniVerse user
  2. Sometimes after doing #1, you will be done and it is all that is needed after CTRL-Q has been done and the user gets a login but can't log in. NOTE: If the terminal appears to be doing something but nothing echos to the screen or there is a lot of garbage on the screen, try sh -c 'stty sane' on that terminal for platforms running unix System V (IBM, HP, Sequents running Dynix/ptx, etc.) and sh -c 'reset' (if <ENTER> doesn't seem to be working, use Ctrl-J) for platforms running Berkley unix (DEC, Sequents running Dynix 3, etc.). On some systems, both commands work. You can also try sh -c 'tput init' on most unix systems. These commands will be done 'blind', that is, you may not be able to see anything on the screen. Next type PTERM ECHO ON at TCL. If none of these things work, you really are hung; on to #2.
  3. At the TCL (pronounced Tee See Ell, not tickle) prompt in uv type PORT-STATUS (narrow the search by typing PORT-STATUS USER logname or PORT-STATUS PORT ##, which is the UV port number, not the physical unix port, ie: PORT-STATUS PORT 32) to verify that the hung terminal has an associated UV (PICK) session. Unix-only sessions won't appear in this list. If the uniVerse session is shown with Unknown for the port and Unavailable for the last command processed then the unix session has gone away and #1 should clear it. If that doesn't clear it from PORT-STATUS then the user probably has already turned the power off and on to attempt to clear it himself. Slap someone's hands, please. The PID that comes back may not be the actual PID of the universe shell. You may need to perform a ps -ef (ps -aox or -aux on DEC and some others) and grep for the PID, ie: ps -ef | grep 23293, using the example for port 32 below (NOTE: the spaces before and after the pipe or vertical bar [|] are not necessary for the command to work). The PID you need is the PID attached to the line that shows /u1/uv/bin/uv at the far right. The PID is not to be confused with the PPID (parent process id) which is on the right of the PID.
  4. Type LIST-READU EVERY (narrow the search to the PORT ## as used above with LIST-READU USER 32 EVERY, otherwise a very long list is possible) to see if this process has any uniVerse files/items locked. Using this command repetitively is going to be necessary to verify that the terminal really is hung in uniVerse and is not just in a loop that appears hung. You will usually see the terminal in the first section (active group locks) but not in the second (active readu locks) with zeros in the G-Address and Readu columns. From PORT-STATUS you can see this port is unknown and unavailable, yet in the LIST-READU EVERY screen, it seems to be holding a valid readu lock. Notice, however that the login id is different for the two reports. The cause of this is the loss of a networked connection whose uniVerse session still owns a printer memory segment. The next user coming in is assigned the unused pty which is then assigned the uniVerse port. This user then hangs later in the session as it approaches the same place the other was when disconnected. If there is no file lock then you can go straight to #4 and use LO PID using the PID found in #2 above. This command is performed at TCL in the UV account. Don't forget step #1, too.
  5. First see if the users previously and currently assigned to port 32 (ammon & becky) are having difficulties. If either of them say no, then ammon has logged back in and is attached to a different port on the list (not shown in our cross-section) and becky hasn't gotten busy enough to step into the trap left by ammon. Have becky log off and back in. If she can't, type MASTER OFF 32 (first choice, given our pseudo situation) at TCL. 32 is the port number of the terminal you are trying to free. If this doesn't work, try LOGOUT 23293 (you can also type LO 23293) also at TCL. This is the process id (Pid) for the terminal. The port number is found in the PORT-STATUS list in the Who column and in LIST-READU EVERY in the Userno column. The Pid number is found in the PORT-STATUS (first column) & LIST-READU EVERY (Pid column in active readu locks section) lists.
  6. Go to the UV sysadm menu and remove unused printer memory segments. At TCL in the uniVerse account, type LOGIN (which contains the line MOTIF SYSADM.MENU) which will take you to the UV sysadm menu. Once there, type ONLY M (you won't need to press Enter), then R, then Y, then ENTER or C. If you read the options as you do them, you will see that you are removing unused printer memory segments. This is a major cause of not being able to log back in, OR the message that the uniVerse user limit has been exceeded after hung terminals have been freed.

 

If none of the above steps work after trying several times, DON'T try anything else without consulting an Operating Systems systems analyst. As you work through these problems with them, you will become more familiar with the idiosyncrasies of different hardware platforms and will become more independent.

 

Example LIST-READU EVERY screen:

Active Group locks:

Device  Inode. Netnode Userno Lmode   G-Address  Readus

   162   2278        0     35  8 IN      14400      1

   162   2268        0     33  8 IN      13800      1

   162   2178        0     34 11 IN     AAE000      1

   162   2282        0     30 16 IN       DA00      1

    33    550        0     32 16 IN      6A400      1

   162   2405        0     29 23 IN      18A00      1

 

Active Record Locks:

Device  Inode   Netnode Userno Lmode  Pid  Login Id  Item-ID

   162   2268        0     33  8 RU  24550 clctr-25  46021

   162   2178        0     34 11 RU   7362 clctr-214 88677

   162   2282        0     30 16 RU  23233 clctr-27  163540

    33    550        0     32 16 RU  25431 becky     19235

   162   2405        0     29 23 RU  23624 clctr-157 124804

 

Example PORT-STATUS screen:

There are currently 8 uniVerse sessions; 8 interactive, 0 phantom

 

Pid    User name  Who Port name    Last command processed

23624  clctr-157  29  /dev/pts/15  RUN BLIB CF-UPDATE [STRING.INPUT @ 0x980]

23233  clctr-27   30  /dev/pts/16  RUN BLIB CF-UPDATE [STRING.INPUT @ 0x980]

23293  ammon      32  Unknown      Unavailable

24550  clctr-25   33  /dev/pts/19  RUN BLIB CF-UPDATE [STRING.INPUT @ 0x980]

 7362  clctr-214  34  /dev/pts/22  RUN BLIB POST [CMD3SUB @ 0x252]

 2366  misadm     36  /dev/pts/24  MENU-DRIVER [MENU.DRIVER @ 0x23B4]

 

No comments: