-   Linux - Newbie (
-   -   "GTK warning :cannot open display" Help me please (

riya 01-16-2006 01:29 AM

"GTK warning :cannot open display" Help me please
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 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

lord-fu 01-16-2006 01:33 AM

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.

Dtsazza 01-16-2006 08:19 AM

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):

$ xhost +root
and you should find that root can run graphical applications too.


riya 01-17-2006 04:34 AM

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

Dtsazza 01-17-2006 07:46 AM

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.

riya 01-17-2006 11:58 PM

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 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 it needed that i should include some library?please suggest a solution
please help

Dtsazza 01-18-2006 05:06 AM

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...:confused:

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

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

yum update
yum install gtk2

which even then is just a guess.

Hope one of these things sorts out your problem,

riya 01-23-2006 08:04 AM

i tried it also.but end up with no success.
i think something was wrong with my xwindow.i reinstalled gtk is working properly
thank u all for ur help and support

All times are GMT -5. The time now is 06:17 AM.