xhost + is not working with Oracle installation

42,715

Solution 1

If I understand correctly you are using a windows PC with a running X server. You are trying to use putty to connect to an ubuntu server and run commands on that host that need to access your local X server.

After connecting to the server echo $DISPLAY should give a meaningful value and something like xdpyinfo should work. (That should be the magic putty/ssh is doing.)

Your command is able to connect to your local display server, because $DISPLAY points to the correct display and ~/.Xauthority provides the correct credentials to access that display.

For another user to access that display, that user needs both pieces of information.

The easiest way is to simply ssh directly to the oracle user.

One other way to do so would be:

chmod a+r ~/.Xauthority
XAUTHORITY=$HOME/.Xauthority sudo -u oracle runInstaller

The first command allows the oracle user to read your credentials. The second command explicitly points to that file and runs the installer as the oracle user.

Solution 2

There are many ways to do this. I did something below convenient to me and always works fine.

  1. On your remote server, make sure to install xorg-x11-xauth, xorg-x11-font-utils, xorg-x11-fonts.
  2. Run the Xming Server on you local desktop
  3. On putty, before ssh to the server, enable the X11 forwarding and set the display location to localhost:0.0
  4. On the server, .Xauthority file is generated and notice that the DISPLAY variable is already set.

$ xauth list

$ xauth add

To test it, type xclock or xeyes

Note: To switch user, copy the .Xauthority file to the home directory of the respective user and also export the DISPLAY variable from that user.

Share:
42,715

Related videos on Youtube

iso_9001_
Author by

iso_9001_

An AI enthusiast and GM of idayapayzeka

Updated on September 18, 2022

Comments

  • iso_9001_
    iso_9001_ over 1 year

    I am trying to install Oracle on Ubuntu 14.04. I have followed instructions and now I am trying to start the installation. However, I am facing problems.

    If I run ./runInstaller command with oracle user, I am facing

    Starting Oracle Universal Installer...
    
    Checking Temp space: must be greater than 120 MB.   Actual 19088 MB    Passed
    Checking swap space: must be greater than 150 MB.   Actual 8191 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 <<<<
    

    problem. If I enter yes, I face NoClassDefFoundError.

    If I switch to root user and enter

    export DISPLAY=:0.0
    xhost +
    

    I am facing xhost: unable to open display ":0.0" error. xdpyinfo command also returns xdpyinfo: unable to open display ":0.0". error message.

    My /etc/hosts file contains these lines:

    127.0.0.1       localhost
    10.0.1.23      bnet-test
    

    I have tried various advices but none worked for me so far. I am connecting to a remote Linux Ubuntu machine through VPN and am using Putty as SSH client with X11-Forwarding enabled.

    What might be my problem?

    • michas
      michas over 8 years
      Do you try to install locally or remotely via ssh or something? how exactly do you run the installer as oracle user? (Are you aware of sudo -u oracle?)
    • iso_9001_
      iso_9001_ over 8 years
      @michas I connect to vpn first. Then I start putty and connect to server with x11 enabled. Then I switch to user oracle and cd to database directory and run ./runInstaller
  • iso_9001_
    iso_9001_ over 8 years
    I am using a Windows machine and connecting to a remote Linux server with putty but there is no X server running on my Windows if there is such thing other than X11 forwarding on putty. I will try your suggestions now. Thank you.
  • michas
    michas over 8 years
    If there is no X server running, any attempt to connect to the X server will fail. There is also no point in forwarding your X server, if there is no X server. - Maybe you should install an X server first.
  • iso_9001_
    iso_9001_ over 8 years
    Well I googled it and saw Xming X Server and I will install this. Will installing Xming suffice?
  • iso_9001_
    iso_9001_ over 8 years
    OK, I managed to use Xming with Putty. Now xhost + command gives me access control disabled, clients can connect from any host warning.
  • michas
    michas over 8 years
    Do not use xhost. This would allow anyone from anywhere to access your display without any authorization. Use x-forwarding instead as described above.
  • iso_9001_
    iso_9001_ over 8 years
    This is magic. You can't imagine how happy I am. Thank you very much :)