Ubuntu – Running bash does “segmentation fault core dumped”

bashsegmentation fault

I rebooted recently, and now terminal fails to work. If I click the terminal shortcut or use Guake or ctrl-alt-T, the terminal opens briefly with no prompt, then immediately closes again. I installed xterm as well and the same thing happens.

If I use ctrl-alt-F1 to get to a command line session and type gnome-terminal I get the error message:

Failed to parse arguments: Cannot open display

How can I diagnose and fix this?

EDIT TO ADD .bashrc

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile"

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
alias zf=/home/julio/ZendFramework-1.12.3/bin/zf.sh

EDIT 2– adding .profile:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then

export SCALA_HOME=/usr/share/scala
source ~/.profile

Best Answer

This has nothing to do with gnome-terminal, when you hit Ctrl Alt F1, logged in from the virtual console and tried running bash, you got a segmentation fault core dumped which means that bash itself crashes.

Anyway, what's happening is that your bash is entering an infinite loop. When bash first starts, it reads ~/.bashrc (actually, this is a simplification, see here for more details). In your case (and in most if not all Ubuntu versions), the default .bashrc, for reasons that have never been clear to me, sources (reads) ~/.profile as well. Now, your ~/.profile includes this line:

source ~/.profile

The result of that is that bash reads ~/.bashrc => reads ~/.profile => reads ~/.profile => reads ~/.profile => reads ~/.profile etc. This is called an endless loop. Eventually, it freaks out and crashes.

Removing the source ~/.profile line from your ~/.profile should set everything back to normal.

Related Question