I have upgraded to 18.04 and find that if I attempt to launch gedit from a terminal, I only get a small window showing part of the screen, which is a bit like a screenshot. I can close the application again once I find the window and the close icon.

If I prefix the command with sudo it's OK. I want to continue to start ubuntu with the default xorg, if I start with wayland, then I don't need the 'sudo' prefix. Under wayland, starting with sudo gedit produces the same error as xorg without the 'sudo'.

I am asking if there is any known workaround for this mildly irritating bug?


It's become more annoying, as when in File Manager and I click on a file it opens gedit with the same error. I did change the owner with Norbert's suggestion but to no effect.

I've now installed Leafpad and set it to be the default application and that works OK but I'd rather go back to having gedit.

  • 2
    If you launch it once with sudo, depending on a lot of moving parts, sometimes it overwrites a settings file in text editors as root owned causing them to fail in mysterious ways. – RobotHumans Aug 17 '18 at 15:02
  • 1
    It is very likely that you have messed permission in your home folder. Try to revert them back for ~/.config folder with sudo chown -R $USER:$USER ~/.config and report back. – N0rbert Aug 17 '18 at 15:02
  • This link may shed some light on the problem and how to avoid it in the future, Why don't gksu/gksudo or launching a graphical application with sudo work with Wayland? -- 'Please avoid sudo GUI-program. It can cause the system to overwrite the configuration files for your regular user ID with root's configuration and set ownership and permissions to fit root and lock out your regular user ID.' – sudodus Aug 23 '18 at 13:05

It may help if you purge gedit, and then install it again,

sudo apt purge gedit

and after that

sudo apt install gedit

From man apt,

   install, remove, purge (apt-get(8))
       Performs the requested action on one or more packages specified via
       regex(7), glob(7) or exact match. The requested action can be
       overridden for specific packages by append a plus (+) to the
       package name to install this package or a minus (-) to remove it.

       A specific version of a package can be selected for installation by
       following the package name with an equals (=) and the version of
       the package to select. Alternatively the version from a specific
       release can be selected by following the package name with a
       forward slash (/) and codename (stretch, buster, sid ...) or suite
       name (stable, testing, unstable). This will also select versions
       from this release for dependencies of this package if needed to
       satisfy the request.

       Removing a package removes all packaged data, but leaves usually
       small (modified) user configuration files behind, in case the
       remove was an accident. Just issuing an installation request for
       the accidentally removed package will restore its function as
       before in that case. On the other hand you can get rid of these
       leftovers by calling purge even on already removed packages. Note
       that this does not affect any data or configuration stored in your
       home directory.

But you may still need to identify data or configurations stored in your home directory and change ownership from root to your user ID.

| improve this answer | |

According to the answer provided by steffel in this thread. I've made these steps:

  1. sudo vim /etc/default/im-config (or any editor you want to open the file with sudo).
  2. Add this line GTK_IM_MODULE=none at the end of the file.
  3. Reboot your device.

These steps solved the problem for me.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.