LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Gtk-WARNING **: cannot open display (http://www.linuxquestions.org/questions/slackware-14/gtk-warning-%2A%2A-cannot-open-display-182090/)

gonzalo76 05-16-2004 01:35 PM

Gtk-WARNING **: cannot open display
 
This time, when I tried to open gedit logged in as root (su)

Code:

bash-2.05b# gedit
appears this error message:
Quote:

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

(gedit:10762): Gtk-WARNING **: cannot open display:
Does anybody know why?

slackwarefan 05-16-2004 02:48 PM

Because you su'ed to root. When you tried to run the program as root it tried to open up another X server while you already had one on that display. Why do you have to run it as root?

-Hope this helps.:D

IBall 05-16-2004 08:54 PM

As root, try:
/usr/X11R6/bin/xhost +

This should enable you to connect to the X-display as root

--Ian

gonzalo76 05-17-2004 11:26 AM

Quote:

Originally posted by IBall
As root, try:
/usr/X11R6/bin/xhost +

This should enable you to connect to the X-display as root

--Ian

Thank you, it worked !!!

Kropotkin 07-25-2005 03:05 PM

How to make it permanent?
 
Quote:

Originally posted by IBall
[B]As root, try:
/usr/X11R6/bin/xhost +
Thanks for posting this information. I found while searching on this very problem.

One question: it only works for the current session. I do I make it stick across logins?

TIA

abhax 11-18-2009 07:05 AM

Just dun use it when you are root...

use shell> sudo gedit <filename>

witek 11-18-2009 07:38 AM

Quote:

Originally Posted by Kropotkin (Post 1764737)
One question: it only works for the current session. I do I make it stick across logins?
TIA

create .bashrc or .bash_login file in your home directory (if one of them exists just append to it) and add this line to it
Code:

xhost +si:localuser:root
save file and symlink .bashrc to .bash_login or vice-versa. From now on you allow root run X applications

peterlck 01-25-2011 10:39 PM

JMeter Install Failed (.:17510): Gtk-WARNING **: cannot open display:
 
Hi,

I have a problem installing JMeter on a linux

Enterprise Linux Enterprise Linux Server release 5.4 (Carthage)
Red Hat Enterprise Linux Server release 5.4 (Tikanga)

java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-46)


[root@<server> bin]# sh jmeter.sh

(.:18532): Gtk-WARNING **: cannot open display:
[root@msdvml62 bin]#


Also I do not have xhost in /usr/X11R6/bin/

Can someone help ?

Richard Cranium 01-25-2011 11:18 PM

Quote:

Originally Posted by IBall (Post 936947)
As root, try:
/usr/X11R6/bin/xhost +

This should enable you to connect to the X-display as root

--Ian

It also allows anyone else who can reach your machine via tcp/ip to access your keyboard and display. Great for grabbing keystrokes!

peterlck 01-26-2011 12:36 AM

Hi Ian,

Thanks for your help, I got the following.

[root@<server> bin]# /usr/X11R6/bin/xhost +
-bash: /usr/X11R6/bin/xhost: No such file or directory
[root@<server> bin]#

Does that mean I am missing some patches?
I am a QA lead actually and got this Linux VM from my administrator.

Googling around seems to suggest that I don't have X System installed in the Linux.

I am wondering if that is the reason why I got the error when running jmeter.sh ?

Hopefully someone have encountered this before and fix it :)

Cheers
Peter

dive 01-26-2011 12:59 AM

Just try the command without the path - ie: xhost +local:

Oh, also that command needs to be run by the normal user who is logged into X, not by root.

guyphillip 01-28-2013 12:43 PM

I'm using CentOS and I was getting the same error, except when I disabled the network (clicking on the icon in the top right corner and clicking 'disconnect'), it worked fine. But then when I re-enabled the network again, I get the same error.

metzenx 12-10-2013 05:24 PM

Hi, I'm quite newby and I would like to know if you could tell me how to symlink .bashrc to .bash_login?
thank you

a4z 12-11-2013 03:22 AM

try kdesu, or the gtk equivalent
I think this programs exist exalty for the reason to not have to mess around with xhost

s.verma 12-11-2013 04:46 AM

This problem also happens with me, when I am running KDE.
sudo somegtkapp
gives same error.

Although this doesn't happen when
gksudo somegtkapp
or
kdesudo somegtkapp
or
I start GNOME or fluxbox/openbox/lxsession etc.


All times are GMT -5. The time now is 10:25 PM.