Bug 650644

Summary: to run as root, gedit requires "su -", not just "su"
Product: [Fedora] Fedora Reporter: Rob <robertfarmer37>
Component: geditAssignee: Ray Strode [halfline] <rstrode>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: low    
Version: 17CC: awilliam, collura, dew, drfudgeboy, goodyca48, jhparizona, ousia, pajafumo, pardarlington, robatino, rstrode, sanjay.ankur, th-kouka
Target Milestone: ---Keywords: CommonBugs
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: https://fedoraproject.org/wiki/Common_F14_bugs#su_gnome
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-01 16:46:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rob 2010-11-07 15:21:49 UTC
Description of problem:
This is a fresh install of fedora 14 just after the first round of updates

Running:

su -c 'gedit /etc/fstab'

I get this error message:

(gedit:2500): EggSMClient-WARNING **: Failed to connect to the session manager: None of the authentication protocols specified are supported

**
GLib-GIO:ERROR:gdbusconnection.c:2270:initable_init: assertion failed: (connection->initialization_error == NULL)

running: gedit test.txt works fine, only seems to be a problem when trying to edit as root


Version-Release number of selected component (if applicable):
gedit - Version 2.30.4


How reproducible:
Allways

Comment 1 Adam Williamson 2010-11-08 19:07:22 UTC
use 'su -' rather than 'su'.

I'm not sure if this is really considered a bug or not, to be honest. if so I think it's in glib / dbus, not gedit.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 2 Adam Williamson 2010-11-08 19:16:13 UTC
i figure there must have been another report of this but I can't find it right now; tagging this one as CommonBugs so I don't forget about it.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 3 Rob 2010-11-09 22:02:54 UTC
Maybe related to a similar bug i posted for F13?

https://bugzilla.redhat.com/show_bug.cgi?id=615285

Whats the difference between "su -" and "su"? Just testing them out both seem to just log me in as root rather than the intended "run only this 1 command as root"

I assumed it was a bug as it worked previously in anything <= F13, though maybe it working previously was a bug? Also most documentation i've seen, suggests using "su -c 'gedit somefile'"

Comment 4 Adam Williamson 2010-11-09 22:06:43 UTC
su -c 'gedit somefile' -

is the equivalent change for the su -c case.

What the '-' does is tell su to use root's entire environment, rather than just give root privileges but keep the existing (user) environment.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 5 Brendan Jones 2010-12-03 10:29:55 UTC
*** Bug 659166 has been marked as a duplicate of this bug. ***

Comment 6 pajafumo 2010-12-04 01:41:17 UTC
Ok, I think you didn't understandme. Here are the steps:

1. Open Terminal
2. Show: [tgp@nobocanuser ~]$ 
3. type: su
4. password: ******
5. Show: [root@nobocanuser tgp]# 
6. Type: gedit /etc/X11/xorg.conf  (or another file to edit)
7. Show: (gedit:2687): EggSMClient-WARNING **: Failed to connect to the session manager: None of the authentication protocols specified are supported

**
GLib-GIO:ERROR:gdbusconnection.c:2270:initable_init: assertion failed: (connection->initialization_error == NULL)
Abortado (`core' generado)
[root@nobocanuser tgp]# 
8. End of the error and I don't know why I get this error, none of the another versions of Fedora give me that error.

Is this a bug or I have some thing misconfigured?

Comment 7 Adam Williamson 2010-12-04 02:19:54 UTC
We already explained what you have to do above.

Instead of typing 'su', type 'su -' . that will fix it.

Comment 8 Donald Edward Winslow 2010-12-13 18:52:21 UTC
As Robert Farmer originally posted, "su -c 'gedit'" does not work on all systems. Here is what my system says:

[Donald@Zonotrichia ~]$ su -c 'gedit /etc/X11/xorg.conf'
Password: 

(gedit:2767): EggSMClient-WARNING **: Failed to connect to the session manager: None of the authentication protocols specified are supported

**
GLib-GIO:ERROR:gdbusconnection.c:2270:initable_init: assertion failed: (connection->initialization_error == NULL)
[Donald@Zonotrichia ~]$ 

--Donald

Comment 9 Andre Robatino 2010-12-13 18:55:33 UTC
See comment 4 - you need the dash at the end:

su -c 'gedit /etc/X11/xorg.conf' -

Comment 10 Donald Edward Winslow 2010-12-14 00:20:10 UTC
OK--That works! I thought the discussion was over the - in -c and didn't notice the one at the end.

Comment 11 Christopher Aillon 2011-02-16 20:56:20 UTC
*** Bug 657703 has been marked as a duplicate of this bug. ***

Comment 12 Victor Manuel 2011-04-16 03:31:16 UTC
I have a problem, but I do not know if my problem is different....

[root@acapulcos Escritorio]# ZendStudio/ZendStudio -i silent
**
GLib-GIO:ERROR:gdbusconnection.c:2270:initable_init: assertion failed: (connection->initialization_error == NULL)
Abortado (`core' generado)


I need to use ZendStudio.

I'm from México, I'm sorry for my bad english.


Saludos

Comment 13 Adam Williamson 2011-04-18 16:53:48 UTC
so do the same. use 'su -' to become root, not 'su'.

Comment 14 James Heather 2011-11-18 10:27:41 UTC
(In reply to comment #13)
> so do the same. use 'su -' to become root, not 'su'.

This is presumably a workaround rather than a solution?

It used to work fine a couple of versions ago (I forget exactly when--maybe F13 or F14?). It is rather annoying now having to 'su -', because quite often you want to keep the same working directory etc.

It ought to be possible for a root shell that's kept the same environment to connect to the same session... intuitively it would be harder if it hadn't kept the environment intact!

Could this be properly fixed?

Comment 15 James Preston 2012-06-10 19:45:05 UTC
(In reply to comment #10)
> OK--That works! I thought the discussion was over the - in -c and didn't
> notice the one at the end.

OK, I too was having the same problem and did not notice the - at the end of the command. Well, really, I did notice the - but thought it was part of the quoting rather than part of the command. When I read this comment the light finally went off and I finally got the command to work.

Comment 16 James Preston 2012-06-10 19:48:37 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > so do the same. use 'su -' to become root, not 'su'.
> 
> This is presumably a workaround rather than a solution?
> 
> It used to work fine a couple of versions ago (I forget exactly when--maybe
> F13 or F14?). It is rather annoying now having to 'su -', because quite
> often you want to keep the same working directory etc.
> 
> It ought to be possible for a root shell that's kept the same environment to
> connect to the same session... intuitively it would be harder if it hadn't
> kept the environment intact!
> 
> Could this be properly fixed?

I would like to have the maintainers comment on this. 
Is this really a bug that will possibly be addressed? 
Or is it intential and I should just "get over it" and get used to running the command as "su -c 'gedit somefile' -"

As a user vote, I too would like the old behaviour or an explanation of why it should be working this way.

Thanks, jim

Comment 17 Adam Williamson 2012-06-12 23:53:34 UTC
I think at this point it's just something you have to get used to. I am not the canonical reference, though. If anyone involved in GNOME tells you different, trust them.

Comment 18 Andre Robatino 2012-06-13 00:04:17 UTC
(In reply to comment #17)
> I think at this point it's just something you have to get used to. I am not
> the canonical reference, though. If anyone involved in GNOME tells you
> different, trust them.

Personally I think this is a genuine bug, but I'd like to hear from the maintainer why it behaves this way and if it's intentional.

Comment 19 James Preston 2012-07-20 03:24:40 UTC
Maintainers going to chime in as requested?

Comment 20 Ray Strode [halfline] 2012-07-24 22:15:43 UTC
Running gedit as root is certainly "off label" use. The problem, I believe, is the session bus doesn't allow root to connect to it, on the user that belongs to the session.

If this used to work, my guess is gedit used to talk to the session manager via the XSMP protocol instead of via the session bus.

you can probably 

unset DBUS_SESSION_BUS_ADDRESS

before running gedit and get back the old behavior.  

Another idea is use "sudo" instead of su -c ' '.  sudo clears the environment of the started process so DBUS_SESSION_BUS_ADDRESS will be unset.

Clearly, the "right" fix here, though, is making it so if a user tries to save to a file that is owned by root, gedit prompts for the administrator (as defined by polkit) password, so users don't have to run it as root in the first place.

Comment 21 Fedora End Of Life 2013-07-04 05:33:30 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 22 Andre Robatino 2013-07-04 07:17:54 UTC
In F19, gedit run with "su" only emits some warnings in the terminal, but it *does* run. (With "su -", it runs with no warnings.) So this bug appears mostly fixed.

[andre@compaq-pc ~]$ su -
Password: 
[root@compaq-pc ~]# gedit
[root@compaq-pc ~]# logout
[andre@compaq-pc ~]$ su
Password: 
[root@compaq-pc andre]# gedit

(gedit:8360): dconf-WARNING **: failed to commit changes to dconf: The connection is closed

(gedit:8360): dconf-WARNING **: failed to commit changes to dconf: The connection is closed

(gedit:8360): dconf-WARNING **: failed to commit changes to dconf: The connection is closed
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)

(gedit:8360): Gtk-CRITICAL **: gtk_application_inhibit: assertion `application->priv->sm_proxy != NULL' failed

(gedit:8360): dconf-WARNING **: failed to commit changes to dconf: The connection is closed

(gedit:8360): Gtk-CRITICAL **: gtk_application_inhibit: assertion `application->priv->sm_proxy != NULL' failed

(gedit:8360): dconf-WARNING **: failed to commit changes to dconf: The connection is closed
[root@compaq-pc andre]#

Comment 23 Andre Robatino 2013-07-04 07:18:50 UTC
Also, I probably never tested with F18. Can someone who is still running F18 do that?

Comment 24 Adam Williamson 2013-07-04 21:24:35 UTC
Seems OK in F18 here.

Comment 25 Craig Goodyear 2013-07-16 20:08:53 UTC
On fully updated Fedora 19 running kernel 3.9.9-302.fc19.x86_64, 
running gedit from "su -" login I get the following error, if I 
press any key:

[craig@sys76 ~]$ su -
Password: 
[root@sys76 ~]# gedit /etc/hosts

(gedit:2019): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
[root@sys76 ~]#

Comment 26 Fedora End Of Life 2013-08-01 16:46:29 UTC
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.