LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-16-2006, 12:29 AM   #1
riya
LQ Newbie
 
Registered: Jan 2006
Distribution: fedora core3
Posts: 10

Rep: Reputation: 0
"GTK warning :cannot open display" Help me please


hi
i am an entirely new person in linux.
i was trying to configure minimo browser.
i downloaded mozilla-1.7.12-source.tar.gz,unzipped it and build it using make -f client.mk build_all.
i also got an executable:mozilla/dist/bin/TestGtkEmbed
but when i tried running it ,i got an error
"GTK warning :cannot open display:"
can anyone please suggest a solution?
thank you in advance
 
Old 01-16-2006, 12:33 AM   #2
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Rep: Reputation: 30
I usually recieve that error when I forgeet I am root in a shell and try to open a GTK application...basically that means if your root in a console become a normal user before trying to run it.
 
Old 01-16-2006, 07:19 AM   #3
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 30
It sounds like it's an issue with permissions on your display. Basically, when you log into an X windows session as a user, you own that display, and other people aren't allowed to access it. This is a good thing, since your display includes your keyboard - if everyone was allowed to access it, anyone could just watch your keyboard and steal passwords, as well as virtually looking over your shoulder at what you're doing etc.

This is what lord-fu is referring to, since if you su to root, you're (temporarily) logged in as a different user, so root doesn't have access to your display. Logging out and running the command as yourself is one way of solving it, but sometimes graphical applications need root priviledges. You can control access to your display with the 'xhost' command; to allow the user 'root' to connect, issue this command as the display owner (i.e. your normal user):
Code:
$ xhost +root
and you should find that root can run graphical applications too.

HTH,
Andrzej
 
Old 01-17-2006, 03:34 AM   #4
riya
LQ Newbie
 
Registered: Jan 2006
Distribution: fedora core3
Posts: 10

Original Poster
Rep: Reputation: 0
i have logged in as root into the xwindow and also logged into command line as root.again when i try to run a gtk program,i am getting the same error.
i did gtk configuration manually after downloading packages,then configuring it,make and make install.i had installed gtk+-2.4.0 along with associated other packages(like atk,glib,pango,jpeg etc).
is the above mentioned error due to some problem or mistake in this installation?
please help
thank you in advance
 
Old 01-17-2006, 06:46 AM   #5
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 30
Have you tried logging into X as your usual user, issuing the 'xhost +root' (or just 'xhost +' if that doesn't work) in a terminal window, then 'su'-ing before running your program? It may or may not solve the issue, but I wouldn't trust things to be quite how you want them for a root login to X. At the very least, it'll pin down whether it's a config issue or a libraries/other issue.
 
Old 01-17-2006, 10:58 PM   #6
riya
LQ Newbie
 
Registered: Jan 2006
Distribution: fedora core3
Posts: 10

Original Poster
Rep: Reputation: 0
yes ,i tried that also.i logged in as normal user and gave "xhost +" from command line.i got error message as "unable to open display".
i think something is wrong with my x window.my x window is also not working properly.when i gave "startx" from command line i got error as
"/etc/X11/xinit/xinitrc-common line45:3206 segmentation fault
xmodmap "$sysmodmap" ". is my xwindow having some problem.
i have installed xorg-x11-6.8.1-12-i386.rpm and also
xorg-x11-devel-6.8.1-12.i386.rpm.is it needed that i should include some library?please suggest a solution
please help
 
Old 01-18-2006, 04:06 AM   #7
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 30
Yeah, if you can't use xhost as the user you logged in as, there's something up. Though if you can use X at all, you should have access to the display to be able to change its access rights...

Looking on Google, all reports of the GTK warning seem to be either (i)related to SSHing into another machine (the vast majority), or (ii)people unable to start X at all. As noted, if you can log into X, that user should be able to access that display, and... hmm.

Just to check, you are trying to run things on your own monitor and not on some other computer? If so, perhaps the $DISPLAY environment variable is set so it's looking somewhere else. Try "echo $DISPLAY" from a console to see if you're inadvertently trying to start your app on a remote PC. It should almost certainly be ":0.0", so if it's not, try
Code:
export DISPLAY=:0.0
and see if you have any more success.

If that doesn't sort it out... can you run the standard X applications, and other downloaded ones? It could be that your Gtk toolkit isn't installed properly, though I probably won't be able to help you with that other than suggesting a
Code:
yum update
yum install gtk2
which even then is just a guess.

Hope one of these things sorts out your problem,
Andrzej
 
Old 01-23-2006, 07:04 AM   #8
riya
LQ Newbie
 
Registered: Jan 2006
Distribution: fedora core3
Posts: 10

Original Poster
Rep: Reputation: 0
hi
i tried it also.but end up with no success.
i think something was wrong with my xwindow.i reinstalled it.now gtk is working properly
thank u all for ur help and support
 
  


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: " when I su dack_x Linux - Software 5 11-03-2007 12:49 PM
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: davikevi Programming 3 02-18-2005 11:42 PM
"GTK-warning**: Cannot open display" Leon S. Kennedy Linux - Newbie 1 07-21-2003 03:05 AM


All times are GMT -5. The time now is 05:47 PM.

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