I am getting a segmentation fault from bash when I try to SSH to a remote server (running RHEL 4.4.5-6). After providing my credentials, the SSH client spits back the “Last login: …” information, and then just hangs.
Out of curiosity, I pressed Ctrl-C and was able to get to a bash prompt. However, it’s not the “usual” prompt that I see (it usually has my username, the server hostname, etc).
login as: xxxxxxx
xxxxx@xxxx's password:
Last login: Fri Mar 30 14:33:41 2012 from xxx.xx.xx.xxx
-bash-4.1$ echo $0
-bash
-bash-4.1$
I tried to run /bin/bash from GDB. After a medium-sized wait time, I finally got a SIGSEGV error:
(gdb) run
Starting program: /bin/bash
Program received signal SIGSEGV, Segmentation fault.
0x08067ab5 in yyparse ()
(gdb)
The last (significant) changes that I’ve made to the system was installing GNU screen (using yum install screen). Screen seemed to hang as well when I tried to start it (I’m assuming because it tried running bash, and got the same segfault).
Edit:
I tried running rpm -V:
-bash-4.1$ rpm -V bash
-bash-4.1$
Here are my .bash* files:
.bashrc:
# .bashrc
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
.bash_profile:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
.bash_logout:
# ~/.bash_logout
.bash_history is quite long. I erased it, tried logging in again, and got the same results.
You’re recursively sourcing your .bashrc from inside itself, which in a short test here does indeed lead to a segmentation fault. Removing that part from your .bashrc should hopefully fix the problem.