error: XDG_RUNTIME_DIR not set in the environment. Gtk-WARNING **: cannot open display:

我怕爱的太早我们不能终老 提交于 2019-12-06 01:27:51

I have the same problem.

The reason in my situation is that sudo does NOT inherit environment variables: DISPLAY XAUTHORITY.

HOW TO FIX?

For Ubuntu 14, open sudoers file via sudo visudo, then paste:

Defaults        env_keep += "DISPLAY XAUTHORITY"

Had same problem. My fault that i followed another answer and changed file sudoers with next string:

Defaults        env_keep="https_proxy"

But i should have added that:

Defaults        env_keep += "https_proxy"

First string overrides existing list.

Om Prakash

I also had the same problem on Ubuntu 14.04. It was caused while following another answer. Open terminal by pressing,

Ctrl+ Alt + T

then $ sudo visudo

change

Defaults env_keep="https_proxy"

to

Defaults env_keep += "https_proxy"

It worked for me.

If you see XDG_RUNTIME_DIR in the output of env as a regular user, then all you probably need to do is use the -E switch to preserve the environment.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!