Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ssh 尝试在Centos上运行google chrome时无法打开X显示(Rhel 7.5)_Ssh_Centos_X11 Forwarding - Fatal编程技术网

Ssh 尝试在Centos上运行google chrome时无法打开X显示(Rhel 7.5)

Ssh 尝试在Centos上运行google chrome时无法打开X显示(Rhel 7.5),ssh,centos,x11-forwarding,Ssh,Centos,X11 Forwarding,我需要使用SSH在虚拟机上远程运行Google Chrome。我不想使用xforwarding—我想利用vm上可用的GPU。当我尝试运行google chrome时,出现以下错误: [19615:19615:0219/152933.751028:ERROR:browser_main_loop.cc(1512)] Unable to open X display. 我已尝试将显示环境值设置为各种值: export DISPLAY=localhost:0.0 export DISPLAY=127.

我需要使用SSH在虚拟机上远程运行Google Chrome。我不想使用xforwarding—我想利用vm上可用的GPU。当我尝试运行
google chrome
时,出现以下错误:

[19615:19615:0219/152933.751028:ERROR:browser_main_loop.cc(1512)] Unable to open X display.
我已尝试将显示环境值设置为各种值:

export DISPLAY=localhost:0.0
export DISPLAY=127.0.0.1:0.0
export DISPLAY=:0.0
我还尝试用不同的值替换abowe示例中的0.0

我在/etc/ssh/sshd\u config中有
ForwardX11 no
我试着这样设定目标:

systemctl isolate multi-user.target
当我尝试运行
sudo lshw-C display时,我得到以下输出:

   *-display
       description: VGA compatible controller
       product: Hyper-V virtual VGA
       vendor: Microsoft Corporation
       physical id: 8
       bus info: pci@0000:00:08.0
       version: 00
       width: 32 bits
       clock: 33MHz
       capabilities: vga_controller bus_master rom
       configuration: driver=hyperv_fb latency=0
       resources: irq:11 memory:f8000000-fbffffff
  *-display UNCLAIMED
       description: VGA compatible controller
       product: GM204GL [Tesla M60]
       vendor: NVIDIA Corporation
       physical id: 1
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list
       configuration: latency=0
       resources: iomemory:f0-ef iomemory:f0-ef memory:41000000-41ffffff memory:fe0000000-fefffffff memory:ff0000000-ff1ffffff
我已尝试通过以下方式更新我的gpu驱动程序:

wget https://www.nvidia.com/content/DriverDownload-March2009/confirmation.php?url=/tesla/375.66/nvidia-diag-driver-local-repo-rhel7-375.66-1.x86_64.rpm
yum -y install nvidia-diag-driver-local-repo-rhel7-375.66-1.x86_64.rpm
但在那之后,我仍然会在我的NVIDIA gpu旁边看到
未计时

有什么想法吗?

你可以试试Xvfb。它不需要额外的硬件

如果尚未安装Xvfb,请安装它,并执行以下步骤。

sudo apt get安装-y xvfb
使“无头”铬/硒发挥作用的依赖性:

sudo apt get-y安装xorg xvfb gtk2发动机pixbuf
sudo apt get-y安装dbus-x11 xfonts基本xfonts-100dpi xfonts-75dpi xfonts西里尔字母xfonts可扩展
可选但美观:用于捕获Xvfb显示的屏幕截图:

sudo apt get-y安装imagemagick x11应用程序
确保每次启动box/vm时Xvfb都会启动:

Xvfb-ac:99-屏幕0 1280x1024x16&
导出显示=:99
运行谷歌Chrome

谷歌浏览器
好的,伙计们。经过两个小时的疯狂之后,我发现了我的问题。我的盒子配置正确。您不能做的是从一个盒子到另一个盒子,再到这个盒子,并期望X11转发能够很好地发挥作用。在不拆开整个网络的情况下,我发现如果我从主框到这个框(没有两个或三个ssh’ing)进行炮击,chrome将作为一个使用CLI的普通用户出现。因此,这是一个从多个盒子多炮弹的问题,使显示器说它设置为零!手动设置显示只会使问题复杂化。一旦我从主外盒直接到这个盒子上,我的显示设置为10:0,这是我配置中的第一个实例。不要犯这个错误,你会浪费宝贵的时间。

我在WSL和Ubuntu上也遇到了同样的问题。我已经安装/重置了ubuntu。之后,我执行了下面的命令

wsl --set-default-version 2
然后我又安装了Ubuntu,我没有收到任何沙盒问题或任何问题


希望这将用于其他人。

FWIW,我在使用SSH登录Docker compose堆栈中的Selenium chrome节点时遇到了这个问题。如果我用
sudo-u seluser google Chrome
root
的身份调用它,Chrome就会启动,但如果我以
seluser
的身份登录,Chrome就不会启动。结果证明,
root
DISPLAY
设置为
:99:0
,而
seluser
根本没有设置它。如果我显式地设置它(从
seluser
shell或从
docker compose exec
命令行),它就工作了

$docker compose exec-u seluser\
selenium chrome \#或任何您的服务名称
/bin/bash
seluser@c02cda62b751:/$导出显示=:99:0
seluser@c02cda62b751:/$google chromehttp://app.test:3000/home

$docker compose exec-u seluser-e DISPLAY=:99:0\
硒铬\
谷歌浏览器http://app.test:3000/home
但是,
:99.0
是未记录的,因此如果这不起作用,您可以尝试使用以下命令检查
根目录的
显示值:

docker compose exec-u root selenium chrome bash-c'echo“${DISPLAY}”

您正试图从另一台计算机在您的计算机上启动google chome,对吗?检查您是否有正在运行的xorg,它的端口是6000+n(n是显示号码)我正在尝试从虚拟机上的计算机启动Chrome。要清楚,我不想X转发-我想SI的NVIDIA特斯拉GPU上的VM。基本问题,但必要的:你有一个运行XORG在你的VM?真棒-这对我工作在Windows与WSL 2和Ubuntu!!你太棒了!修复了我在WSL2Ubuntu中无法运行带有Karma的测试的问题。非常感谢。