7 Replies Latest reply: Jan 16, 2013 8:54 AM by EdStevens RSS

    xhost  unable to open display

    4joey1
      Hallo!I am trying to install Oracle 11gR1 on Oracle Enterprise Linux 5.5.I have been trying to set DISPLAY parameters to launch the OUI but I get the error below.

      I am doing the installation directly on the db server (and not accessing db server from any client machine) and the IP for db server is 10.0.0.1.

      [root@joey-oel ~]# xhost +
      access control disabled, clients can connect from any host
      [root@joey-oel ~]# export DISPLAY=10.0.0.1:0.0
      [root@joey-oel ~]# echo $DISPLAY
      10.0.0.1:0.0
      [root@joey-oel ~]# xclock
      Error: Can't open display: 10.0.0.1:0.0
      [root@joey-oel ~]# su - oracle
      [oracle@joey-oel ~]$ echo $DISPLAY
      10.0.0.1:0.0
      [oracle@joey-oel ~]$ xhost +
      xhost: unable to open display "10.0.0.1:0.0"
      [oracle@joey-oel ~]$ xclock
      Error: Can't open display: 10.0.0.1:0.0
      [oracle@joey-oel ~]$ cd /install/database
      [oracle@joey-oel database]$ ./runInstaller
      Starting Oracle Universal Installer...

      Checking Temp space: must be greater than 80 MB. Actual 59727 MB Passed
      Checking swap space: must be greater than 150 MB. Actual 7012 MB Passed
      Checking monitor: must be configured to display at least 256 colors
      >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed <<<<

      Some requirement checks failed. You must fulfill these requirements before

      continuing with the installation,at which time they will be rechecked.

      Continue? (y/n) [n]


      Please assist in solving this issue.

      Thanks.
        • 1. Re: xhost  unable to open display
          sb92075
          4joey1 wrote:
          Hallo!I am trying to install Oracle 11gR1 on Oracle Enterprise Linux 5.5.I have been trying to set DISPLAY parameters to launch the OUI but I get the error below.
          If the OS environment is 100% correct, then you need to do NOTHING after login concerning
          DISPLAY variable.

          Two alternatives exist.
          1) logon to DB Server directly via its "console"
          2) Connect to DB Server from remote system using ssh -X or putty with X11 Forwarding enabled.

          After login to DB Server & before you do anything else issue command below

          env | sort

          COPY command & results then PASTE all back here
          • 2. Re: xhost  unable to open display
            Talip Hakan Ozturk
            Can you try this one

            # xhost +SI:localuser:oracle


            Talip Hakan Ozturk
            http://taliphakanozturken.wordpress.com/
            • 3. Re: xhost  unable to open display
              Hans Forbrich
              4joey1 wrote:
              [root@joey-oel ~]# xhost +
              access control disabled, clients can connect from any host
              [root@joey-oel ~]# export DISPLAY=10.0.0.1:0.0
              [root@joey-oel ~]# echo $DISPLAY
              10.0.0.1:0.0
              [root@joey-oel ~]# xclock
              Error: Can't open display: 10.0.0.1:0.0
              Is this a fresh terminal, or have you done any su to get to the root prompt. If any su, then this is no good. (Why are you at the root prompt anyway - baaaaad idea and baaaaad habit to get into if you are an Oracle DBA.)

              Part 1 - on the XServer:

              The XServer is the software that runs the screen. The XServer is NOT the software running the user program, such as dbca or runInstaller - that runInstaller is the XClient.

              If you are using a Linux machine, and have gnome (KDE, twm, etc.), the userid you log in from the Linux splash screen is the one that owns the XServer.

              The XServer needs permission to display things from the XClient. To give that permission, open a terminal from scratch - do not 'su' - and run 'xhost +' or preferrably 'xhost + {list of hosts with XClients}'

              The XServer runs on a host, and operates on a DISPLAY and allows for multiple SCREENS.

              To determine the DISPLAY and SCREEN, enter the command 'set | grep DISPLAY' to get something like "DISPLAY=:0.0"
              To determine the host, enter 'hostname' to get something like 'bi11g.e2eo.ca'

              The XClient will need this information to proceed.

              So, at the top level, without having su'd, you enter 'xhost +' or 'xhost + bi11g.e2eo.ca'. (Stick with xhost +' for now.)

              Part 2 - on the proposed XClient

              Now you are ready to run the Oracle installer. You go to the machine that should run the installer by ssh, or telnet, or (if it's the local machine) by 'su - oracle'.

              You want to tell the installer to send the display to the machine that has the XServer. You do that using "export DISPLAY={host}:{display info from the "set | grep DISPLAY" above}

              IF IT ON THE LOCAL MACHINE AND YOU USED 'xhost +', THEN OMIT THE {host}!!! "export DISPLAY=:0.0"

              and your session becomes:
              [root@joey-oel ~]# xhost +
              access control disabled, clients can connect from any host
              *do NOT set or mess with DISPLAY - this is the server*
              [root@joey-oel ~]# xclock
              +and it displays+
              [root@joey-oel ~]# su - oracle
              [oracle@joey-oel ~]$ export DISPLAY=:0.0
              *do NOT NOT NOT do another xhost here*
              [oracle@joey-oel ~]$ xclock
              +and it displays+
              [oracle@joey-oel ~]$ cd /install/database
              [oracle@joey-oel database]$ ./runInstaller
              Starting Oracle Universal Installer...
              • 4. Re: xhost  unable to open display
                806917
                Talip and Hans - Where were you guys when I was struggling w this issue in late 2010? : ) Great comments and right on target.

                4joey1 - I wrote up my experience, which I will paste below. This solution works well for me, and I no longer see $DISPLAY errors any longer.

                ------------------------------------------------------------------------------------------------------------------------------------------

                Configuration
                OS: Red Hat Enterprise Linux
                Product: Oracle Universal Installer (oui) GUI

                Problem
                Many Oracle products, including the Oracle Database and WebLogic Server, use Oracle Universal Installer (oui) to install the products.

                When starting the GUI oui within a vnc session or directly on the console from a terminal window, the following error appears:
                $ ./runInstaller
                Starting Oracle Universal Installer...
                Checking Temp space: must be greater than 80 MB. Actual 35667 MB Passed
                Checking swap space: must be greater than 150 MB. Actual 5951 MB Passed
                Checking monitor: must be configured to display at least 256 colors
                Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed <<<<
                Some requirement checks failed. You must fulfill these requirements before
                continuing with the installation,
                Continue? (y/n) [n]
                Ignoring required pre-requisite failures. Continuing...
                Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-06-01_02-45-14PM. Please wait ...
                DISPLAY not set. Please set the DISPLAY and try again.

                Issue
                The error message focuses on $DISPLAY as the root cause. However, the problem is not $DISPLAY at all. The real issue is xhost.

                Root cause
                xhost authorizes OS users to connect to the X server. The OS user running the GUI oui has not been authorized by xhost, so oui fails.

                To confirm that xhost is indeed the problem:
                1) Open a terminal and sudo to root. Run xclock. xclock should display.
                2) Open a terminal as the user running oui. Run xclock. xclock will fail to start.

                Complications running the xhost command:
                1) For OS users not previously authorized to run xhost, root has to run the xhost command.
                2) Upon server reboot, xhost authorizations that root previously granted are lost.
                3) Running the xhost command as root at system startup has no effect, because system startup occurs before the X server is started.

                Solution
                The OS users running the GUI oui should run the xhost command when the terminal session is started. To accomplish this:

                root user
                1) Copy set_xhost_current_user.sh into /usr/bin. Set permissions on the shell script to 755.
                2) In the sudoers file:
                a) Add /usr/bin/set_xhost_current_user.sh as a command alias.
                b) Add the OS users who need to run oui to a group.
                c) Assign the command alias to the group.

                OS user running oui
                1) Make sure $PATH contains /usr/bin.
                2) In .bash_profile, call /usr/bin/set_xhost_current_user.sh.
                3) Start a new terminal session and run GUI oui. oui should now start successfully.

                set_xhost_current_user.sh
                #!/bin/bash
                # If user has logged in via gnome (e.g. vnc session), then
                # run the xhost command. First validate the input parameter to
                # prevent shell script command injection.

                if [ "$COLORTERM" == "gnome-terminal" ] ; then

                     # Check the password file and compare to the parameter.
                     # If a match occurs, the parameter is the name of a valid user.
                     VALID_USER=`cat /etc/passwd | grep "/home" | cut -d: -f1 | grep $1`
                     if [ -z $VALID_USER ]; then
                     echo Invalid user name passed. xhost command not executed.
                     else     
                          xhost + si:localuser:$1 > /dev/null
                     fi

                fi

                sudoers snippet
                User_Alias     DBA_USER_ALIAS2 = oraot1,oraot2

                Cmnd_Alias     SET_XHOST = /usr/bin/set_xhost_current_user.sh

                DBA_USER_ALIAS2          t00539292 = NOPASSWD: SET_XHOST

                bash profile snippet
                sudo set_xhost_current_user.sh $USER
                • 5. Re: xhost  unable to open display
                  Hans Forbrich
                  Scot Krause wrote:
                  Talip and Hans - Where were you guys when I was struggling w this issue in late 2010? : ) Great comments and right on target.
                  I've posted my response on the forums many times over the years. Your search apparently did not work.
                  • 6. Re: xhost  unable to open display
                    985229
                    The proble for me here i have posted the result after giving the env | sort cmd

                    env | sort
                    _=/bin/env
                    CVS_RSH=ssh
                    DISPLAY=:0.0
                    G_BROKEN_FILENAMES=1
                    HISTCONTROL=ignoredups
                    HISTSIZE=1000
                    HOME=/root
                    HOSTNAME=RedHatServer01
                    LANG=en_US.UTF-8
                    LESSOPEN=|/usr/bin/lesspipe.sh %s
                    LOGNAME=root
                    LS_COLORS=rs=0:
                    MAIL=/var/spool/mail/root
                    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
                    PWD=/root
                    SELINUX_LEVEL_REQUESTED=
                    SELINUX_ROLE_REQUESTED=
                    SELINUX_USE_CURRENT_RANGE=
                    SHELL=/bin/bash
                    SHLVL=1
                    SSH_CLIENT=192.168.2.236 58774 22
                    SSH_CONNECTION=192.168.2.236 58774 192.168.2.40 22
                    SSH_TTY=/dev/pts/1
                    TERM=xterm
                    USER=root
                    XMODIFIERS=@im=none
                    • 7. Re: xhost  unable to open display
                      EdStevens
                      982226 wrote:
                      The proble for me here i have posted the result after giving the env | sort cmd

                      env | sort
                      _=/bin/env
                      CVS_RSH=ssh
                      DISPLAY=:0.0
                      G_BROKEN_FILENAMES=1
                      HISTCONTROL=ignoredups
                      HISTSIZE=1000
                      HOME=/root
                      HOSTNAME=RedHatServer01
                      LANG=en_US.UTF-8
                      LESSOPEN=|/usr/bin/lesspipe.sh %s
                      LOGNAME=root
                      LS_COLORS=rs=0:
                      MAIL=/var/spool/mail/root
                      PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
                      PWD=/root
                      SELINUX_LEVEL_REQUESTED=
                      SELINUX_ROLE_REQUESTED=
                      SELINUX_USE_CURRENT_RANGE=
                      SHELL=/bin/bash
                      SHLVL=1
                      SSH_CLIENT=192.168.2.236 58774 22
                      SSH_CONNECTION=192.168.2.236 58774 192.168.2.40 22
                      SSH_TTY=/dev/pts/1
                      TERM=xterm
                      USER=root
                      XMODIFIERS=@im=none
                      ok, you just hijacked and resurrected a thread that is almost a year old. And given no explanation of your problem, which may or may not be the same as the problem being addressed in this thread when it was active last year.

                      Please start your own thread, describing your own problem and symptoms. Be sure to state your own operating system and vesions of Oracle.

                      And please read the forum FAQ. The link is in the upper right corner of this very page.

                      Moderator: please lock this thread.

                      Edited by: EdStevens on Jan 16, 2013 8:53 AM