LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Gtk-WARNING **: cannot open display: :0.0 (https://www.linuxquestions.org/questions/debian-26/gtk-warning-%2A%2A-cannot-open-display-0-0-a-807450/)

toxine 05-12-2010 03:03 PM

Gtk-WARNING **: cannot open display: :0.0
 
Hello

Im trying to access gparted, i get an error
Quote:

(gpartedbin:4918): Gtk-WARNING **: cannot open display:
I am connect via vnc if this helps.

thanks.

acid_kewpie 05-12-2010 03:21 PM

not vnc related, it's probably becuase you're su'd to root without having run "xhost +localhost" as the owner of the vnc server itself.

toxine 05-12-2010 03:32 PM

thanks for the fast reply, so how can i fix this?
do i log on vnc as user, run "xhost +localhost" in terminal as user then run gparted as a root?

acid_kewpie 05-12-2010 03:38 PM

yep, that's the one. There are other reasons for this, but this, especially when asked on a forum is 99% this.

acid_kewpie 05-12-2010 03:38 PM

BTW, vnc is awful in every way, I'd *VERY* strongly suggest a decent solution like nx

toxine 05-12-2010 03:54 PM

Quote:

Originally Posted by acid_kewpie (Post 3966198)
yep, that's the one. There are other reasons for this, but this, especially when asked on a forum is 99% this.

I actually tried the xhost solution before posting but didn't work , i just wanted to confirm that im doing it correctly.

I tried "export DISPLAY=:0.0" too, doesn't work either

Quote:

user@server:~$ xhost +localhost
localhost being added to access control list
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 109 (X_ChangeHosts)
Value in failed request: 0x6
Serial number of failed request: 9
Current serial number in output stream: 13
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 109 (X_ChangeHosts)
Value in failed request: 0x6
Serial number of failed request: 10
Current serial number in output stream: 13
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 109 (X_ChangeHosts)
Value in failed request: 0x6
Serial number of failed request: 11
Current serial number in output stream: 13
Quote:

user@server:~$ su -
Password:
server:~# gparted

(gpartedbin:3711): Gtk-WARNING **: cannot open display:
Still error. :scratch:

thank you for your time and suggestion.

fruttenboel 05-12-2010 05:57 PM

Quote:

Originally Posted by toxine (Post 3966212)
I actually tried the xhost solution before posting but didn't work , i just wanted to confirm that im doing it correctly.

I tried "export DISPLAY=:0.0" too, doesn't work either

Still error. :scratch:

thank you for your time and suggestion.

The problem is caused by user 'you' owning the display and then user 'root' wanting to get away with it. Yes, 'root' is the supreme God of your system and is omni potent. But not for X11.

The best thing to do is:

- kill the window system
- log off the terminal
- log on as root
- startx
- do your thing

You will HAVE to start X11 as user 'root'. Period.

toxine 05-12-2010 06:49 PM

Quote:

Originally Posted by fruttenboel (Post 3966336)
The problem is caused by user 'you' owning the display and then user 'root' wanting to get away with it. Yes, 'root' is the supreme God of your system and is omni potent. But not for X11.

The best thing to do is:

- kill the window system
- log off the terminal
- log on as root
- startx
- do your thing

You will HAVE to start X11 as user 'root'. Period.

hey thanks, im a newbie couldn't understand your post fully

but this is what i did lol:
went root and created a new vncserver channel (:2), logged off user (:1), and logged to vncserver :2 as a root and ran gparted lol.

worked! now i can use my new 2tb :)

propofol 12-09-2011 10:13 PM

One other option use:
gksu X_command

newbiesforever 04-03-2012 09:26 PM

I hope five months isn't too long a time to revisit this post after. I'm not using a vnc, whatever that is, but I have had the same problem in my distro (antiX, with heavy modifications), when trying to sudo synaptic and at least one other thing that required root privileges. After some googling, I tried this command:
Quote:

su - [or sudo]
xauth merge [your user account name]/.Xauthority
Then I rebooted, logged back into my account, and found that I can now sudo synaptic. As fruttenboel stated, the problem is that when you're logged in with your user account, the X display is owned by you, so root is not allowed to perform an X command. By using the above command, I copied root's ownership of the X display to my user account. I worried that this would make my user account unable to run any X commands without sudoing (since root now owns X), but apparently not.

anticapitalista 04-04-2012 04:42 AM

If you have antiX use sux (or install it) to open apps as root in X.

newbiesforever 04-06-2012 10:14 PM

Quote:

Originally Posted by anticapitalista (Post 4644362)
If you have antiX use sux (or install it) to open apps as root in X.

Okay, done; but why do I have to this? Why does antiX not let me sudo like I did on MEPIS?

anticapitalista 04-07-2012 03:06 AM

Because sudo is not set up as it is in other distros. su for root access for cli apps annd sux for root access for gui apps works well.
(I think using sudo for gui apps aoemtimes has the issue you have, you should use gksudo)

masuch 11-05-2012 12:34 PM

Hi,

thanks for this hints.

I had a problem to run any GUI application through gksu or kdesudo as well ( Gtk-WARNING **: cannot open display: )
/as from desktop as from terminal/

I solved it by adding:
Quote:

Defaults env_keep=DISPLAY
into
/etc/sudoers

davetesc 12-25-2012 07:55 PM

Thanks for this feed. I have just installed Deb testing KDE and found this prob using my usual sudo gparted in a konsole, thanks to trying a few things from this feed I now know that gksu gparted from konsole works fine, and doesn't ask for a password like sudo does, no idea why. Thankyou again davetesc.

davetesc 01-13-2013 04:58 PM

Adding to previous post, do need password for gksu, it must have been in wallet already when testing.
Tried Defaults env_keep=DISPLAY didn't work.

Tried sudo xauth merge username/.Xauthority got unable to open file ......

Using deb testing KDE recently updated.

Any tips ????

Thanks Davetesc

GroZouRs 01-17-2014 01:19 PM

On my system, i had the same issue.


Looking at my X process :
$sudo ps -eaf | grep [/]X
root 13755 1399 3 Jan03 tty7 13:03:18 /usr/bin/X :1 -auth /var/run/lightdm/root/:1 -nolisten tcp vt7 -novtswitch

but my $DISPLAY value was this :
$echo $DISPLAY
:0

i just corrected it :
$export DISPLAY=":1"

and then everything was fine.

Are you using hibernation on a laptop ?

Phiebie 01-26-2014 06:36 AM

Quote:

Originally Posted by davetesc (Post 4869270)
Adding to previous post, do need password for gksu, it must have been in wallet already when testing.
Tried Defaults env_keep=DISPLAY didn't work.

Tried sudo xauth merge username/.Xauthority got unable to open file ......

Using deb testing KDE recently updated.

Try this:
Quote:

This time I had more luck when investigating alternatives... and I
think I have the solution using su, no need of wrappers, just PAM.
Probably also the reason sux is dead upstream and sux was pretty much
a Debian issue.

To /etc/pam.d/su add:
---8<---
# Forward xauth keys between users if invoker is root or UID 1000 or higher
session optional pam_xauth.so systemuser=999
--->8---

davetesc 01-27-2014 01:05 PM

Thanks for posts, forgot this thread way still open, either solved it or problem went away, sorry will now mark solved if I can. Davetesc.

CarlHe 05-09-2016 01:51 PM

an opposite case of the DISPLAY issue.
 
I am trying to install an astronomical software package GILDAS: https://www.iram.fr/IRAMFR/GILDAS/
Following the instructions on the Download page of that web, I installed it with "sudo port install". When I tried to launch it after installation with the command "greg", I got very the same error message:

(<unknown>:29409): Gtk-WARNING **: cannot open display:

I deem this an opposite case as in above discussions, because I used sudo to install the software but are trying to use it from my normal user account. How should I do in this case? How can I diagnose the cause?

I am using MAC OS X El Capitan.

Thanks!
Carl

widget 05-10-2016 03:43 PM

This is an ancient thread. Marked Solved.

Not an appropriate place to ask a question.

Start a new thread.

ElazarNotTaken 04-14-2019 05:32 PM

Quote:

Originally Posted by masuch (Post 4822792)
Hi,

thanks for this hints.

I had a problem to run any GUI application through gksu or kdesudo as well ( Gtk-WARNING **: cannot open display: )
/as from desktop as from terminal/

I solved it by adding:

into
/etc/sudoers

Defaults env_keep=DISPLAY or Defaults env_keep="DISPLAY"?
and what about the rest of the text there? I have about 5 lines with =+"blah blah" in that section.
Help would be much appreciated.

jamesski 08-06-2019 04:55 PM

Fatal Server Error
 
Tried the log in as root and startx,
Got a fatal Server error -
[ 3185.707] (EE) xf86OpenConsole: Cannot open /dev/tty0 (No such file or directory) [ 3185.709] (EE) [ 3185.710] (EE) Please consult the The X.Org Foundation support at http://wiki.x.org for help. [ 3185.712] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information. [ 3185.713] (EE) [ 3185.717] (WW) xf86CloseConsole: KDSETMODE failed: Bad file descriptor [ 3185.717] (WW) xf86CloseConsole: VT_GETMODE failed: Bad file descriptor [ 3185.717] (EE) Server terminated with error (1). Closing log file.
Fatal Server Error:
[ 3185.707] (EE) xf86OpenConsole: Cannot open /dev/tty0 (No such file or directory) [ 3185.709] (EE) [ 3185.710] (EE) Please consult the The X.Org Foundation support at http://wiki.x.org for help. [ 3185.712] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information. [ 3185.713] (EE) [ 3185.717] (WW) xf86CloseConsole: KDSETMODE failed: Bad file descriptor [ 3185.717] (WW) xf86CloseConsole: VT_GETMODE failed: Bad file descriptor [ 3185.717] (EE) Server terminated with error (1). Closing log file.

mrmazda 08-06-2019 09:59 PM

The information you pasted is very common, and virtually useless. Please start your own thread with a suitably descriptive title. Describe your hardware, such as model number, brand, when made, and especially the graphics unit. Include the installed distribution name and version, who installed it and when, and the window manager or DE, plus the reason for using startx instead of a GUI login manager such as GDM, SDDM or LightDM. With that information someone may be able to offer a plan, or ask for pertinent additional information.


All times are GMT -5. The time now is 07:09 AM.