Ubuntu – Gtk-WARNING : Calling Inhibit failed


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?

Best Answer

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