0

When running gedit with sudo, editing and saving a file causes the following error to appear (twice). Note that the first time it appears is when the file is edited in any way - even just pressing the space bar. Then it happens again when saving.

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

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

This did not always occur, but started recently. It seems to be a non-fatal error. Can it be corrected?

I am using 14.04 LTS. I use Unity but supplement it with Docky and Classic Menu Indicator Applet.

When running sudo nautilus, a similar error occurs:

(nautilus:4604): Gtk-WARNING **: Failed to register client: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
Nautilus-Share-Message: Called "net usershare info" but it failed: 'net usershare' returned error 255: net usershare: cannot open usershare directory /var/lib/samba/usershares. Error No such file or directory
Please ask your system administrator to enable user sharing.

Again, this did not occur until recently, so I believe the problems are related.

muru
  • 197,895
  • 55
  • 485
  • 740

1 Answers1

0

Never run graphical applications with sudo. If you must, use gksudo instead.

sudo runs a command with superuser privileges, but does not change the home directory. Graphical applications usually assume that the current home directory belongs to the current user, and that they are allowed to store (and refer back to) configuration files there. However, if they do this under sudo, you'll have the root user trying to store files in your home directory, ending up with incorrect file permissions which will cause later problems.

It's possible your problems will go away immediately if you use gksudo instead, though you should check for root-owned files in your home directory anyway as they may cause further problems.

thomasrutter
  • 36,774