Thursday, 24 May 2018

xhost: unable to open display "" | Check if the DISPLAY variable is set | Oracle Linux

xhost:  unable to open display "" | Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set


Linux Unix OS Issues


This is the basic but quite troublesome issue which is normally faced at least once by every single DBA in their lifetime. Though the issue is not specifically related to DBA activities as it's a normal OS (LINUX/UNIX) level issue. That's why this post is here.

How it began?


So while practicing Oracle 12c Database installation on Oracle linux 7.5, I provided the access to Oracle User to open Installer (GUI) using

[root@practice ~]# xhost +SI:localuser:oracle
localuser:oracle being added to access control list
(This will give access to only Oracle User)

OR you can also run

[root@practice ~]# xhost +
access control disabled, clients can connect from any host
(This will give access to every user created on your system)


But when I tried running the installer, it failed with..

[oracle@practice database]$ ./runInstaller
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 17736 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 4095 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] n

User Selected: No

Exiting Oracle Universal Installer, log for this session can be found at /tmp/OraInstall2018-05-23_07-54-28PM/installActions2018-05-23_07-54-28PM.log

The Actual Problem


Now, as I said this is a very common issue normally faced by almost every IT individual who deals with UNIX/LINUX Systems. (I have also dealt with the same before and above mentioned XHOST commands helped me pass through the same. But Not this time !!)

I thought may be I need to provide the access again so I did the switch user (SU command) to ROOT and ran the above mentioned command again.

[oracle@practice database]$ su - root
Password:
Last login: Wed May 23 19:53:32 IST 2018 on pts/0

[root@practice ~]# xhost +SI:localuser:oracle
xhost:  unable to open display ""
[root@practice ~]# xhost +practice.ol75.com
xhost:  unable to open display ""
[root@practice ~]# xhost +
xhost:  unable to open display ""
[root@practice ~]# export DISPLAY=practice.ol75.com:0.0
[root@practice ~]# xhost +
xhost:  unable to open display "practice.ol75.com:0.0"

You can see I tried everything I could think of but it failed and failed again.

You can also check the complete Environment Variables for the User using the below mentioned command where you will find the entry for the DISPLAY,

[root@practice ~]# env | sort


Solution for both the Issues:


1) For xhost:  unable to open display "" Issue

Avoid using "su" to come to ROOT prompt. Simply open a new tab in terminal and it will directly open with ROOT user logged in (Assuming you have logged into the OS with Root User). Once new tab is opened, again run

[root@practice ~]# xhost +
access control disabled, clients can connect from any host

The command will be successful this time.

2) XHOST Access is provided, still you are unable to open the Installer with Oracle User for for Oracle Database Installation

Check for the value of DISPLAY variable for ROOT user using ECHO command,

[root@practice ~]# echo $DISPLAY
:0

Now define the same value for DISPLAY after switching to Oracle User and the Installer will open successfully this time.

[root@practice ~]# su - oracle
Last login: Wed May 23 20:04:23 IST 2018 on pts/1
[oracle@practice database]$ export DISPLAY=:0
[oracle@practice database]$ ./runInstaller
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 17736 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 4095 MB    Passed
Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-05-23_08-05-46PM. Please wait ...[oracle@practice database]$ You can find the log of this install session at:
 /u01/app/oraInventory/logs/installActions2018-05-23_08-05-46PM.log

I hope this helps !!

2 comments: