Dear experts,
My colleague and I are using SSH Shell and Xming to link a remote server, to run afni. It always worked very well in the past. However, it now can not work anymore. When I type “afni” and run it, it shows.
Initializing: X11Error: Can’t open display:
++ AFNI is detached from terminal.
Definitely, my Xming is running normally here. So it is very strange to me. When I input, “afni -no_detach”, it shows,
xterm Xt error: Can’t open display:
xterm: DISPLAY is not set
Anyone can tell us how to set the DISPLAY, and how to fix this issue? And why it worked well in the past, but just suddenly shows this problem? Our computer is windows.
Thank you very much,
Juan
Try setting the DISPLAY environment variable to :0 and see whether it helps. Would you provide details about exactly ssh is being run, is the -X option applied?
Thank you both very much for your advice. I did try the command separately, also both at the same time (copy and paste, so I have not changed anything - is this fine?),
But none of them worked - the same error alarm: Initializing: X11Error: Can’t open display. ++ AFNI is detached from terminal.
Per Rick’s question, I am using SSH Secure Shell (https://www.ssh.com/ssh/). I am not sure what do you mean with “-X option applied”. I installed this Xming long long ago, and it always worked in the past. I also recently downloaded and installed the X11 in another laptop. I am not sure how to ensure the -X option applied". Could you give me an example on this?
I have this question, as after I used them, I still got the alarm, “DISPLAY is not set. Please set your DISPLAY environment variable!”. But I do not know how to set this path. Any idea for me?
Did you source the RC file for your shell after putting those in, so that the terminal updates itself with that new information? Or, you could just open a new terminal there and that should be sourced there+then.
To source that file in your present terminal window/shell:
First, you can tell what shell you are using by the output of:
echo $0
and then if that returns something with “bash”, do:
source ~/.bashrc
or if it returns something with tcsh, do:
source ~/.cshrc
You can tell if your DISPLAY variable is set in the terminal by typing:
Hi, Pt,
When I use the “echo $0”, it returns “-sh”, so not exactly a “bash” or “tcsh”.
I use the command, “source ~/.bashrc”, following with the “echo $DISPLAY”, it returns “:0.0”. So it is fine now, am I correct?
Thank you
btw, I tried the command “source ~/.cshrc”, it shows quite a few rows, “-sh: setenv: command not found”. which means that I only can use the command “source ~/.bashrc” for my server. Does it mean -sh" is close to “-bash”. Am I correct?
Yes, sh is close to bash. But to set that variable in sh, it should
be done in ~/.profile, rather than ~/.bashrc.
rick
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.