home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 5.5 Querying Your Terminal Type: qterm Chapter 5
Setting Up Your Terminal
Next: 5.7 What termcap and terminfo Do and Don't Control
 

5.6 Checklist: Terminal Hangs When I Log In

If your terminal seems to "hang" (freeze, lock up) when you log in, here are some things to try:

  • Have an experienced user look at your shell's setup files ( 2.2 ) . There could be some obvious mistakes that you didn't catch.

  • Log in to another account and use the su stucklogin ( 22.22 ) command (if the stuck account uses Bourne-type shells) or the su -f stucklogin command (if the stuck account uses csh or tcsh ). Change ( cd ) to the home directory. Rename the account's setup files so the shell won't see them as you log in.

    If you can log in after that, you know that the problem is with the account's setup files.

  • Set shell debugging ( 8.17 ) . From another account or as the superuser, start an editor and put the following line at the top of an sh -like setup file (like .profile ). It'll tell you whether the .profile is being read at all and where it hangs:

    set -xv

    You'll see each line read from the .profile and the commands executed on the screen. If you don't see anything, then the shell probably didn't read the .profile . C shell users should put this command at the top of .cshrc instead:

    set echo verbose

    Note that on many UNIX systems, the shell won't read its startup files if the files aren't owned by you. You might use ls -l ( 22.2 ) to check.

  • Look at the entry in the /etc/passwd file ( 36.3 ) for this user. Be sure it has the correct number of fields (separated by : ). Also, see if there's another user with the same login name. (If your system has the commands vipw (8) and pwck (8), your system administrator should be using them to edit and check the passwd file. They avoid many of these problems.)

  • Does your account use any directories remotely mounted (by NFS) ( 1.33 ) ? If the remote host or network is down, and any command in your startup files (especially set path ) tries to access those directories, the shell may hang there.

    To fix that problem, su to the account as explained above and take the command or directory name out of your startup file. Or, if this problem happens a lot, the system administrator can mount an NFS filesystem "soft" (instead of the default, "hard") and limit the number of retrys.

  • What looks like a "hang" might also be that you just aren't getting any output to the terminal, for some very weird reason. Then the set -xv wouldn't help you. In that case, try adding this line to the start of the .profile :

    exec > /tmp/sh.out.$$ 2>&1

    If the Bourne shell starts reading the .profile , it'll make a file in /tmp ( 21.3 ) called sh.out. nnn with output from the commands and the shell's set -xv .

    There's no command like that for the C shell.

- JP


Previous: 5.5 Querying Your Terminal Type: qterm UNIX Power Tools Next: 5.7 What termcap and terminfo Do and Don't Control
5.5 Querying Your Terminal Type: qterm Book Index 5.7 What termcap and terminfo Do and Don't Control

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System