Ubuntu – Error with gedit can’t save any file

geditlinuxterminalUbuntu

meraj@meraj-SATELLITE-C850-A785:~$ sudo gedit /etc/php5/apache2/php.ini

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

whenever I save the file in gedit it is not saved what should I do?

I have ubuntu 14.04

Best Answer

What to do?

You shouldn't use sudo for graphical applications, such as gedit. Use gksudo instead.

What's causing the error

I'm not sure. Apparently, the reason of error you get is that gedit is trying to invoke SessionManager's Inhibit method via D-bus.

If normal applications can connect to dbus, they should have some config files in /usr/share/dbus-1. I expected them to be /usr/share/dbus-1/services/org.gnome.SessionManager.service or /usr/share/dbus-1/system-services/org.gnome.SessionManager.service. On my Debian machine I can't find any of them.

So, my guess is gnome-session doesn't need a dbus .session file as it's not a normal application. In fact, it is itself responsible for starting the per-session instance of dbus. But the per-session instance of dbus is in fact per-user per-session, so it can't interact with graphical application running under different user than you (and root user, running sudo gedit, is different than you).

Related Question