Thursday, March 15, 2012

xhost and DISPLAY - again!

It's that time of year again, when people try to install their databases on a Linux or Unix host.  And run into issues with xhost and DISPLAY.

The typical complaint is "I issued the DISPLAY command and it tells me I don't have permission." or "I tried to runInstaller"

This is often an indication of doing things in the wrong order.

The correct sequence is:
  1. Log on to the computer that *owns* an XWindows screen.  This could be a Linux machine with gnome/KDE/twm, or perhaps a Windows machine with cygwin/X, Xming, or perhaps Hummingbird (now OpenText) eXceed ... these are known as XServers.
  2. Tell that Xserver (screen) to accept remote requests, by issuing "xhost +" (note that the + disables security) 
  3. Log on to the computer / user that is to use the XWindows - the one that contains the runInstaller 
  4. Tell that to display on the computer that is to be used for display using export DISPLAY=(host):display.screen
  5. Run the program that needs a display
Many people, especially students, log in to root on the computer and then su to oracle to do the installs. While this is fundamentally a stupid thing to do, because using root unnecessarily increases potential security risks and is it NOT good practice and will it NOT be allowed in any self-respecting business, the following would be the sequence
  1. Log on to XWindows as root.  Do NOT su to root!  Do NOT pass GO.  Do NOT collect $200.
  2. Open a terminal
  3. Enter: xhost +
  4. Find out which DISPLAY is used by entering: set | grep -i DISPLAY
  5. Enter: su - oracle
  6. Enter: export DISPLAY=:0.0 # of course, base this on step 4
  7. Enter: runInstaller # (or whatever is required, such as xeyes) 
The most common mistake is running xhost after su. This will not work. The xhost must be issued by the first user - the one that owns the screen.


I am simply amazed that IT instructors don't discuss this basic thing, but I suspect it is caused by a lack of understanding - or bad assumptions.





No comments: