Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I log in to a specific server I see the following:

before ctrl+c

Note that I get get Last login: ... information but no prompt. I hit Ctrl+C and only then do I get my prompt, thus proving that my username and password are correct, as per the below screen shot.

after ctrl+c

I've been having this problem since this morning on a web server we have in the office. It's no coincidence that the disks in the machine have been replaced today but all that's happened is the old disk has been cloned and all the other users of the system aren't having this problem.

Does anyone know what might be going on?

share|improve this question
4  
If you can CTRL-C out of it, you're definitely running into some login script that is hanging. I would check /etc/profile.d /etc/profile and any .bash_* files in your home directory. –  Joel Davis Apr 23 '13 at 14:34
1  
I ain't executing that, safe or not. bash is my shell. –  Matt Apr 23 '13 at 14:45
2  
the command anthon gave you just returns your username's shell, without doing any harm to your system. you can do it as a normal user, if you are scared. –  fromnaboo Apr 23 '13 at 15:58
1  
you can use getent passwd username instead of the fgrep command –  glenn jackman Apr 23 '13 at 19:51
2  
Although the specific problem isn't reproduced, it seems to me that the basic question and answers given could easily be useful to a future visitor. The answers give an overview of what's probably going on, and basic diagnostic steps which will apply to anyone regardless of the actual mystery, so I've rolled back the edit declaring the problem non-reproducable. Someone else probably will have a similar problem, and the answers here may help. –  mattdm Apr 24 '13 at 18:05

3 Answers 3

up vote 5 down vote accepted

Something is taking a long time in one of your shell initialization files. Add set -x at the top of ~/.bash_profile or ~/.profile (or ~/.bash_login) if your login shell is bash, or ~/.zprofile and ~/.zlogin and ~/.zshrc if it's zsh. This way the shell will print each command before it executes it. Run set +x afterwards to turn the tracing off.

The command may be one that's invoked from the system-wide initialization script /etc/profile. If you can't change that file but need to see what it does, run a login shell with tracing on, e.g. bash --login -x.

Another approach is to log in a second time and watch what's going on with ps and other tools. On Linux ps x shows all of your processes (a plain ps only shows running on the current terminal which does no good here); ps -t pts/42 restricts to processes running on the terminal /dev/pts/42 (you'll probably need to run ps x first to determine the terminal of the second session).

share|improve this answer
    
I'd recommend try the ps approach first, before combing through shell initialization files and having to guess which process might be hanging. –  depquid Apr 24 '13 at 20:32
    
ps x to the rescue! I had an alias in ~/.bashrc that was failing. –  Matt Apr 30 '13 at 15:48

Instead killing process that is hanging your shell, try to stop it with Crtl+Z and then use jobs command to see what it was.

share|improve this answer
    
Gave that a go but Ctrl+Z has no discernible effect –  Matt Apr 23 '13 at 15:28

There is most likely a command running in either your $HOME/.bashrc, $HOME/.profile that is either not being backgrounded correctly or is waiting for input from the user. I'd take a look at those 2 files to start.

If nothing turns up there, then I'd take a look at the system equivalents of those files, /etc/bashrc, /etc/profile, and the files in the directory /etc/profile.d/*. Perhaps someone, a sysadmin, added something to those system level files that's now attempting to run when you login.

share|improve this answer
    
Do you know how the process of cloning and replacing the hard disk would have anything to do with that? –  Matt Apr 24 '13 at 8:03
    
No. I would need to see your .bashrc and .profile files to get a better sense of what's going on. Either the files I've mentioned or the ones from @Gilles answer are the way to go in terms of debugging the issue further. –  slm Apr 24 '13 at 8:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.