Saving a file in gedit prints a warning in terminal

Whenever you want to open a GUI application with sudo privileges from the terminal CLI, you must use sudo -H, else you probably create a login loop.

sudo -H gedit /etc/default/grub

From man sudo we get the -H description...

-H, --set-home
             Request that the security policy set the HOME environment
             variable to the home directory specified by the target user's
             password database entry.  Depending on the policy, this may
             be the default behavior.

translated this means that if you don't use -H, these two files in your /home directory probably get changed to owner root:root, and you get a login loop...

-rw------- 1 your_username your_username 441K Nov  2  2019 .ICEauthority
-rw------- 1 your_username your_username   58 Jun 23  2017 .Xauthority

The warning messages... they're just noise.

And, you should never manually edit /boot/grub/grub.cfg.

Update #1:

To lesson the need to manually edit /boot/grub/grub.cfg, edit/add the following to /etc/default/grub...

GRUB_DEFAULT=saved    # this is an edit
GRUB_SAVEDEFAULT=true # this is an add

sudo update-grub # write changes

This will allow GRUB to remember the last selected OS to boot, and will reboot to that same OS until a different OS is selected.


  1. This is not critical, the metadata seems to be only the last line number you were on, so the file will reopen in the same position. You can check with gio info <path>.

  2. Don't sudo gnome apps. Use "admin://" schema to tell gedit that it needs to escalate. You'll get a graphical escalate prompt.

gedit admin:///etc/default/grub

Good explanation on the escalation mess here:

https://easylinuxtipsproject.blogspot.com/p/about-root.html


I have only ubuntu 20.04, no multiboot, updated pkgs, sudo gedit and sudo -H gedit both continue to spew Tepl warnings, mostly re GVfs metadata.
the answering parties above have not addressed that issue, nor that it was not an issue until 20.04. from scanning pkgs, 20.04 uses 'libtepl-4-0' whose description via apt show is:

Description: Text editor library for GTK

Tepl is a library that eases the development of GtkSourceView-based text editors and IDEs. Tepl is the acronym for “Text editor product line”. It serves as an incubator for GtkSourceView.

guess the error msg hint to config tepl may do the trick, if only it included which file to config, instead of just the options to apply! :)