navigation
 

NX DISPLAY

last modified 23-01-2009 10:30

How to Set the DISPLAY Variable for the NX Client

When you access the ESRF computers using NX, you arrive on the computer "tet"
(or "bet", which is a backup). These two computers are only intended as
gateways for NX users to get into the ESRF and not for heavy work. Thus, if you
want to do some serious work, you need to log into a different computer (e.g.
one of the "coral" computers).

This you can do with "ssh", and then you can work just fine as
long as you do not use any application that uses graphics. But if you want to
start e.g. "firefox" or an analysis program that does graphical output, or even
if you only want to use the "xterm" terminal emulator on the new computer, then
you need to set the DISPLAY variable on this computer.

If you work on a real computer (lets say you have your laptop at the ESRF and
connect directly from your laptop to a "coral" computer), then the DISPLAY
variable is simply the name of your computer followed by the string ":0.0".
E.g. if the computer is called "mylapt", the DISPLAY variable is "mylapt:0.0".
To set it, you use the command

   export DISPLAY=mylapt:0.0        (for the "bash" shell)
   setenv DISPLAY mylapt:0.0        (for the "tcsh" shell)

after logging into the new computer. If you then do "xterm" to start an
X-terminal, the computer knows to send the graphics output to the display "0.0"
of the computer "mylapt".

But with NX, you do not use a real computer but a virtual one, which adds a bit
of complication. In fact, your display number is no longer "0.0", but a
different number, which moreover can change every time you start NX for a new
session.

Furthermore, you need to enable X-connections to the NX computer ("tet" or
"bet"), otherwise this computer will refuse to display the graphics (with an
error message "connection refused by server").

Here is what you need to do: 

1) Use the -X option: ssh -X nice firefox

or

1) after connecting successfully with NX, you arrive at "tet" (if you use
   "bet", you have to replace "tet" by "bet" in the following). Open a terminal
   window on "tet".

2) in this terminal window, type the command

      xhost + xxx   (where xxx is the computer you will connect to)

   This enables the X-connections to the computer. You should get the answer

      access control disabled, clients can connect from any host

3) type the command

      echo $DISPLAY

   You get an answer in the form

      unix:1122.0

   where the number after the "unix:" is variable (it will not always be 1122).

4) now log into the computer you want to work on (e.g. "coral"). Once you are
   logged in, you set the DISPLAY variable - depending on your setup, you will
   either be asked for it during login with the question

     Your DISPLAY variable is not set. Please enter the name of the terminal
     or workstation your are sitting in front of (ex: sbrick1):

   or you need to set it yourself after the login with the "export DISPLAY" or
   "setenv DISPLAY" command.

   In both cases, the value to give is a string composed of two parts:
   - the name of the computer "tet" (not "unix" as shown by the "echo $DISPLAY"
     command),
   - the part after the computer name as obtained from the "echo $DISPLAY"
     program (in the above example, the string ":1122.0").

   Thus if you are asked for the value by your login process, you answer in
   this example

      tet:1122.0

   or if you need to do it yourself after you are logged in, you give the
   command

      export DISPLAY=tet:1122.0        (for the "bash" shell)
      setenv DISPLAY tet:1122.0        (for the "tcsh" shell)

5) Now you should be able to run programs that display graphical output. Test
   it with an X-terminal by typing

      xterm

   This should open an X-terminal on your display.

European Synchrotron Radiation Facility