如果未在命令前添加“sudo”,则无法在 18.04 中启动 gedit

如果未在命令前添加“sudo”,则无法在 18.04 中启动 gedit

我已经升级到 18.04,发现如果我尝试从终端启动 gedit,我只会看到一个小窗口,显示部分屏幕,有点像屏幕截图。找到窗口和关闭图标后,我可以再次关闭该应用程序。

如果我在命令前加上 sudo,那就没问题了。我想继续使用默认的 xorg 启动 ubuntu,如果我从 wayland 启动,那么我不需要“sudo”前缀。在 wayland 下,使用 sudo gedit 启动会产生与没有“sudo”的 xorg 相同的错误。

我问的是是否有任何已知的方法可以解决这个有点烦人的错误?

编辑

这变得越来越烦人,因为当我在文件管理器中单击文件时,它会打开 gedit 并出现相同的错误。我确实按照 Norbert 的建议更改了所有者,但没有效果。

我现在已经安装了 Leafpad 并将其设置为默认应用程序,并且运行正常,但我宁愿回到使用 gedit。

答案1

如果您清除gedit,然后再次安装,

sudo apt purge gedit

在那之后

sudo apt install gedit

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.

但您可能仍需要识别存储在您的主目录中的数据或配置,并将所有权更改为root您的用户 ID。

答案2

根据steffel此主题。我已采取以下步骤:

  1. sudo vim /etc/default/im-config(或者您想要用来打开文件的任何编辑器sudo)。
  2. GTK_IM_MODULE=none在文件末尾添加此行。
  3. 重新启动您的设备。

这些步骤为我解决了这个问题。

相关内容