gpt4 book ai didi

ssh - 错误 : XDG_RUNTIME_DIR not set in the environment. Gtk-WARNING **:无法打开显示:

转载 作者:行者123 更新时间:2023-12-02 13:46:44 24 4
gpt4 key购买 nike

我曾经用 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-0
  • export 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

    从这里: https://askubuntu.com/questions/456689/error-xdg-runtime-dir-not-set-in-the-environment-when-attempting-to-run-naut

    我想知道为什么我会收到这个错误,太突然了!另外,我想回到 sudo sublime 版本,因为它很容易记住。我该如何解决?

    此外,我最近对系统所做的更改是:
  • 为 Ubuntu 安装了 Mac 主题:http://www.noobslab.com/2014/04/macbuntu-1404-pack-is-released.html
  • 已安装 gksu(用于 gksudo)

  • 帮助将不胜感激!

    最佳答案

    我也有同样的问题。

    在我的情况下的原因是 sudo不继承环境变量:DISPLAY XAUTHORITY .

    怎么修?

    对于 Ubuntu 14,打开 sudoers文件通过 sudo visudo ,然后粘贴:

    Defaults        env_keep += "DISPLAY XAUTHORITY"

    关于ssh - 错误 : XDG_RUNTIME_DIR not set in the environment. Gtk-WARNING **:无法打开显示:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33187159/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com