LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 05-16-2004, 12:35 PM   #1
gonzalo76
Member
 
Registered: Feb 2004
Location: Argentina
Distribution: Fedora Core
Posts: 34

Rep: Reputation: 15
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?
 
Old 05-16-2004, 01:48 PM   #2
slackwarefan
Member
 
Registered: Oct 2003
Location: Florida
Distribution: Slackware
Posts: 273

Rep: Reputation: 30
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.
 
Old 05-16-2004, 07:54 PM   #3
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 61
As root, try:
/usr/X11R6/bin/xhost +

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

--Ian
 
Old 05-17-2004, 10:26 AM   #4
gonzalo76
Member
 
Registered: Feb 2004
Location: Argentina
Distribution: Fedora Core
Posts: 34

Original Poster
Rep: Reputation: 15
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 !!!
 
Old 07-25-2005, 02:05 PM   #5
Kropotkin
Member
 
Registered: Oct 2004
Location: /usr/home
Distribution: Fedora, Mint, FreeBSD, Android
Posts: 346

Rep: Reputation: 31
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
 
Old 11-18-2009, 06:05 AM   #6
abhax
LQ Newbie
 
Registered: Nov 2009
Posts: 1

Rep: Reputation: 0
Just dun use it when you are root...

use shell> sudo gedit <filename>
 
Old 11-18-2009, 06:38 AM   #7
witek
Member
 
Registered: Oct 2008
Location: Poland, Łódź
Distribution: Lubuntu, Salix
Posts: 102

Rep: Reputation: 19
Quote:
Originally Posted by Kropotkin View Post
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
 
Old 01-25-2011, 09:39 PM   #8
peterlck
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
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 ?
 
Old 01-25-2011, 10:18 PM   #9
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.1
Posts: 1,494

Rep: Reputation: 437Reputation: 437Reputation: 437Reputation: 437Reputation: 437
Quote:
Originally Posted by IBall View Post
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!
 
Old 01-25-2011, 11:36 PM   #10
peterlck
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
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

Last edited by peterlck; 01-26-2011 at 12:15 AM.
 
Old 01-25-2011, 11:59 PM   #11
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,211

Rep: Reputation: 292Reputation: 292Reputation: 292
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.

Last edited by dive; 01-26-2011 at 12:07 AM.
 
Old 01-28-2013, 11:43 AM   #12
guyphillip
LQ Newbie
 
Registered: Jan 2013
Posts: 1

Rep: Reputation: Disabled
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.
 
Old 12-10-2013, 04:24 PM   #13
metzenx
LQ Newbie
 
Registered: Dec 2013
Location: Spain is pain!
Distribution: linux mint 17 cinnamon 32-bit
Posts: 23

Rep: Reputation: Disabled
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
 
Old 12-11-2013, 02:22 AM   #14
a4z
Member
 
Registered: Feb 2009
Posts: 401

Rep: Reputation: 137Reputation: 137
try kdesu, or the gtk equivalent
I think this programs exist exalty for the reason to not have to mess around with xhost
 
Old 12-11-2013, 03:46 AM   #15
s.verma
Member
 
Registered: Oct 2013
Distribution: Debian Sid, Gentoo, Arch, Debian
Posts: 139
Blog Entries: 3

Rep: Reputation: 21
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gtk warning cannot open display bosewicht Linux - Newbie 2 03-10-2010 07:53 PM
Gtk-WARNING **: cannot open display iamjoepesci Red Hat 2 10-17-2008 11:51 AM
Gtk-WARNING **: cannot open display elfoozo DamnSmallLinux 3 07-12-2007 09:41 PM
Gtk-WARNING **: cannot open display: lijomali Fedora 6 11-10-2005 06:43 PM
Gtk-WARNING **: cannot open display: Larsin Linux - Software 1 02-25-2004 10:47 AM


All times are GMT -5. The time now is 10:35 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration