我曾经用sublime打开文本文件,对于只读文件,我过去会这样做:sudo sublime
。但是现在突然间,sudo sublime
命令出现以下错误:
(sublime:3931): Gtk-WARNING **: cannot open display:
虽然sublime
命令运行良好。我尝试使用gedit
,但出现了相同的问题,并显示gedit错误:
error: XDG_RUNTIME_DIR not set in the environment.
(gedit:3933): Gtk-WARNING **: cannot open display:
我安装了
gtk
,并尝试使用gksudo
,但仍然遇到相同的错误!
我在网上搜索后发现以下方式:
xhost +localhost
:https://askubuntu.com/questions/614387/gksu-gtk-warning-cannot-open-display-0export DISPLAY=:0.0
:ssh username@hostname -X
ssh username@hostname -Y
- https://superuser.com/questions/310197/how-do-i-fix-a-cannot-open-display-error-when-opening-an-x-program-after-sshi
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY sublime
我想知道为什么会突然出现这个错误!另外,我想回到sudo sublime
版本,因为它很容易记住。我该怎么修复呢?
另外,我最近对系统做了以下更改:
安装了Mac主题用于Ubuntu: http://www.noobslab.com/2014/04/macbuntu-1404-pack-is-released.html
安装了gksu(用于gksudo)
非常感谢您的帮助!