PDA

View Full Version : Graphic applications not working with root privileges (sudo)



sherlock2
June 2nd, 2014, 06:45 PM
After upgrading from Ubuntu 11.10 to 12.04 LTS, I keep getting the following error when trying to open graphic applications with root privileges (sudo).
eg.: executing "sudo gedit" I get "cannot open display" after "Autolaunch error: X11 initialization failed"

The following happens under Gnome classic (no effects)

$ sudo gedit
** (gedit:18400): WARNING **: Riga di comando "dbus-launch --autolaunch=687c94355e5f99d1f9b772630000000c --binary-syntax --close-stderr" uscita con stato di uscita 1 non-zero: Autolaunch error: X11 initialization failed.\n
Impossibile aprire il display:
Eseguire "gedit --help" per visualizzare un elenco completo delle opzioni disponibili a riga di comando.

echo $DISPLAY prints :0.0

if I give sudo -i and then echo $DISPLAY, nothing is returned.
What should I check?

Frogs Hair
June 2nd, 2014, 07:35 PM
Try the following ,
sudo apt get install gksu Preferred commands for graphical applications are as follows .
gksu gedit or
gksudo gedit

sherlock2
June 2nd, 2014, 08:13 PM
I forgot to mention that I already tried using gksu or gksudo, and the result is that I get the "Cannot open display" error the same



$ gksu gedit
Cannot open display:
Run 'gedit --help' to see a full list of available command line options.

Frogs Hair
June 2nd, 2014, 08:25 PM
Please wait for a user experienced with permissions . I have not tried an end of life upgrade before and 11.10 certainly was . You may also want to translate the error messages.

sherlock2
June 10th, 2014, 10:15 AM
solved adding the line Defaults env_keep+="DISPLAY XAUTHORITY" at the end of /etc/sudoers