Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
9
rated 0 times [  9] [ 0]  / answers: 1 / hits: 20053  / 3 Years ago, thu, may 6, 2021, 12:31:05

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"
fi
fi

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

export SCALA_HOME=/usr/share/scala
export PATH=$PATH:$SCALA_HOME/bin
source ~/.profile

More From » bash

 Answers
5

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.


[#26584] Friday, May 7, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
exceeeelh

Total Points: 21
Total Questions: 109
Total Answers: 120

Location: Marshall Islands
Member since Wed, Jan 5, 2022
2 Years ago
exceeeelh questions
Sun, Nov 20, 22, 17:08, 1 Year ago
Sat, Jan 1, 22, 08:04, 2 Years ago
Wed, May 12, 21, 05:11, 3 Years ago
;