Gtk-WARNING : Calling Inhibit failed [duplicate]

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?


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


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.