You are not logged in.

#1 2011-04-05 14:57:17

bergqvistjl
Member
Registered: 2011-01-05
Posts: 55

Can't run X applications in root - "cannot open display"

Hi, I have a problem whenever I try to run X applications in root (gedit etc. that kinda thing), they run fine as a normal user, but whenever i run them with sudo or in a root terminal, I get:

No protocol specified

(gedit:4769): Gtk-WARNING **: cannot open display: :0

This happens regardless of whether I am in KDE or GNOME. Can anyone help me? thanks.

Offline

#2 2011-04-05 15:06:57

SS4
Member
From: !Rochford, Essex
Registered: 2010-12-05
Posts: 699

Re: Can't run X applications in root - "cannot open display"

Use gksu or kdesu as user

pacman -S gksu
pacman -S kdebase-runtime

Last edited by SS4 (2011-04-05 15:07:53)


Rauchen verboten

Offline

#3 2011-04-05 15:28:26

bergqvistjl
Member
Registered: 2011-01-05
Posts: 55

Re: Can't run X applications in root - "cannot open display"

SS4 wrote:

Use gksu or kdesu as user

pacman -S gksu
pacman -S kdebase-runtime

Its not working, i've tried it with gedit and i get this:


(gedit:5881): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(gedit:5881): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed

(gedit:5881): Gdk-CRITICAL **: IA__gdk_screen_get_default_colormap: assertion `GDK_IS_SCREEN (screen)' failed

(gedit:5881): Gdk-CRITICAL **: IA__gdk_colormap_get_visual: assertion `GDK_IS_COLORMAP (colormap)' failed

(gedit:5881): Gdk-CRITICAL **: IA__gdk_screen_get_default_colormap: assertion `GDK_IS_SCREEN (screen)' failed

(gedit:5881): Gdk-CRITICAL **: IA__gdk_screen_get_root_window: assertion `GDK_IS_SCREEN (screen)' failed

(gedit:5881): Gdk-CRITICAL **: IA__gdk_screen_get_root_window: assertion `GDK_IS_SCREEN (screen)' failed

(gedit:5881): Gdk-CRITICAL **: IA__gdk_window_new: assertion `GDK_IS_WINDOW (parent)' failed

Last edited by bergqvistjl (2011-04-05 15:33:08)

Offline

#4 2011-04-05 15:35:17

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Can't run X applications in root - "cannot open display"

your ~/.Xauthority file might have been deleted. Try rebooting and it should auto-generate the file I think.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#5 2011-04-05 15:40:39

bergqvistjl
Member
Registered: 2011-01-05
Posts: 55

Re: Can't run X applications in root - "cannot open display"

Inxsible wrote:

your ~/.Xauthority file might have been deleted. Try rebooting and it should auto-generate the file I think.

OK well there wasn't an .Xauthority file for the root user, but there was for my normal user, which I deleted, i rebooted, it recreated the one for the normal user, didn't create anything for the root user, and I still get the same error. I've also tried it with other X programs and I get the same errors

Last edited by bergqvistjl (2011-04-05 15:44:57)

Offline

#6 2011-04-05 16:02:29

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Can't run X applications in root - "cannot open display"

Offline

#7 2011-04-05 16:05:11

bergqvistjl
Member
Registered: 2011-01-05
Posts: 55

Re: Can't run X applications in root - "cannot open display"

Yes. It was working fine before I installed KDE.

Offline

#8 2011-04-06 01:11:40

bergqvistjl
Member
Registered: 2011-01-05
Posts: 55

Re: Can't run X applications in root - "cannot open display"

Anyone else got any ideas?

Last edited by bergqvistjl (2011-04-06 01:11:57)

Offline

#9 2011-04-06 20:32:53

xxxspuddy
Member
Registered: 2007-05-15
Posts: 57

Re: Can't run X applications in root - "cannot open display"

Have you tried simply copying the regular user's .Xauthority file to root's home dir then running the app?


A temporary file is just a pipe with an attitude and a will to live.

Offline

#10 2011-04-06 20:39:15

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: Can't run X applications in root - "cannot open display"

You may probably want to try the "xauth" utility as well. It allows to edit and display the authorization information in the .xauthority file.
Have a look at "man xauth".


To know or not to know ...
... the questions remain forever.

Offline

#11 2011-04-06 21:23:43

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: Can't run X applications in root - "cannot open display"

Found again among my notes: Gtk-WARNING **: cannot open display. Maybe it helps.

Edit: and one more:

Run visudo

Add

env_keep+="DISPLAY XAUTHORITY"

to the Defaults line so it may look like:

Defaults !lecture,tty_tickets,!fqdn,env_keep+="DISPLAY XAUTHORITY"

Then sudo and gksudo won't mess up with 'Gtk-WARNING **: cannot open display:'

Last edited by bohoomil (2011-04-06 21:26:22)


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

Board footer

Powered by FluxBB