Saving a file in gedit prints a warning in terminal

  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


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 reduce 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.


Having gvfs installed does not prevent the error message. In my own case, "gvfs is already the newest version (1.44.1-1ubuntu1)" but the error still pops up warning whenever I "gedit" a document, either with 'sudo gedit' or 'sudo -H gedit'. I have not found a clear direction on how to fix that tepl issue, my system works great, the warning comes only when using 'sudo gedit'.

However, I found a workaround that goes like this somewhere and 'sudo gedit' gives no errors or warnings:

" Alternatively you can put: export SUDO_EDITOR='/usr/bin/gedit -w' in your .bashrc file and then you can just do this to edit the file: sudoedit /etc/default/grub "