Synaptic As Root - Cannot Open Display - Runs As Regular User but not root.

Asked by Knatchwa

Jaunty 9.04 AMD 3200 with 2 Gig of Ram

I made an attempt to run Synaptic via the Gui and only showed the password, once entered synaptic did not open up.

When I did the same in terminal sudo synaptic - I get the error cannot open display - GTK Error

Even when trying to to use sudo su - the same error. Am I missing something or is it merely a matter of misconfiguration?

What should occur is really self explanatory, that when you run it from anywhere synaptic should open up.

I am currently part of the admin group so that should not be a problem, just trying to figure out a solution any takers?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu synaptic Edit question
Assignee:
No assignee Edit question
Solved by:
Sam_
Solved:
Last query:
Last reply:
Revision history for this message
Jens Maucher (jensmaucher) said :
#1

Well, when it runs as user and not as root, i think you don't miss something.

Can you post your error message please?

Revision history for this message
Knatchwa (rl-marr) said :
#2

Well that is certainly true, but you are only able to save marked changes when Synaptic is run as a user, in order to actually implement the changes, you need to be root. So the problem is without root access nothing can be changed or updated via Synaptic.

Certainly it is possible, to use apt, update manager and others but I rather prefer the interface of synaptic, and I feel that this is an important aspect of people adopting Ubuntu / Linux as their primary Operating System. On the bug report I had added a photo showing the error message.

No protocol specified

(synaptic:6121): Gtk-WARNING **: cannot open display: :0.0

That is in it's most basic form, and that is where the problem is, so I am still ooking for a solution to this particular challenge.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

You do not run gui apps with sudo.

use:

gksudo synaptic

it may even be

gksudo synaptic_installer

if you use kde please use kdesudo in the place of gksudo. sudo does not set up the environment properly and can cause issues (especially with sudo gedit which is rife on the web in guides and is incorrect)

sudo is for cli commands ONLY, like:
  cp, mv, ln, apt-get
gksudo/kdesudo is for
  gedit, kate, nautilus, dolphin

Revision history for this message
Knatchwa (rl-marr) said :
#4

Fair enough, yet the challenge is even using the dropdown System>Administration>Synaptic I get the password prompt, enter the correct password but the program does not open up. So something else is causing it to crash, and so the problem is still open.

What I am not understanding is why it does not run properly, whether you run it from CLI or Dropdown, something else is going on, the same challenge with Root Terminal that it does not open up, so perhaps it is a matter of privileges, or something else.

The point being the only way I have been able to open up synaptic was from command prompt where I was only considered a user thereby unable to save anything except the marked changes. So still I am trying to understand what is going on here, any other suggestions?

Revision history for this message
Knatchwa (rl-marr) said :
#5

Even with gksudo synaptic or synaptic_installer I still get the same error:
No protocol specified

(synaptic:8163): Gtk-WARNING **: cannot open display: :0.0

While with synaptic_installer in the same context just blank then back to command prompt.

Revision history for this message
Best Sam_ (and-sam) said :
#6
Revision history for this message
Jens Maucher (jensmaucher) said :
#7

And an other solution is:

/root/.bashrc:
export XAUTHORITHY=/home/<user>/.Xauthority

Now, when you run synatic as root (i mean real root, NOT sudo) from the terminal, it should be work without error.

Revision history for this message
Knatchwa (rl-marr) said :
#8

Thanks Sam, that solved my question.

Revision history for this message
starchild7778 (starchild7778) said :
#9

I have this same problem opening any gui with root priviledges using "gksudo". I get the gkt error . . . cannot open display :0.0 However, using "kdesudo" on the same system works fine with no errors. I can successfully use the "kdesudo" command to launch gui apps as root in both Gnome and KDE sessions without error. However, the "gksudo" command fails in either type of session.

Revision history for this message
Sergio Spinatelli (spinatelli) said :
#10

I have the same problem using natty(maverick upgraded from natty repos).
gksudo or gksu don't work,neither does logging in as root ..