21

I was trying to use gedit, when I came across the following problem:

myPC@TM77:~$ sudo gedit /etc/pm/config.d/config
(gedit:12512): IBUS-WARNING **: The owner of /home/myPC/.config/ibus/bus is not root!
(gedit:12512): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

What is happening?

ZAD-Man
  • 125
  • 7

3 Answers3

22

There is no problem with editing files as root using gedit. I do it often and always will use the following method, which is the correct way to use gedit with superuser permissions:

gksudo gedit /etc/pm/config.d/config

to edit a file with root permissions.

Not sure why the downvotes, since this was the only correct answer, the other said use another editor. So I'll tell and show you why.

You should never use normal sudo to start graphical applications as Root. You should use gksudo (kdesudo on Kubuntu) to run such programs. gksudo sets HOME=~root, and copies .Xauthority to a tmp directory. https://help.ubuntu.com/community/RootSudo#Graphical_sudo

SudoSURoot
  • 2,829
  • 2
  • 14
  • 16
  • @phpGeek Seems related to me. I just tried calling gedit with gksudo, and I didn't get any of the aforementioned warnings. – Brilliand Jun 27 '15 at 01:00
  • sudo -i is now recommended instead of gksudo and gksu to prevent subsequent ownership and permission issues as gksu and gksudo are depreciated. – mchid Apr 20 '16 at 05:23
8

Both messages are warnings:

IBUS-WARNING **: The owner of /home/myPC/.config/ibus/bus is not root!

This happens since you are calling Gedit with sudo. Is perfectly normal this could happen. Instead of Gedit you may want to use nano or vim or any other non-GUI editor.

Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service file

GD is trying to access the org.gnome.SessionManager dbus directive, but that directive is not provided. Actually, that directive do not exist in normal installation, the message can be safely ignored.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • If I'm right, I can't use gedit to edit files as a root? instead I have to use nano or vim, or use gksudo. – user215336 Nov 13 '13 at 15:00
  • you can, but is not advisable. But in any ways the message you are getting are not by any means critical. You can ignore them (for now) do your changes and if you are still doubtful do a chown -R $USER:$USER ~/ to gain again ownership of all your files. – Braiam Nov 13 '13 at 15:55
  • 1
    @user215336 You can but, as you mentioned, you must use gksu, gksudo, or in an open terminal you can use sudo gedit to allow root permission. You would also need to use sudo for vim or nano in the same way. As Braiam mentions, these warnings can safely be ignored. See here for an in depth explanation of sudo https://help.ubuntu.com/community/RootSudo – mchid Oct 25 '14 at 15:45
5

I also encountered this, and found that reinstalling gedit fixes the issue:

sudo apt-get purge gedit
sudo apt-get install gedit
Fernand
  • 59