Linux 无法在 RHEL 上打开显示
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13920965/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot open display on RHEL
提问by fanchyna
I am trying to ssh to a server (myserver) installed with RHEL 5.8 from a desktop client (mydesktop) with RHEL 6.2. I have group installed the "X Window" on the remote server, the DISPLAY variable on the remote server is also set to be localhost:0.0, but I still cannot get firefox started. The command to connect is
我正在尝试从带有 RHEL 6.2 的桌面客户端 (mydesktop) ssh 到安装了 RHEL 5.8 的服务器 (myserver)。我在远程服务器上组安装了“X Window”,远程服务器上的 DISPLAY 变量也设置为 localhost:0.0,但我仍然无法启动 firefox。连接命令是
$ ssh -X -l myname myserver
The error message is
错误信息是
$ firefox
Error: cannot open display: localhost:0.0
I tried to execute the command on myserver below
我试图在下面的 myserver 上执行命令
$ xhost +localhost
but it gives me an error message
但它给了我一条错误信息
xhost: unable to open display "localhost:0.0"
There are three phenomena I want to mention
我想提三个现象
- another user of mydesktop is able to start firefox after logging into myserver.
- I was able to start firefox when I remotely logged into another server: myserver2.
- firefox is just an example. In general, I cannot launch any x window programs.
- mydesktop 的另一个用户可以在登录到 myserver 后启动 firefox。
- 当我远程登录到另一台服务器 myserver2 时,我能够启动 Firefox。
- firefox 只是一个例子。通常,我无法启动任何 x 窗口程序。
I have no idea what is going on. Please help me.
我不知道发生了什么。请帮我。
This is an update of my problem. The problem was solved "partially". What I did was to delete the "export DISPLAY==localhost:0.0" from my ".bashrc" file, logout and then login again and I can start firefox!!!
这是我的问题的更新。问题已“部分”解决。我所做的是从我的“.bashrc”文件中删除“export DISPLAY==localhost:0.0”,注销然后再次登录,我就可以启动firefox了!!!
However, this is not the end of the story. I have a new problem: $ sudo wireshark
然而,这并不是故事的结局。我有一个新问题:$ sudo wireshark
does not work. Here is the error message:
不起作用。这是错误消息:
[myself@myserver ~]$ sudo wireshark
debug1: client_input_channel_open: ctype x11 rchan 2 win 65536 max 16384
debug1: client_request_x11: request from 127.0.0.1 46595
debug1: channel 1: new [x11]
debug1: confirm x11
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from 127.0.0.1 46596
debug1: channel 2: new [x11]
debug1: confirm x11
X11 connection rejected because of wrong authentication.
debug1: channel 2: free: x11, nchannels 3
The application 'wireshark' lost its connection to the display localhost:10.0;
most likely the X server was shut down or you killed/destroyed
the application.
debug1: channel 1: FORCE input drain
Why can't I start x window under sudo?
为什么我不能在 sudo 下启动 x window?
回答by fanchyna
The problem is solved by doing the following two things:
通过做以下两件事来解决问题:
- commenting out the
export DISPLAY=Localhost:10.0
from my .bashrc file. I think this is because I overwrites the default value ofDISPLAY
environmental variable. By doing this, I am able to start 'firefox' under my regular account. - logout, login and add
export XAUTHORITY='/home/myself/.xauthority
into my .bashrc file. Then logout and login again so that I can runsudo wireshark
.
export DISPLAY=Localhost:10.0
从我的 .bashrc 文件中注释掉。我认为这是因为我覆盖了DISPLAY
环境变量的默认值。通过这样做,我可以在我的常规帐户下启动“firefox”。- 注销,登录并添加
export XAUTHORITY='/home/myself/.xauthority
到我的 .bashrc 文件中。然后注销并再次登录,以便我可以运行sudo wireshark
.
The -v
option in the ssh command is very useful when diagnosing the problem.
-v
ssh 命令中的选项在诊断问题时非常有用。