2

I have centos 6 minimal (headless) as a Host and installed ubuntu 14.04 Desktop as a guest and using KVM. There is a web application deployed inside Guest, and it opens and closes one GTK application (javafx) in background. I am invoking this web app from my host thru ssh as "curl http://guest/myapp/start" I observed the logs in Guest OS and see the error message "Gtk-WARNING **: cannot open display"

I didn't understand the reason for this error. 1) This GTK app is not opening any window physically in ssh console on host and moreover it's background. 2) Guest is desktop version.

Can any one help me how to resolve this. I can't enable XWindows due to security requirements by the client.

Thanks, Sridhar

1
  • What display do you think this app should use when you start it this way? Commented Apr 6, 2015 at 10:59

5 Answers 5

5

This warning appears when we try to execute some command on remote machine using ssh, which needs to open window. Consider for example if you want to pull code from a remote repository using git clone. Here you need to enter password. But since you are using ssh on terminal it is unable to open a new window. Hence it throws this warning. You can use vnc as a workaround as it is able to open any new window

Sign up to request clarification or add additional context in comments.

1 Comment

So, then, it's impossible to run things I need to do on a headless Linux box? And this is an actual operating system that is supposed to be usable for servers???
1

At the user's terminal (AND as that user NOT sudo or root), add localhost to the xhost permission. Type

$ xhost +localhost

And this allows the system-config-printer to run.

1 Comment

Was trying to run sudo gparted over an SSH connection and this worked for me after also running export XAUTHORITY=$HOME/.Xauthority (stackoverflow.com/a/56661420/3339274)
0

"Gtk: cannot open display" Which means it can not find display attached with device so if you have connected display you can export its address. generally it will be 0.0 So your command will be like "export DISPLAY=:0.0" if doesn't work try changing 0.0 to 0 then it can find the display. may be this link will be helpful https://askubuntu.com/questions/47642/how-to-start-a-gui-software-on-a-remote-linux-pc-via-ssh

Comments

0

This also happens if you fiddle with wayland and revert back to X11 while forgetting to comment out these environment variables in e.g. /etc/profile:

export QT_QPA_PLATFORM=wayland
export GDK_BACKEND=wayland
export MOZ_ENABLE_WAYLAND=1

In my case, I could run xterm commands and some other X11 apps but not firefox nor gtk-launch xterm nor remmina (another gtk-based app). Unsetting these variables put me back in x11 modey of display. The QT_QPA_PLATFORM=xcb might also be work.

Comments

-1

You can't run a GTK+ application without a display.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.