Unable to Open XEN VM Console – Virt-viewer error: cannot open display [Solved]

Updated on September 1, 2017

virt-viewer is a minimal tool for displaying the graphical console of a virtual machine. You can install virt-viewer using yum installer as shown below:

# yum install virt-viewer
 Setting up Install Process
 Resolving Dependencies
 --> Running transaction check
 ---> Package virt-viewer.x86_64 0:0.0.2-3.el5 set to be updated
::::::::::
 Installed:
 virt-viewer.x86_64 0:0.0.2-3.el5
Complete!

export remote display

Once installed you can take the VM’s console using the below command:

$virt-viewer <DomainName>

But then, did you get the below error?

(virt-viewer:15084): Gtk-WARNING **: cannot open display:

Then, here is the quick solution:

On Remote machine (may be a VM)

Set the Display variable as shown below in the VM (the VM you wish to take the console):

$ export DISPLAY="LOCAL_DESKTOP_IP:0.0"

Note: IP is the local workstation’s IP where you want the GUI application to be displayed.

On your Local desktop

On Linux: Execute xhost+ on  Local machine.

$xhost +
access control disabled, clients can connect from any host
xhost:  must be on local machine to enable or disable access control.

On Windows: Run the Xmanager in passive mode

On Remote machine

Now when you run the command virt-viewer <DomainName> on the remote host (may be a VM), you would see the display on your local desktop.

Was this article helpful?

Related Articles

Leave a Comment